MySQL开启GTID主从同步
博客专区 > anoty 的博客 > 博客详情
MySQL开启GTID主从同步
anoty 发表于4个月前
MySQL开启GTID主从同步
  • 发表于 4个月前
  • 阅读 15
  • 收藏 0
  • 点赞 0
  • 评论 0

腾讯云 技术升级10大核心产品年终让利>>>   

摘要: MySQL开启GTID主从同步

主库配置

[mysqld]
log_bin = /path/mysql/master/data/log_bin
gtid_mode = ON
enforce-gtid-consistency = true
log_slave_updates = 1

basedir = /usr/local/Cellar/mysql/5.7.17
datadir = /path/mysql/master/data
port = 3306
server_id = 13306
socket = mysql.sock

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

从库配置

[mysqld]
log_bin = /path/mysql/slave/data/log_bin
relay_log = /path/mysql/slave/data/relay_log
relay-log-index = /path/mysql/slave/data/relay-log-index
relay-log-info-file = /path/mysql/slave/data/relay-relay-log.info
replicate-do-db = test
log_slave_updates = 1
gtid_mode = ON
enforce-gtid-consistency = true

datadir = /Users/Aim/mysql/slave/data
port = 3307
server_id = 13307
socket = mysql.sock
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

查看是否成功开启GTID同步,Command显示Binlog Dump GTID表示成功开启GTID同步。

mysql> SHOW PROCESSLIST \G
*************************** 1. row ***************************
     Id: 3
   User: root
   Host: localhost:62976
     db: NULL
Command: Binlog Dump GTID
   Time: 267
  State: Master has sent all binlog to slave; waiting for more updates
   Info: NULL
*************************** 2. row ***************************
     Id: 6
   User: root
   Host: localhost:63016
     db: NULL
Command: Query
   Time: 0
  State: starting
   Info: SHOW PROCESSLIST
2 rows in set (0.00 sec)
标签: MySQL GTID
共有 人打赏支持
粉丝 10
博文 17
码字总数 12509
×
anoty
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: