我有两个 MySQL 5.1 服务器,并设置了主/从复制。我之前使用 5.1.41 已有好几年了,没有出现任何问题。但是,自从我升级到 5.1.72(并做了一些其他调整,例如启用 INNODB HA 插件)后,我遇到了从服务器 I/O 线程在从服务器上死亡的反复问题。以下是记录的消息:
140506 21:18:33 [ERROR] Failed to flush master info file
140506 21:18:33 [Note] Slave I/O thread exiting, read up to log 'mysql-bin.010913', position 38278270
有人知道是什么触发了 master.info 文件的刷新吗?知道为什么它可能无法刷新吗?
我看到 MySQL 的更高版本具有 sync_master_info 变量,这可能有用,但我不认为它在 5.1.72 中受支持。
每当出现此问题时(大约每隔一天一次),我必须连接到从属服务器并发出从属停止;从属启动;然后复制恢复,并记录以下消息:
140507 9:46:22 [Note] Error reading relay log event: slave SQL thread was killed
140507 9:46:24 [Note] Slave SQL thread initialized, starting replication in log 'mysql-bin.010913' at position 38278194, relay log '.\SERVERNAME-relay-bin.010971' position: 38278339
140507 9:46:24 [Note] Slave I/O thread: connected to master '[email protected]:3306',replication started in log 'mysql-bin.010913' at position 38278270
以下是我的配置:
[client]
port = 3306
default-character-set = utf8
[mysql]
[mysqld]
ignore-builtin-innodb
plugin-load = innodb
;innodb_trx = ha_innodb_plugin.dll
;innodb_locks = ha_innodb_plugin.dll
;innodb_lock_waits = ha_innodb_plugin.dll
;innodb_cmp = ha_innodb_plugin.dll
;innodb_cmp_reset = ha_innodb_plugin.dll
;innodb_cmpmem = ha_innodb_plugin.dll
;innodb_cmpmem_reset = ha_innodb_plugin.dll
port = 3306
basedir = "C:/Program Files/MySQL/MySQL Server 5.1/"
datadir = "C:/Documents and Settings/All Users/Application Data/MySQL/MySQL Server 5.1/Data/"
character-set-server = utf8
default-storage-engine = INNODB
sql-mode = "STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
max_connections = 100
query_cache_size = 64M
table_cache = 256
tmp_table_size = 32M
thread_cache_size = 20
myisam_max_sort_file_size = 100G
myisam_sort_buffer_size = 35M
key_buffer_size = 25M
read_buffer_size = 64K
read_rnd_buffer_size = 256K
sort_buffer_size = 256K
collation-server = utf8_general_ci
max_heap_table_size = 32M
query_cache_type = 1
thread_cache_size = 20
table_open_cache = 350
long_query_time = 1
slow_query_log = 1
innodb_additional_mem_pool_size = 2M
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 4M
innodb_buffer_pool_size = 384M
innodb_log_file_size = 64M
innodb_thread_concurrency = 8
default-table-type = INNODB
innodb_file_per_table = 1
innodb_stats_on_metadata = 0
innodb_old_blocks_time = 1000
server-id = 2
replicate-do-db = mydatabase
relay-log = SERVERNAME-relay-bin
tmpdir = "C:/Documents and Settings/All Users/Application Data/MySQL/MySQL Server 5.1/tmp/"