標籤:mysql 5.6 gtid
# gtid相關配置:
enforce_gtid_consistency = true # 強制gtid已執行檢查 必須開啟 (靜態參數) disable-gtid-unsafe-statements http://imysql.cn/2012/09/21/mysql-faq-can-not-login-after-new-install.html
gtid_mode = on # 開啟gtid複製 (靜態參數)
log_slave_updates = true # 將語句寫入二進位日誌
binlog_format = row # 行模式複製 ,推薦使用行模式 (動態參數)
binlog_row_image = minimal # 行複製模式 ,最小複製模式 (動態參數)
# 開啟複製模式
stop slave ;
change master to master_host=‘192.168.1.95‘, master_user=‘repl‘,master_password=‘[email protected]‘, master_auto_position=1;
start slave ;
# gtid模式下 複製報錯問題處理
方式一:
stop slave ;
reset master ; # 使gtid_executed 變數變為空白
set global gtid_purged=‘29f5e5d6-0e58-11e5-ab0f-00163e634e89:1-22108‘ ;#這個gtid 是在從庫上執行報錯的gtid
start slave ;
方式二:(官方推薦的方式)
stop slave ;
SET SESSION GTID_NEXT = ‘9ba6eccd-0e56-11e5-ab05-00163e027dd7:1‘;
BEGIN; COMMIT;
SET SESSION GTID_NEXT = AUTOMATIC;
START SLAVE;
# gtid 限制: # # gtid 的相關bug
1.create table tt select * from t1 ; #
2.不能在事務內部建立暫存資料表 CREATE TEMPORARY TABLE tt(id int ,iname varchar(100))
參考文檔:
http://dwchaoyue.blog.51cto.com/2826417/1559764
本文出自 “SQLServer MySQL” 部落格,請務必保留此出處http://dwchaoyue.blog.51cto.com/2826417/1840525
mysql 5.6 之 gtid的配置與維護