MySQL的replication熱備配置過程

來源:互聯網
上載者:User

MySQL的replication熱備配置過程

(2013-03-16 22:55:37)

http://blog.csdn.net/lapiggy (MySQL效能及主備跳服務設定文檔)http://blog.sina.com.cn/s/articlelist_1755341331_1_1.html  (DRBD(叢集)配置過程)
作業系統:中標LinuxMysql版本:mysql-server.i386 0:5.0.45-7.el5(註:安裝mysql是用的yum命令)Mysql1端 IP 192.168.2.122Mysql2端  IP 192.168.2.123資料庫:test1.Mysql1設定:1.1 設定Mysql Replication1.增加一用於資料庫同步的使用者rootmysql>GRANT REPLICATION SLAVE,REPLICATIONCLIENT,RELOAD,SUPER ON *.* TO 'root'@'192.168.2.123' IDENTIFIED BY'password';(授與從192.168.2.123主機上登入使用者root資料複製許可權)2.使許可權生效,這步可不做,因為過會要重啟mysqlmysql>flush privileges;3.退出mysql命令列介面mysql> exit4.停止mysql服務service mysqld stop5.更改Mysql設定檔/etc/my.cnf開啟mysql設定檔vi /etc/my.cnf在設定檔中添加以下內容[mysqld]#masterlog-binserver-id=1binlog-do-db= vtigercrm510 #slavemaster-host = 192.168.2.120master-user = rootmaster-password = passwordmaster-port = 3306master-connect-retry = 10replicate-do-db = test6.啟動Mysqlservice mysqld start2.Mysql2設定: 1.更改Mysql設定檔/etc/my.cnf開啟Mysql的設定檔vi /etc/my.cnf在設定檔中添加以下內容 [mysqld]#masterlog-binserver-id=2binlog-do-db= vtigercrm510 #slavemaster-host = 192.168.2.118master-user = rootmaster-password = passwordmaster-port = 3306master-connect-retry = 10replicate-do-db = vtigercrm510 2.重新啟動Mysql服務service mysqld  restart3.Mysql1設定: 1.分別在mysql1和mysql2上啟動slavemysql> START SLAVE;2.查看slave狀態:mysql> show slave status\G;Slave_IO_Running: YesSlave_SQL_Running: Yes如果都是yes,代表已經在同步 3.查看mster狀態mysql> Show master status;Mysql設定完畢

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.