MySQL 5.6配置GTID复制模式

来源:互联网 发布:淘宝旺旺注册 编辑:程序博客网 时间:2024/04/30 00:28

1.主从数据库参数文件中加入一下配置:

gtid_mode=on
enforce-gtid-consistency=on
master-info-repository=TABLE
relay-log-info-repository=TABLE
sync-master-info=1
slave-parallel-workers=2
binlog-checksum=CRC32
master-verify-checksum=1
slave-sql-verify-checksum=1
binlog-rows-query-log_events=1
report-port=3306
report-host=192.168.1.245


2.重启master / slave mysql服务

说明:slave需要配置log_slave_updates参数,否则不能正常启动

错误日志如下:[ERROR] --gtid-mode=ON or UPGRADE_STEP_1 or UPGRADE_STEP_2 requires --log-bin and --log-slave-updates


3.执行change master 语句,在slave上开启复制

CHANGE MASTER TO   
MASTER_HOST = 'master host',
MASTER_PORT = 3306,
MASTER_USER = 'user',  
MASTER_PASSWORD = 'pass',
MASTER_AUTO_POSITION = 1;

start slave;

说明:在change master 语句中指定用户名和密码不安全,会报如下警告,建议在start slave 语句中使用用户名和密码
[Warning] Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.

0 0
原创粉丝点击