mysql sysbench工具

目录

1. sysbench下载 

2. sysbench安装

3. sysbench报错解决

4. sysbench主要参数指令

5. sysbench简单使用

5.1 CPU测试

5.2 memory测试

5.3 文件IO测试

5.4 mysql中innodb_flush_method参数

5.5 mysql中innodb_io_capacity参数

5.6 threads测试


1. sysbench下载 

 github下载:

GitHub - akopytov/sysbench: Scriptable database and system performance benchmark

使用该命令也可下载

[root@localhost ~]# git clone https://github.com/akopytov/sysbench

2. sysbench安装

[root@localhost soft]# unzip sysbench-master.zip
.......[root@localhost soft]# cd sysbench-master
[root@localhost sysbench-master]# ./autogen.sh
......[root@localhost sysbench-master]# ./configure
......
##如果MySQL并不是安装在标准目录/usr/local/bin/下的话,那么就需要自己指定 MySQL 的路径了
[root@localhost sysbench-master]# ./configure --with-mysql-includes=/usr/local/mysql/include --with-mysql-libs=/usr/local/mysql/lib#如果是make -j 4,就是4并行跑
[root@localhost sysbench-master]# make
......[root@localhost sysbench-master]# make install
.......

3. sysbench报错解决

#报错1
[root@localhost soft]# sysbench --test=fileio --file-num=4 --file-block-size=4096 --file-total-size=4G prepare
sysbench: error while loading shared libraries: libmysqlclient.so.20: cannot open shared object file: No such file or directory#mysql安装在/usr/local/mysql下,运行
[root@localhost soft]# ldconfig /usr/local/mysql/lib#报错2
[root@localhost soft]# sysbench --test=fileio --file-num=4 --file-block-size=4096 --file-total-size=4G prepare
sysbench 1.1.0 (using bundled LuaJIT 2.1.0-beta3)FATAL: Cannot find benchmark 'prepare': no such built-in test, file or module#去掉--test=
[root@localhost soft]# sysbench fileio --file-num=4 --file-block-size=4096 --file-total-size=4G prepare
sysbench 1.1.0 (using bundled LuaJIT 2.1.0-beta3)4 files, 1048576Kb each, 4096Mb total
Creating files for the test...
Extra file open flags: (none)
Creating file test_file.0
Creating file test_file.1
Creating file test_file.2
Creating file test_file.3
4294967296 bytes written in 47.59 seconds (86.08 MiB/sec).

4. sysbench主要参数指令

[root@localhost sysbench-master]# make --help
Usage:sysbench [options]... [testname] [command]Commands implemented by most tests: prepare run cleanup help#普通选项
General options:--threads=N                     指定线程数 [1],--num-threads=N的别名(已弃用)--events=N                      事件总数的限制 [0],--max-requests=N的别名(已弃用)--time=N                        限制总执行时间(以秒为单位)[10],--max-time=N的别名(已弃用)--warmup-time=N                 在启用统计信息运行实际基准测试之前,在禁用统计信息的情况下执行事件这么长时间 [0]--forced-shutdown=STRING        强制关闭或禁用“off”之前,在—时间限制之后等待的秒数 [off]--thread-stack-size=SIZE        每个线程的堆栈大小 [64K]--thread-init-timeout=N         等待工作线程初始化的时间(以秒为单位) [30]--rate=N                        平均事务率。0表示不限制[0],--tx-rate=N的别名(已弃用)--report-interval=N             以秒为单位定期报告中间统计信息,0禁用间隔报告 [0]--report-checkpoints=[LIST,...] 转储完整的统计信息,并在指定的时间点重置所有计数器。参数是一个逗号分隔的值列表,表示从测试开始到必须执行报表检查点所花费的时间(以秒为单位)。默认情况下,报表检查点是关闭的。 []--debug[=on|off]                打印更多调试信息 [off]--validate[=on|off]             在可能的情况下执行验证检查[off]--help[=on|off]                 打印帮助并退出 [off]--version[=on|off]              打印版本并退出[off]--config-file=FILENAME          包含命令行选项的文件--luajit-cmd=STRING             执行LuaJIT控制命令。这个选项相当于“luajit -j”。有关更多信息,请参见LuaJIT文档#伪随机数生成器选项
Pseudo-Random Numbers Generator options:--rand-type=STRING   随机数分布{uniform,gaussian,pareto,zipfian}默认使用[uniform]--rand-seed=N        种子为随机数发生器。当为0时,将当前时间用作RNG种子。 [0]--rand-pareto-h=N    形状参数为pareto分布[0.2]--rand-zipfian-exp=N Zipfian分布的形状 参数 (exponent, theta)  [0.8]#日志选项
Log options:--verbosity=N 冗长级别{5 - 调试, 0 - 只有关键消息} [3]--percentile=N       在延迟统计中计算的百分位数(1-100)。使用0的特殊值禁用百分位数计算 [95]--histogram[=on|off] 在报表中打印延迟直方图 [off]#一般数据库选项
General database options:--db-driver=STRING  指定要使用的数据库驱动程序(“帮助”获取可用驱动程序列表) [mysql]--db-ps-mode=STRING 语句使用模式 {auto, disable} [auto]--db-debug[=on|off] 打印特定于数据库的调试信息 [off]#数据库驱动
Compiled-in database drivers:mysql - MySQL drivermysql options:--mysql-host=[LIST,...]          MySQL服务器主机[localhost]--mysql-port=[LIST,...]          MySQL服务器端口 [3306]--mysql-socket=[LIST,...]        MySQL socket--mysql-user=STRING              MySQL 用户[sbtest]--mysql-password=STRING          MySQL 密码[]--mysql-db=STRING                MySQL 数据库名称 [sbtest]--mysql-ssl=STRING               SSL模式。这接受与MySQL客户机实用程序中的——ssl-mode选项相同的值。默认情况下禁用 [disabled]--mysql-ssl-key=STRING           客户端私钥文件的路径名称--mysql-ssl-ca=STRING            CA文件的路径名--mysql-ssl-cert=STRING          客户端公钥证书文件的路径名--mysql-ssl-cipher=STRING        为SSL连接使用特定的密码 []--mysql-compression[=on|off]     如果在客户端库中可用,则使用压缩 [off]--mysql-debug[=on|off]           跟踪所有客户机库调用 [off]--mysql-ignore-errors=[LIST,...] 要忽略的错误列表,或“全部” [1213,1020,1205]--mysql-dry-run[=on|off]         试运行,假设所有MySQL客户端API调用都是成功的,而没有执行它们 [off] them [off]#编译测试
Compiled-in tests:fileio - 文件 I/O 测试cpu - CPU性能测试memory - 内存功能速度测试threads - 线程子系统性能测试mutex - 互斥锁的性能测试See 'sysbench <testname> help' for a list of options for each test.

5. sysbench简单使用

1、使用自带的测试模块,如对cpu,I/O,memory等的测试。
2、使用自带的lua脚本进行测试,如果使用快速安装的方式,默认的脚本路径为:/usr/share/sysbench
3、使用自定义的lua脚本。

5.1 CPU测试

[root@localhost sysbench-master]# sysbench cpu help
sysbench 1.1.0 (using bundled LuaJIT 2.1.0-beta3)cpu options:--cpu-max-prime=N 质数发生器的上限 [10000][root@localhost ~]# sysbench cpu --cpu-max-prime=2000 run
sysbench 1.1.0 (using bundled LuaJIT 2.1.0-beta3)Running the test with following options:
Number of threads: 1
Initializing random number generator from current timePrime numbers limit: 2000Initializing worker threads...Threads started!CPU speed:events per second:  6684.08Throughput:events/s (eps):                      6684.0846time elapsed:                        10.0002stotal number of events:              66842Latency (ms):min:                                    0.12avg:                                    0.15max:                                   21.6395th percentile:                        0.20sum:                                 9947.02Threads fairness:events (avg/stddev):           66842.0000/0.00execution time (avg/stddev):   9.9470/0.00

5.2 memory测试

[root@localhost bin]# sysbench memory help
sysbench 1.1.0 (using bundled LuaJIT 2.1.0-beta3)memory options:--memory-block-size=SIZE    测试内存块的大小 [1K]--memory-total-size=SIZE    要传输的数据的总大小 [100G]--memory-scope=STRING       内存访问范围 {global,local} [global]--memory-hugetlb[=on|off]   从内存池中分配内存[off]--memory-oper=STRING        存储操作类型 {read, write, none} [write]--memory-access-mode=STRING 内存访问模式 {seq,rnd} [seq][root@localhost ~]# sysbench memory  --memory-block-size=16k --memory-total-size=2G run
sysbench 1.1.0 (using bundled LuaJIT 2.1.0-beta3)Running the test with following options:
Number of threads: 1
Initializing random number generator from current timeRunning memory speed test with the following options:block size: 16KiBtotal size: 2048MiBoperation: writescope: globalInitializing worker threads...Threads started!Total operations: 131072 (945638.23 per second)2048.00 MiB transferred (14775.60 MiB/sec)Throughput:events/s (eps):                      945638.2256time elapsed:                        0.1386stotal number of events:              131072Latency (ms):min:                                    0.00avg:                                    0.00max:                                    0.5395th percentile:                        0.00sum:                                  114.99Threads fairness:events (avg/stddev):           131072.0000/0.00execution time (avg/stddev):   0.1150/0.00

5.3 文件IO测试

[root@localhost ~]# sysbench fileio help
sysbench 1.1.0 (using bundled LuaJIT 2.1.0-beta3)fileio options:--file-num=N                  代表生成测试文件的数量 [128]--file-block-size=N           在所有IO操作中使用的块大小 [16384]--file-total-size=SIZE        要创建的文件的总大小 [2G]--file-test-mode=STRING       测试模式 {seqwr, seqrewr, seqrd, rndrd, rndwr, rndrw}--file-io-mode=STRING         文件操作模式 {sync,async,mmap} [sync]--file-extra-flags=[LIST,...] 用于打开文件的附加标志列表 {sync,dsync,direct} []--file-fsync-freq=N           执行fsync()函数的频率。fsync主要是同步磁盘文件,因为可能有系统和磁盘缓冲的关系。 0代表不使用fsync函数。默认值为100,意思是每写100次,刷新到磁盘1次。--file-fsync-all[=on|off]     每执行完一次写操作,就执行一次fsync。默认为off。--file-fsync-end[=on|off]     在测试结束时执行fsync函数。默认为on。--file-fsync-mode=STRING      文件同步函数的选择,同样是和API相关的参数,由于多个操作系统对于fdatasync支持不同,因此不建议使用fdatasync。默认为fsync。--file-merged-requests=N      大多情况下,合并可能的IO的请求数,默认为0。--file-rw-ratio=N             测试时的读写比例,默认时为1.5,即可3:2。
#准备
[root@localhost soft]# sysbench fileio --file-num=4 --file-block-size=4096 --file-total-size=4G prepare#运行
[root@localhost soft]# sysbench --time=30 --threads=4  --events=0 --report-interval=1 fileio --file-num=4 --file-block-size=4096 --file-total-size=4G --file-test-mode=rndrd --file-extra-flags=direct  --file-fsync-freq=1 run#清理
[root@localhost soft]# sysbench --time=30 --threads=4  --events=0 --report-interval=1 fileio --file-num=4 --file-block-size=4096 --file-total-size=4G --file-test-mode=rndrd --file-extra-flags=direct  --file-fsync-freq=1 cleanup
sysbench 1.1.0 (using bundled LuaJIT 2.1.0-beta3)Removing test files...

上述参数指定运行时间为30秒,4个线程,每隔1秒生成报告,文件数量为4个总大小为4G,文件块为4KB,文件测试模式为随机读,每写1次数据就刷新1次到磁盘,--file-extra-flags=direct表示直接写入到磁盘,不经过内存

#准备阶段,生成文件
[root@localhost soft]# sysbench fileio --file-num=4 --file-block-size=4096 --file-total-size=4G prepare
sysbench 1.1.0 (using bundled LuaJIT 2.1.0-beta3)4 files, 1048576Kb each, 4096Mb total
Creating files for the test...
Extra file open flags: (none)
Creating file test_file.0
Creating file test_file.1
Creating file test_file.2
Creating file test_file.3
4294967296 bytes written in 47.59 seconds (86.08 MiB/sec).#运行阶段,测试IO
[root@localhost soft]# sysbench --time=30 --threads=4  --events=0 --report-interval=1 fileio --file-num=4 --file-block-size=4096 --file-total-size=4G --file-test-mode=rndrd --file-extra-flags=direct  --file-fsync-freq=1 run
sysbench 1.1.0 (using bundled LuaJIT 2.1.0-beta3)Running the test with following options:
Number of threads: 4
Report intermediate results every 1 second(s)
Initializing random number generator from current timeExtra file open flags: directio
4 files, 1GiB each
4GiB total file size
Block size 4KiB
Number of IO requests: 0
Read/Write ratio for combined random IO test: 1.50
Periodic FSYNC enabled, calling fsync() each 1 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing random read test
Initializing worker threads...Threads started![ 1s ] reads: 7.94 MiB/s writes: 0.00 MiB/s fsyncs: 0.00/s latency (ms,95%): 9.222
[ 2s ] reads: 19.00 MiB/s writes: 0.00 MiB/s fsyncs: 0.00/s latency (ms,95%): 5.277
[ 3s ] reads: 33.83 MiB/s writes: 0.00 MiB/s fsyncs: 0.00/s latency (ms,95%): 0.702
[ 4s ] reads: 38.00 MiB/s writes: 0.00 MiB/s fsyncs: 0.00/s latency (ms,95%): 0.566
[ 5s ] reads: 35.82 MiB/s writes: 0.00 MiB/s fsyncs: 0.00/s latency (ms,95%): 0.608
[ 6s ] reads: 42.13 MiB/s writes: 0.00 MiB/s fsyncs: 0.00/s latency (ms,95%): 0.481
[ 7s ] reads: 37.11 MiB/s writes: 0.00 MiB/s fsyncs: 0.00/s latency (ms,95%): 0.536
[ 8s ] reads: 46.46 MiB/s writes: 0.00 MiB/s fsyncs: 0.00/s latency (ms,95%): 0.490
[ 9s ] reads: 65.62 MiB/s writes: 0.00 MiB/s fsyncs: 0.00/s latency (ms,95%): 0.448
[ 10s ] reads: 34.38 MiB/s writes: 0.00 MiB/s fsyncs: 0.00/s latency (ms,95%): 0.597
[ 11s ] reads: 3.60 MiB/s writes: 0.00 MiB/s fsyncs: 0.00/s latency (ms,95%): 25.278
[ 12s ] reads: 72.33 MiB/s writes: 0.00 MiB/s fsyncs: 0.00/s latency (ms,95%): 0.336
[ 13s ] reads: 73.48 MiB/s writes: 0.00 MiB/s fsyncs: 0.00/s latency (ms,95%): 0.336
[ 14s ] reads: 68.58 MiB/s writes: 0.00 MiB/s fsyncs: 0.00/s latency (ms,95%): 0.440
[ 15s ] reads: 69.85 MiB/s writes: 0.00 MiB/s fsyncs: 0.00/s latency (ms,95%): 0.440
[ 16s ] reads: 73.12 MiB/s writes: 0.00 MiB/s fsyncs: 0.00/s latency (ms,95%): 0.348
[ 17s ] reads: 76.02 MiB/s writes: 0.00 MiB/s fsyncs: 0.00/s latency (ms,95%): 0.388
[ 18s ] reads: 60.05 MiB/s writes: 0.00 MiB/s fsyncs: 0.00/s latency (ms,95%): 0.456
[ 19s ] reads: 70.11 MiB/s writes: 0.00 MiB/s fsyncs: 0.00/s latency (ms,95%): 0.440
[ 20s ] reads: 71.63 MiB/s writes: 0.00 MiB/s fsyncs: 0.00/s latency (ms,95%): 0.448
[ 21s ] reads: 69.33 MiB/s writes: 0.00 MiB/s fsyncs: 0.00/s latency (ms,95%): 0.432
[ 22s ] reads: 61.86 MiB/s writes: 0.00 MiB/s fsyncs: 0.00/s latency (ms,95%): 0.527
[ 23s ] reads: 69.31 MiB/s writes: 0.00 MiB/s fsyncs: 0.00/s latency (ms,95%): 0.409
[ 24s ] reads: 72.91 MiB/s writes: 0.00 MiB/s fsyncs: 0.00/s latency (ms,95%): 0.388
[ 25s ] reads: 72.76 MiB/s writes: 0.00 MiB/s fsyncs: 0.00/s latency (ms,95%): 0.409
[ 26s ] reads: 73.62 MiB/s writes: 0.00 MiB/s fsyncs: 0.00/s latency (ms,95%): 0.395
[ 27s ] reads: 73.40 MiB/s writes: 0.00 MiB/s fsyncs: 0.00/s latency (ms,95%): 0.395
[ 28s ] reads: 72.39 MiB/s writes: 0.00 MiB/s fsyncs: 0.00/s latency (ms,95%): 0.424
[ 29s ] reads: 71.49 MiB/s writes: 0.00 MiB/s fsyncs: 0.00/s latency (ms,95%): 0.424Throughput:read:  IOPS=14614.94 57.09 MiB/s (59.86 MB/s)write: IOPS=0.00 0.00 MiB/s (0.00 MB/s)fsync: IOPS=0.00Latency (ms):min:                                  0.05avg:                                  0.27max:                                333.2395th percentile:                      0.45sum:                             118025.67#清理文件
[root@localhost soft]# sysbench --time=30 --threads=4  --events=0 --report-interval=1 fileio --file-num=4 --file-block-size=4096 --file-total-size=4G --file-test-mode=rndrd --file-extra-flags=direct  --file-fsync-freq=1 cleanup
sysbench 1.1.0 (using bundled LuaJIT 2.1.0-beta3)Removing test files...

5.4 mysql中innodb_flush_method参数

  • fdatasync模式:写数据时,write这一步并不需要真正写到磁盘才算完成(可能写入到操作系统buffer中就会返回完成),真正完成是flush操作,buffer交给操作系统去flush,并且文件的元数据信息也都需要更新到磁盘。
  • O_DSYNC模式:写日志操作是在write这步完成,而数据文件的写入是在flush这步通过fsync完成
  • O_DIRECT模式:数据文件的写入操作是直接从mysql innodb buffer到磁盘的,并不用通过操作系统的缓冲,而真正的完成也是在flush这步,日志还是要经过OS缓冲

生产环境中使用innodb_flush_method=O_DIRECT 

官方建议:

How each setting affects performance depends on hardware configuration and workload. Benchmark your particular configuration to decide which setting to use, or whether to keep the default setting. Examine theInnodb_data_fsyncs status variable to see the overall number of fsync() calls for each setting. The mix of read and write operations in your workload can affect how a setting performs. For example, on a system with a hardware RAID controller and battery-backed write cache, O_DIRECT can help to avoid double buffering between the InnoDBbuffer pool and the operating system file system cache. On some systems where InnoDB data and log files are located on a SAN, the default value or O_DSYNC might be faster for a read-heavy workload with mostly SELECT statements. Always test this parameter with hardware and workload that reflect your production environment.

意思就是说,具体的取值跟硬件配置和工作负载相关,最好做一次压测来决定。不过通常来说,linux环境下具有raid控制器和write-back写策略,O_DIRECT是比较好的选择,避免操作系统和存储系统两次缓存;如果使用SAN存储来存放数据文件和日志文件,对于读负载较高的存储系统,使用fsync()或O_DSYNC可能更快。

5.5 mysql中innodb_io_capacity参数

官方建议:

The innodb_io_capacity variable defines the overall I/O capacity available to InnoDB. It should be set to approximately the number of I/O operations that the system can perform per second (IOPS). When innodb_io_capacity is set, InnoDB estimates the I/O bandwidth available for background tasks based on the set value.

innodb_io_capacity表示每秒写能用的IOPS是多少,对读无效对写有决定意义,该值根据磁盘写的IOPS来设置,innodb_io_capacity是innodb_io_capacity_max的一半

5.6 threads测试

[root@localhost soft]# sysbench threads help
sysbench 1.1.0 (using bundled LuaJIT 2.1.0-beta3)threads options:--thread-yields=N 每个请求要执行的收益率数 [1000]--thread-locks=N  每个线程的锁数量 [8][root@localhost soft]# sysbench threads --threads=8 --thread-yields=100 --thread-locks=2 run
sysbench 1.1.0 (using bundled LuaJIT 2.1.0-beta3)Running the test with following options:
Number of threads: 8
Initializing random number generator from current timeInitializing worker threads...Threads started!Throughput:events/s (eps):                      5894.2951time elapsed:                        10.0010stotal number of events:              58949Latency (ms):min:                                    0.07avg:                                    1.35max:                                   70.2695th percentile:                        4.41sum:                                79574.87Threads fairness:events (avg/stddev):           7368.6250/204.72execution time (avg/stddev):   9.9469/0.02

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/621104.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

2024 EasyRecovery三分钟帮你恢复 电脑硬盘格式化

随着数字化时代的到来&#xff0c;我们的生活和工作中越来越依赖于电子设备。然而&#xff0c;电子设备中的数据丢失问题也随之而来。数据丢失可能是由各种原因引起的&#xff0c;如硬盘故障、病毒感染、误删除等。面对这种情况&#xff0c;一个高效、可靠的数据恢复工具变得尤…

11.哀家要长脑子了!

目录 1.453. 最小操作次数使数组元素相等 - 力扣&#xff08;LeetCode&#xff09; 2.665. 非递减数列 - 力扣&#xff08;LeetCode&#xff09; 3. 283. 移动零 - 力扣&#xff08;LeetCode&#xff09; 4. 3114. 替换字符可以得到的最晚时间 - 力扣&#xff08;LeetCode…

eclipse导入maven项目与配置使用本地仓库

前言 本人润国外了&#xff0c;发现不能用收费软件IDEA了&#xff0c;需要使用eclipse&#xff0c;这个免费。 但是早忘了怎么用了&#xff0c;在此总结下。 一、eclipse导入本地项目 1.选这个&#xff1a;open projects from file system… 2.找到项目文件夹&#xff0c;…

cookie与session及其区别

一、cookie 1. 为什么需要cookie&#xff1f; web程序使用HTTP协议进行传输&#xff0c;而HTTP协议是无状态的协议&#xff08;即对事务处理无记忆性&#xff0c;如果后续处理需要使用前面的信息&#xff0c;只能重传&#xff0c;导致每次连接传送的数据量增大&#xff09;。c…

AI预测福彩3D第34弹【2024年4月13日预测--第8套算法开始计算第2次测试】

各位小伙伴&#xff0c;今天实在抱歉&#xff0c;周末回了趟老家&#xff0c;回来比较晚了&#xff0c;数据今天上午跑完后就回老家了&#xff0c;晚上8点多才回来&#xff0c;赶紧把预测结果发出来吧&#xff0c;虽然有点晚了&#xff0c;但是咱们前面说过了&#xff0c;目前的…

【团体程序设计天梯赛 往年关键真题 25分题合集 详细分析完整AC代码】(L2-025 - L2-048)搞懂了赛场上拿下这些分就稳了

L2-025 分而治之 并查集 样例 输入样例&#xff1a; 10 11 8 7 6 8 4 5 8 4 8 1 1 2 1 4 9 8 9 1 1 10 2 4 5 4 10 3 8 4 6 6 1 7 5 4 9 3 1 8 4 2 2 8 7 9 8 7 6 5 4 2输出样例&#xff1a; NO YES YES NO NO分析&#xff1a; 先将所有边记录下来&#xff0c;再每次询问时&…

针对MaxCompute优化案例分享

声明 原文来源&#xff1a;微信公众号&#xff1a;阿里云开发者 前言 MaxCompute 是阿里巴巴集团推出的一种大数据计算平台&#xff0c;用于处理海量数据和进行数据分析。它提供了高可靠性、高扩展性和高性能的数据处理能力&#xff0c;支持 SQL 查询、MapReduce 计算和机器…

python|reset_index

reset_index可以重置索引index&#xff0c;比如说将A、B、C删除一列后&#xff0c;重置成数字。

外卖点餐APP开发需要哪些功能

uni-app框架&#xff1a;使用Vue.js开发跨平台应用的前端框架&#xff0c;编写一套代码&#xff0c;可编译到Android、小程序等平台。 框架支持:springboot/Ssm/thinkphp/django/flask/express均支持 前端开发:vue.js 可选语言&#xff1a;pythonjavanode.jsphp均支持 运行软件…

纯css实现switch开关

代码比较简单&#xff0c;有需要直接在下边粘贴使用吧~ html: <div class"switch-box"><input id"switch" type"checkbox"><label></label></div> css&#xff1a; .switch-box {position: relative;height: 25px…

探索以太坊世界:使用Geth打造你的私人网络

文章目录 概要名词解释Geth&#xff08;Go Ethereum&#xff09;区块链网络种类 具体流程下载geth客户端配置私链新建创世区块启动私链 连接MetaMask钱包小结 概要 在区块链领域&#xff0c;以太坊私链的搭建是学习和开发智能合约的重要一步。私链允许开发者在独立的环境中进行…

【vue】用vite创建vue项目

前置要求 要有Node.js 1. 用vite创建vue项目 在cmd中&#xff0c;进入一个文件夹 在文件资源管理器上面的文件目录中&#xff0c;输入cmd&#xff0c;回车在cmd中通过cd命令进入对应文件夹 创建项目 npm create vitelatest # 创建项目创建项目过程中的一些选项 Ok to pro…