seconds_behind_master含义及不足
seconds_behind_master的值是通过将salve服务器当前的时间戳与二进制日志中的事件的时间戳相比得到的,所以只有执行事件时才会报告延迟。
1.1 如果备库复制线程没有运行,就会报延迟为null。
1.2 一些错误比如网络不稳定可能导致复制中断或停止复制线程,但是seconds_behind_master将显示为0,而不是显示错误
1.3 即使备库线程正在运行,备库有时候可能无法计算延时,如果发生这种情况,备库会报0或者null。
1.4 一个大事务可能会导致延迟波动,例如一个事务更新数据长达1个小时,最后提交。这条更新语句将比它实际发生时间要晚一个小时才记录到二进制日志中,当备库执行这 条语句时,会临时报告备库延迟1小时,然后又很快变为0。
pt-heartbeat原理
改进的做法就是使用percona toolkit工具包的pt-heartbeat,工作原理如下:
2.1 在master上创建一张heartbeat表,按照一定的时间频率更新该表的字段,主要就是向该表写入当前的时间戳
2.2 连接到slave上检查该表的时间记录,和运行pt-heartbeat的当前系统时间进行比较,得出时间的差异,这个时间差异就是复制延迟
注1:这里的2中的系统时间并不一定是slave的系统时间,如果pt-heartbeat的复制监控脚本运行在master上,那么当前系统时间就是master的当前系统时间,这时就不需要严格同步master服务器和slave服务器的时间一致了。
注2:这里的创建的heartbeat表必须在复制同步下的库,有些教材都写了test库,但有时我们在复制配置中过滤了test库的复制,需要注意这一点
使用方法:
pt-heartbeat [OPTIONS] [DSN] --update|--monitor|--check|--stop
在主库上开启守护进程来更新game.heartbeat表:
pt-heartbeat -D game --update -h master-server --daemonize
监控从的延迟情况:
pt-heartbeat -D game --monitor -h slave-server #一直执行,不退出 pt-heartbeat -D game --check h=slave-server #执行一次就退出
常用参数:
注意:需要指定的参数至少有 --stop,--update,--monitor,--check。其中--update,--monitor和--check是互斥的,--daemonize和--check也是互斥。
--ask-pass 隐式输入MySQL密码 --charset 字符集设置 --check 检查从的延迟,检查一次就退出,除非指定了--recurse会递归的检查所有的从服务器。 --check-read-only 如果从服务器开启了只读模式,该工具会跳过任何插入。 --create-table 在主上创建心跳监控的表,如果该表不存在。可以自己建立,建议存储引擎改成memory。通过更新该表知道主从延迟的差距。 CREATE TABLE heartbeat ( ts varchar(26) NOT NULL, server_id int unsigned NOT NULL PRIMARY KEY, file varchar(255) DEFAULT NULL, -- SHOW MASTER STATUS position bigint unsigned DEFAULT NULL, -- SHOW MASTER STATUS relay_master_log_file varchar(255) DEFAULT NULL, -- SHOW SLAVE STATUS exec_master_log_pos bigint unsigned DEFAULT NULL -- SHOW SLAVE STATUS ); heratbeat表一直在更改ts和position,而ts是我们检查复制延迟的关键。 --daemonize 执行时,放入到后台执行 --user -u,连接数据库的帐号 --database -D,连接数据库的名称 --host -h,连接的数据库地址 --password -p,连接数据库的密码 --port -P,连接数据库的端口 --socket -S,连接数据库的套接字文件 --file 【--file=output.txt】 打印--monitor最新的记录到指定的文件,很好的防止满屏幕都是数据的烦恼。 --frames 【--frames=1m,2m,3m】 在--monitor里输出的[]里的记录段,默认是1m,5m,15m。可以指定1个,如:--frames=1s,多个用逗号隔开。可用单位有秒(s)、分钟(m)、小时(h)、天(d)。 --interval 检查、更新的间隔时间。默认是见是1s。最小的单位是0.01s,最大精度为小数点后两位,因此0.015将调整至0.02。 --log 开启daemonized模式的所有日志将会被打印到制定的文件中。 --monitor 持续监控从的延迟情况。通过--interval指定的间隔时间,打印出从的延迟信息,通过--file则可以把这些信息打印到指定的文件。 --master-server-id 指定主的server_id,若没有指定则该工具会连到主上查找其server_id。 --print-master-server-id 在--monitor和--check 模式下,指定该参数则打印出主的server_id。 --recurse 多级复制的检查深度。模式M-S-S...不是最后的一个从都需要开启log_slave_updates,这样才能检查到。 --recursion-method 指定复制检查的方式,默认为processlist,hosts。 --update 更新主上的心跳表。 --replace 使用--replace代替--update模式更新心跳表里的时间字段,这样的好处是不用管表里是否有行。 --stop 停止运行该工具(--daemonize),在/tmp/目录下创建一个“pt-heartbeat-sentinel” 文件。后面想重新开启则需要把该临时文件删除,才能开启(--daemonize)。 --table 指定心跳表名,默认heartbeat。
主:192.168.0.11
从:192.168.0.9
主数据库上面运行:
pt-heartbeat --user=root --ask-pss --host=127.0.0.1 --create-table -D game --interval=1 --update --replace --daemonize
主数据库上执行监控:
pt-heartbeat -D game --table=heartbeat --monitor -h192.168.0.9 -uroot --ask-pass
pt-heartbeat -D game --table=heartbeat --check -h192.168.0.9 -uroot --ask-pass 只监控一次
pt-index-usage
功能介绍:
从log文件中读取插叙语句,并用explain分析他们是如何利用索引。完成分析之后会生成一份关于索引没有被查询使用过的报告。
l 用法介绍:
pt-index-usage [OPTION...] [FILE...]
可以直接从慢查询中获取sql,FILE文件中的sql格式必须和慢查询中个是一致,如果不是一直需要用pt-query-digest转换一下。也可以不生成报告直接保存到数据库中,具体的见后面的示例
l 使用示例:
从满查询中的sql查看索引使用情况范例:
pt-index-usage /tmp/localhost-slow.log --host=localhost --user=root --password=123456
将分析结果保存到数据库范例:
pt-index-usage /tmp/localhost-slow.log --host=localhost --user=root --password=123456 --no-report --create-save-results-database
使用--create-save-results-database会自动生成数据库和表来保存结果。
pt-ioprofile
是一个percona的性能分析工具,可以查看进程输出、输入,打印一些表文件及活动IO。pt-ioprofile是一个只读工具,所以对数据没风险。
有人在生产环境中使用ioprofile时出现导致mysql挂起的现象,虽然是5年前了,但还是请谨慎使用。
pt-ioprofile -p 8534 -c count Sun Apr 3 14:32:48 CST 2016 Tracing process ID 21751 total pread read pwrite write fsync open close getdents lseek fcntl ftruncate filename 124838 0 24 124796 0 0 4 5 2 6 1 0 /tmp/#sql_54f7_0.MYD 36315 0 16888 0 5877 0 406 695 694 17 11738 0 /usr/local/mysql/data/game/ 9534 0 2959 0 3616 0 0 0 0 2959 0 0 /usr/local/mysql/data/relay-bin.005950 7232 0 0 0 3616 0 0 0 0 3616 0 0 /usr/local/mysql/data/master.info 3003 0 1421 4 576 0 4 33 0 4 961 0 /tmp/#sql_54f7_0.MYI 2191 0 1051 0 365 0 1 34 20 2 718 0 /usr/local/mysql/data/mysql-bin.000232 1244 0 0 0 622 0 0 0 0 622 0 0 /usr/local/mysql/data/relay-log.info 858 0 0 0 858 0 0 0 0 0 0 0 /usr/local/mysql/data/slowlog/20160403_slow.log 685 0 0 651 0 34 0 0 0 0 0 0 /usr/local/mysql/data/ib_logfile2 152 4 60 2 32 0 3 4 0 12 35 0 /tmp/#sql54f7_142ba6e6_1.frm 112 0 0 51 0 61 0 0 0 0 0 0 /usr/local/mysql/data/ibdata1 88 28 30 0 0 0 0 0 0 30 0 0 /usr/local/mysql/data/game/tb_area.MYD 53 20 12 0 12 0 4 1 0 4 0 0 /tmp/#sql_54f7_1.MYD 49 4 10 2 15 0 3 3 0 12 0 0 /tmp/#sql54f7_142ba6e6_0.frm 30 0 0 0 0 30 0 0 0 0 0 0 /usr/local/mysql/data/game/tb_trlog#P#p1604.ibd 29 0 0 0 0 29 0 0 0 0 0 0 /usr/local/mysql/data/game/tb_player_stat.ibd 27 0 0 0 0 27 0 0 0 0 0 0 /usr/local/mysql/data/game/tb_player.ibd 24 0 0 0 0 24 0 0 0 0 0 0 /usr/local/mysql/data/game/tb_log#P#p1604.ibd 16 0 0 0 8 8 0 0 0 0 0 0 /usr/local/mysql/data/mysql-bin.000234 16 0 0 0 0 16 0 0 0 0 0 0 /usr/local/mysql/data/game/tb_log#P#p1604.ibd 13 0 0 0 0 13 0 0 0 0 0 0 /usr/local/mysql/data/game/tb_log#P#p1604.ibd 11 0 2 0 5 0 0 0 0 3 0 1 /tmp/ibhAJY2f 9 0 2 2 0 0 3 1 0 1 0 0 /tmp/#sql_54f7_1.MYI 8 0 0 0 0 8 0 0 0 0 0 0 /usr/local/mysql/data/game/tb_deposit.ibd 7 0 0 0 0 0 1 3 0 3 0 0 /usr/local/mysql/data/mysql-bin.000229 6 2 2 0 0 0 0 0 0 2 0 0 /usr/local/mysql/data/mysql/proc.MYD 6 0 0 0 0 6 0 0 0 0 0 0 /usr/local/mysql/data/game/tb_captcha_log.ibd 3 0 2 0 0 0 0 0 0 1 0 0 /usr/local/mysql/data/mysql-bin.index 3 0 0 0 0 3 0 0 0 0 0 0 /usr/local/mysql/data/ib_logfile0 3 0 0 0 0 3 0 0 0 0 0 0 /usr/local/mysql/data/game/tb_withdraw_log.ibd 3 0 0 0 0 3 0 0 0 0 0 0 /usr/local/mysql/data/game/tb_player_online.ibd 2 0 0 0 0 2 0 0 0 0 0 0 /usr/local/mysql/data/game/tb_player_child_list.ibd 1 1 0 0 0 0 0 0 0 0 0 0 /usr/local/mysql/data/game/tb_log.ibd 1 0 0 0 0 1 0 0 0 0 0 0 /usr/local/mysql/data/game/tb_player_online_log.ibd pt-ioprofile -p 8534 -c sizes Sun Apr 3 14:23:12 CST 2016 Tracing process ID 21751 total pread read pwrite write fsync open close getdents lseek fcntl filename 1130822069785 0 532078 0 532078 0 0 0 0 1130821005629 0 /usr/local/mysql/data/y-bin.005950 34816000 0 0 34816000 0 0 0 0 0 0 0 /usr/local/mysql/data/ibdata1 10942314 0 1064960 0 5072362 0 0 0 4804992 0 0 /usr/local/mysql/data/game/ 1772544 0 0 1772544 0 0 0 0 0 0 0 /usr/local/mysql/data/ib_logfile2 1425408 1425408 0 0 0 0 0 0 0 0 0 /usr/local/mysql/data/game/tb_trlog#P#p1603.ibd 476444 0 0 0 476444 0 0 0 0 0 0 /usr/local/mysql/data/slowlog/20160403_slow.log 309097 0 0 0 309097 0 0 0 0 0 0 /usr/local/mysql/data/master.info 88930 62 5038 72 25630 0 0 0 0 58128 0 /tmp/#sql54f7_142b8717_1.frm 76980 3416 40 0 0 0 0 0 0 73524 0 /usr/local/mysql/data/mysql/proc.MYD 67742 62 886 72 8594 0 0 0 0 58128 0 /tmp/#sql54f7_142b8717_0.frm 49152 49152 0 0 0 0 0 0 0 0 0 /usr/local/mysql/data/game/tb_trlog#P#p1604.ibd 49152 49152 0 0 0 0 0 0 0 0 0 /usr/local/mysql/data/game/tb_delog.ibd 37760 0 0 0 37760 0 0 0 0 0 0 /usr/local/mysql/data/relay-log.info 32768 32768 0 0 0 0 0 0 0 0 0 /usr/local/mysql/data/game/tb_withdraw_log.ibd 16384 16384 0 0 0 0 0 0 0 0 0 /usr/local/mysql/data/game/tb_player_child_list.ibd 4963 0 0 0 4963 0 0 0 0 0 0 /usr/local/mysql/data/mysql-bin.000234 0 0 0 0 0 0 0 0 0 0 0 /usr/local/mysql/data/ib_logfile0 0 0 0 0 0 0 0 0 0 0 0 /usr/local/mysql/data/game/tb_player_stat.ibd
pt-kill
是一个优秀的kill MySQL连接的一个工具,是percona toolkit的一部分,在因为空闲连接较多导致超过最大连接数、某个有问题的sql导致mysql负载很高时,都需要将一些连接kill掉,这个工具主要就是这个用途。
参数: –busy-time运行时间 –idle-time空闲时间 –victims所有匹配的连接,对应有最久的连接 –interval间隔时间,默认30s,有点长,可以根据实际情况来调节 –print打印出来kill掉的连接 –match-command匹配当前连接的命令 QuerySleepBinlog DumpConnectDelayed insertExecuteFetchInit DBKillPrepareProcesslistQuitReset stmtTable Dump –match-state匹配当前连接的状态Lockedlogincopy to tmp tableCopying to tmp tableCopying to tmp table on diskCreating tmp tableexecutingReading from netSending dataSorting for orderSorting resultTable lockUpdating –match-info使用正则表达式匹配符合的sql –match-db –match-user –match-host见名知意
常用用法:
杀掉空闲链接
pt-kill –match-command Sleep –idle-time 5 –host –port –interval –print –kill –victims all 杀掉运行时间超过5s的链接 pt-kill –match-command Query –busy-time 5 –host –port –interval –print –kill –victims all 杀掉匹配某个规则的正在运行的sql pt-kill –match-command Query –busy-time 5 –host –port –interval –print –kill –victims all –match-info 杀掉正在进行filesort的sql pt-kill –match-command Query –match-state “Sorting result” busy-time 5 –host –port –interval –print –kill –victims all 杀掉正在Copying to tmp table的sql pt-kill –match-command Query –match-state “Copying to tmp table” busy-time 5 –host –port –interval –print –kill –victims all
pt-mext
并行查看SHOW GLOBAL STATUS的多个样本的信息。
pt-mext会执行你指定的COMMAND,并每次读取一行结果,把空行分割的内容保存到一个一个的临时文件中,最后结合这些临时文件并行查看结果。
pt-mext -r -- mysqladmin ext -i10 -c3 pt-mext -r -- cat mysqladmin-output.txt
pt-mysql-summary
查看mysql各个统计信息
# Percona Toolkit MySQL Summary Report ####################### System time | 2016-04-03 06:52:08 UTC (local TZ: CST +0800) # Instances ################################################## Port Data Directory Nice OOM Socket ===== ========================== ==== === ====== 3307 /usr/local/mysql/data_3307 0 0 /tmp/mysql_3307.sock 3306 /var/lib/mysql/data 0 0 /var/tmp/mysql.sock # MySQL Executable ########################################### Path to executable | /usr/local/mysql/bin/mysqld Has symbols | Yes # Report On Port 3306 ######################################## User | root@localhost Time | 2016-04-03 14:52:08 (CST) Hostname | c33-01 Version | 5.5.21-log Source distribution Built On | Linux x86_64 Started | 2016-02-18 12:36 (up 45+02:15:15) Databases | 6 Datadir | /var/lib/mysql/data/ Processes | 8 connected, 3 running Replication | Is not a slave, has 1 slaves connected Pidfile | /var/lib/mysql/data/c33-01.pid (exists) # Processlist ################################################ Command COUNT(*) Working SUM(Time) MAX(Time) ------------------------------ -------- ------- --------- --------- Binlog Dump 1 1 175000 175000 Daemon 1 1 25 25 Query 1 1 0 0 Sleep 6 0 450 125 User COUNT(*) Working SUM(Time) MAX(Time) ------------------------------ -------- ------- --------- --------- event_scheduler 1 1 25 25 GaMe 6 0 0 0 repl 1 1 175000 175000 root 1 1 0 0 Host COUNT(*) Working SUM(Time) MAX(Time) ------------------------------ -------- ------- --------- --------- 127.0.0.1 6 0 0 0 192.168.53.9 1 1 175000 175000 localhost 2 2 25 25 db COUNT(*) Working SUM(Time) MAX(Time) ------------------------------ -------- ------- --------- --------- game 6 0 0 0 NULL 3 3 175000 175000 State COUNT(*) Working SUM(Time) MAX(Time) ------------------------------ -------- ------- --------- --------- 6 0 0 0 Master has sent all binlog to 1 1 175000 175000 NULL 1 1 0 0 Waiting for next activation 1 1 25 25 # Status Counters (Wait 10 Seconds) ########################## Variable Per day Per second 11 secs Aborted_clients 4 Binlog_cache_use 225000 2 Bytes_received 400000000 4500 400 Bytes_sent 900000000 10000 3500 Com_admin_commands 800000 9 Com_alter_table 6 Com_begin 125000 1 Com_change_db 1 Com_commit 70000 Com_create_table 3 Com_delete 17500 Com_drop_table 4 Com_insert 70000 Com_lock_tables 3 Com_rollback 800000 9 Com_select 700000 8 1 Com_set_option 800000 9 Com_show_create_proc 1 Com_show_fields 9 Com_show_table_status 8 Com_stmt_close 1250000 15 Com_stmt_execute 1250000 15 Com_stmt_prepare 1250000 15 Com_unlock_tables 3 Com_update 250000 2 Connections 3000 1 Created_tmp_disk_tables 10 1 Created_tmp_tables 20 3 Handler_commit 1500000 20 Handler_delete 9000 Handler_prepare 800000 8 Handler_read_first 70000 Handler_read_key 1500000 20 Handler_read_next 30000 Handler_read_rnd_next 12500000 150 30 Handler_rollback 50000 Handler_update 225000 2 Handler_write 1500000 20 30 Innodb_buffer_pool_pages_flushed 1250000 15 Innodb_buffer_pool_read_ahead 20 Innodb_buffer_pool_read_requests 80000000 900 Innodb_buffer_pool_reads 50 Innodb_buffer_pool_write_requests 8000000 90 Innodb_data_fsyncs 125000 1 Innodb_data_read 1250000 15 Innodb_data_reads 60 Innodb_data_writes 900000 10 Innodb_data_written 20000000000 250000 Innodb_dblwr_pages_written 600000 7 Innodb_dblwr_writes 9000 Innodb_log_write_requests 700000 8 Innodb_log_writes 500000 5 Innodb_os_log_fsyncs 70000 Innodb_os_log_written 600000000 7000 Innodb_pages_created 10000 Innodb_pages_read 80 Innodb_pages_written 600000 7 Innodb_row_lock_time 3000 Innodb_row_lock_waits 6000 Innodb_rows_deleted 9000 Innodb_rows_inserted 1500000 20 Innodb_rows_read 12500000 150 Innodb_rows_updated 225000 2 Key_read_requests 600 Key_write_requests 300 Key_writes 6 Open_table_definitions 2 Opened_files 90 4 Opened_table_definitions 10 Opened_tables 15 Qcache_hits 90000 1 Qcache_inserts 600000 7 Qcache_not_cached 100000 1 1 Queries 5000000 60 8 Questions 3000000 35 6 Select_scan 17500 Slow_queries 70000 Table_locks_immediate 3000000 30 Threads_created 1 Uptime 90000 1 1 # Table cache ################################################ Size | 300 Usage | 100% # Key Percona Server features ################################ Table & Index Stats | Not Supported Multiple I/O Threads | Enabled Corruption Resilient | Not Supported Durable Replication | Not Supported Import InnoDB Tables | Not Supported Fast Server Restarts | Not Supported Enhanced Logging | Not Supported Replica Perf Logging | Not Supported Response Time Hist. | Not Supported Smooth Flushing | Not Supported HandlerSocket NoSQL | Not Supported Fast Hash UDFs | Unknown # Percona XtraDB Cluster ##################################### # Plugins #################################################### InnoDB compression | ACTIVE # Query cache ################################################ query_cache_type | ON Size | 32.0M Usage | 1% HitToInsertRatio | 15% # Schema ##################################################### Specify --databases or --all-databases to dump and summarize schemas # Noteworthy Technologies #################################### SSL | No Explicit LOCK TABLES | Yes Delayed Insert | No XA Transactions | No NDB Cluster | No Prepared Statements | Yes Prepared statement count | 0 # InnoDB ##################################################### Version | 1.1.8 Buffer Pool Size | 1.0G Buffer Pool Fill | 100% Buffer Pool Dirty | 0% File Per Table | ON Page Size | 16k Log File Size | 3 * 128.0M = 384.0M Log Buffer Size | 8M Flush Method | O_DIRECT Flush Log At Commit | 2 XA Support | ON Checksums | ON Doublewrite | ON R/W I/O Threads | 8 8 I/O Capacity | 500 Thread Concurrency | 16 Concurrency Tickets | 500 Commit Concurrency | 0 Txn Isolation Level | REPEATABLE-READ Adaptive Flushing | ON Adaptive Checkpoint | Checkpoint Age | 0 InnoDB Queue | 0 queries inside InnoDB, 0 queries in queue Oldest Transaction | 0 Seconds History List Len | 1107 Read Views | 1 Undo Log Entries | 0 transactions, 0 total undo, 0 max undo Pending I/O Reads | 0 buf pool reads, 0 normal AIO, 0 ibuf AIO, 0 preads Pending I/O Writes | 0 buf pool (0 LRU, 0 flush list, 0 page); 0 AIO, 0 sync, 0 log IO (0 log, 0 chkp); 0 pwrites Pending I/O Flushes | 0 buf pool, 0 log Transaction States | 7xnot started # MyISAM ##################################################### Key Cache | 16.0M Pct Used | 20% Unflushed | 0% # Security ################################################### Users | 14 users, 0 anon, 0 w/o pw, 0 old pw Old Passwords | OFF # Binary Logging ############################################# Binlogs | 2 Zero-Sized | 0 Total Size | 2.0G binlog_format | MIXED expire_logs_days | 10 sync_binlog | 0 server_id | 1 binlog_do_db | binlog_ignore_db | # Noteworthy Variables ####################################### Auto-Inc Incr/Offset | 1/1 default_storage_engine | InnoDB flush_time | 0 init_connect | init_file | sql_mode | join_buffer_size | 4M sort_buffer_size | 4M read_buffer_size | 4M read_rnd_buffer_size | 4M bulk_insert_buffer | 0.00 max_heap_table_size | 64M tmp_table_size | 8M max_allowed_packet | 16M thread_stack | 192k log | OFF log_error | /var/lib/mysql/data/c33-01.err log_warnings | 1 log_slow_queries | ON log_queries_not_using_indexes | ON log_slave_updates | OFF # Configuration File ######################################### Config File | /etc/my.cnf [client] port = 3306 socket = /var/tmp/mysql.sock [mysqld] port = 3306 socket = /var/tmp/mysql.sock skip-name-resolve skip-external-locking event_scheduler = ON innodb_file_per_table = 1 back_log = 500 max_connections = 300 key_buffer_size = 16M max_allowed_packet = 16M table_open_cache = 300 sort_buffer_size = 4M join_buffer_size = 4M read_buffer_size = 4M read_rnd_buffer_size = 4M myisam_sort_buffer_size = 4M thread_cache_size = 16 query_cache_size = 32M query_cache_limit = 2M ft_min_word_len = 4 thread_stack = 192K lower_case_table_names = 1 basedir = /usr/local/mysql datadir = /var/lib/mysql/data slow-query-log long_query_time = 2 log-queries-not-using-indexes tmp_table_size = 8M max_heap_table_size = 64M expire_logs_days = 10 binlog_cache_size = 4M log-bin = mysql-bin binlog_format = mixed sync_binlog = 0 server-id = 1 log-bin = mysql-bin innodb_data_home_dir = /var/lib/mysql/data innodb_data_file_path = ibdata1:128M;ibdata2:128M:autoextend innodb_log_group_home_dir = /var/lib/mysql/data innodb_buffer_pool_size = 8G innodb_additional_mem_pool_size = 20M innodb_write_io_threads = 8 innodb_read_io_threads = 8 innodb_purge_threads = 1 innodb_thread_concurrency = 16 innodb_log_files_in_group = 3 innodb_max_dirty_pages_pct = 75 innodb_buffer_pool_instances = 2 innodb_flush_method = O_DIRECT innodb_log_file_size = 128M innodb_log_buffer_size = 8M innodb_flush_log_at_trx_commit = 2 innodb_lock_wait_timeout = 120 innodb_use_native_aio = 1 innodb_io_capacity = 500 innodb_old_blocks_time = 1000 #time是从mid移到LRU热端的时间 innodb_old_blocks_pct = 60 #pct是lru mid的位置 [mysqldump] quick max_allowed_packet = 16M [mysql] prompt = mysql(\\u@\\h:\\d \p) > default-character-set = utf8 no-auto-rehash [myisamchk] key_buffer_size = 512M sort_buffer_size = 512M read_buffer = 8M write_buffer = 8M [mysqlhotcopy] interactive-timeout [mysqld_safe] open-files-limit = 8192 # The End ####################################################