本文主要是介绍MySQL 5.6配置GTID复制模式,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
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.
这篇关于MySQL 5.6配置GTID复制模式的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!