1、架構
vip 192.168..45.244
mysql-1:192.168.45.238
mysql-2:192.168.45.239
2、mysql雙主設定
192.168.45.238
設定mysql複制賬号
導出資料庫
192.168.45.239
mysql配置
導入主庫資料
在192.168.45.238上設定同步
3、配置keepalived
192.168.45.238
安裝keepalived
192.168.45.238 keepalived 配置
檢測mysql腳本配置(兩台mysql一樣的配置)
chmod 755 /root/keepalived_check_mysql.sh
192.168.45.239 keepalived配置
啟動 238上的keepalived mysql
/etc/init.d/keepalived start
/etc/init.d/mysqld start
啟動239上的keepalived mysql
測試,關閉238上的mysql在另外一台機器上用vip連接配接mysql
關閉239上的mysql在另外一台機器上用vip連接配接mysql
<a href="http://www.055680.com/" target="_blank">城市物語</a>
本文轉自yuangang_love 51CTO部落格,原文連結:http://blog.51cto.com/linux008/665390,如需轉載請自行聯系原作者