mysql GTID主從複製(主庫線上,添加新叢庫)

來源:互聯網
上載者:User

標籤:伺服器   change   epo   分享   vim   accept   ges   參考   操作   

要求:

1、         主庫上線,主庫不停止服務的前提下做主從複製

2、         新添加一個叢庫

操作:

1、         在主庫匯出資料(主庫正常運行);

       

2、         將主庫的sql檔案傳到叢庫;

       

3、         叢庫恢複資料庫;

       

4、         在主伺服器上,建立複製帳號,賦許可權

Mysql > GRANT REPLICATION SLAVE ON *.* TO ‘repluser‘@‘3.9.8.%‘ IDENTIFIED BY ‘replpass‘;

Mysql > flush privileges;

5、         配置從伺服器的防火牆,允許防火牆通過3306連接埠

# vim /etc/sysconfig/iptables 

添加

-A INPUT -m state –state NEW -m tcp -p tcp –dport 3306 -j ACCEPT(允許3306連接埠通過防火牆)

重啟防火牆服務,使其生效

#service iptables restart

6、         叢庫修改設定檔

# vim /etc/my.cnf

添加

       

       

7、         在從伺服器上使用主mysql上建立的帳號密碼登入並進行複製

    mysql> change master to master_host=‘3.9.8.13‘, master_user=‘repluser‘,master_password=‘replpass‘,master_auto_position=1;

       

8、         叢庫啟動主從複製(可能會報錯,參考10.問題集1) )

    mysql> start slave;

9、         檢測主從複製

    mysql> show slave status\G

10、      問題集

    1)     啟動主從複製,報錯1872:slave failed to initialize relay log info structure from the repository.

         

mysql> reset slave;

mysql> change master to master_host=‘3.9.8.13‘, master_user=‘repluser‘,master_password=‘replpass‘,master_auto_position=1;

mysql> start slave;

 

mysql 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.