MySQL级联复制配置

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MySQL级联复制配置相关的知识,希望对你有一定的参考价值。

环境:

         10.0.0.51/172.16.1.51      mysql01  主库            CentOS 7.2

         10.0.0.52/172.16.1.52      mysql02  中继从库     CentOS 7.2

         10.0.0.53/172.16.1.53      mysql03  从库            CentOS 7.2


mysql01配置:

[mysqld]
bind-address = 172.16.1.51
innodb_buffer_pool_size = 512M

log_bin=/application/mysql/logs/mysql-bin
expire_logs_days=7

server_id = 1
character-set-server=utf8
key_buffer_size = 16M
basedir = /application/mysql
datadir = /application/mysql/data/
slow-query-log = ON
log_queries_not_using_indexes = ON              
slow-query-log-file = /application/mysql/slow.log
min_examined_row_limit = 800      
innodb_flush_log_at_trx_commit=2

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[mysqld_safe]
log-error = /application/mysql/logs/oldboy.err


mysql02配置:

[mysqld]
bind-address = 172.16.1.52
innodb_buffer_pool_size = 512M
expire_logs_days=7
log-slave-updates=1
log_bin=/application/mysql/logs/mysql-bin
server_id = 2
slave-skip-errors = 1032,1062,1007

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[mysqld_safe]
log-error = /application/mysql/logs/oldboy.err


mysql03配置:

[mysqld]
bind-address = 172.16.1.53
server_id = 3
innodb_buffer_pool_size = 512M
slave-skip-errors = 1032,1062,1007
log_bin = /application/mysql/logs/oldboy-bin

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[mysqld_safe]
log-error = /application/mysql/logs/oldboy.err


注意:

mysql02也要配置binlog,不然,mysql03上会报:

2017-10-25 19:21:20 2352 [ERROR] Error reading packet from server: Binary log is not open (server_errno=1236)
2017-10-25 19:21:20 2352 [ERROR] Slave I/O: Got fatal error 1236 from master when reading data from binary log: ‘Binary log is not open‘, Error_code: 1236
2017-10-25 19:21:20 2352 [Note] Slave I/O thread exiting, read up to log ‘mysql-bin.000001‘, position 120

这样的错误。

本文出自 “小胖子的博客” 博客,请务必保留此出处http://4044619.blog.51cto.com/4034619/1975951

以上是关于MySQL级联复制配置的主要内容,如果未能解决你的问题,请参考以下文章

MySQL级联复制

Mysql主从级联复制

mysql数据库的级联复制

(5.14)mysql高可用系列——级联复制

第五章:MySQL主从复制

MySQL的主从复制介绍及配置