mysql 5.6 之 gtid的配置與維護

來源:互聯網
上載者:User

標籤: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的配置與維護

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.