关闭

MySQL 5.6配置GTID复制模式

标签: mysql主从复制 GTID
1106人阅读 评论(0) 收藏 举报
分类:

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

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:23465次
    • 积分:535
    • 等级:
    • 排名:千里之外
    • 原创:25篇
    • 转载:16篇
    • 译文:3篇
    • 评论:0条