MySQL 相互 複製

來源:互聯網
上載者:User

兩台主機

hostname : linux-web ip : 10.5.5.23

hostname : linux-mysql ip : 10.5.5.27




host1: linux-web


vim /etc/my.cnf


server-id=1

log-bin=master-bin


master-host=10.5.5.27 #hostname linux-mysql


master-user=slave #mysql 中的賬戶 slave(在linux-mysql) 用於相互連結

master-password=slave


replicate-ignore-db=mysql #不同步mysql database

replicate-do-db=sync #指定同步database



host2:linux-mysql 同上

需要改 server-id=2



#cd /var/lib/mysql

刪除所有的以前的日誌


service mysqld restart #(兩台都重啟)






相關文章

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.