【Mysql】MySQL 主主複製 + LVS + Keepalived 實現 MySQL 高可用性
首先置頂參考文件
官方文件
http://blog.jobbole.com/100390/
http://lanlian.blog.51cto.com/6790106/1303195
5 測試web負載
參考文件
http://blog.csdn.net/yuchou123456789/article/details/7287890
http://blog.csdn.net/m582445672/article/details/7670015 --分發web
http://blog.itpub.net/29654823/viewspace-1844282/ ---分發mysql
mark一下
官方文件
http://blog.jobbole.com/100390/
http://lanlian.blog.51cto.com/6790106/1303195
1 機器規劃
-
192.168.6.119 keepalive+ipvsadm(Lvs)
192.168.6.121 keepalive+ipvsadm(Lvs)
192.168.6.66 VIP
192.168.6.114 真實機(測試httpd負載均衡),lvs客戶端
192.168.6.115 真實機(測試httpd負載均衡),lvs客戶端
2.安裝keepalive+ipvsadm工具
- 參考本文件http://blog.itpub.net/29096438/viewspace-2121347/
3.配置lvs客戶端(真實機器) 指令碼
- 114.115上都需要
-
[root@node1 ~]# more /usr/local/bin/lvs_real
#!/bin/bash
#description : start realserver
VIP=192.168.6.66
/etc/rc.d/init.d/functions
case "$1" in
start)
echo " start LVS of REALServer"
/sbin/ifconfig lo:0 $VIP broadcast $VIP netmask 255.255.255.255 up
echo "1" >/proc/sys/net/ipv4/conf/lo/arp_ignore
echo "2" >/proc/sys/net/ipv4/conf/lo/arp_announce
echo "1" >/proc/sys/net/ipv4/conf/all/arp_ignore
echo "2" >/proc/sys/net/ipv4/conf/all/arp_announce
;;
stop)
/sbin/ifconfig lo:0 down
echo "close LVS Directorserver"
echo "0" >/proc/sys/net/ipv4/conf/lo/arp_ignore
echo "0" >/proc/sys/net/ipv4/conf/lo/arp_announce
echo "0" >/proc/sys/net/ipv4/conf/all/arp_ignore
echo "0" >/proc/sys/net/ipv4/conf/all/arp_announce
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac
- 啟動客戶端指令碼
-
[root@node1 ~]# sh /usr/local/bin/lvs_real start
4 服務端keepalive配置檔案如下
- 119 121機器(主備修改關鍵點即可)
-
[root@localhost keepalived]# more keepalived.conf
#writed by sery , contact sery@163.com
#guration File for keepalived
#global define
global_defs {
router_id LVS_CNC_1
}
vrrp_sync_group VGM {
group {
VI_CACHE
}
}
################################################################
# vvrp_instance define #
################################################################
vrrp_instance VI_CACHE {
state MASTER
interface eth0
lvs_sync_daemon_inteface eth0
virtual_router_id 51
priority 180
advert_int 5
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.6.66
}
}
##############################################################
# virtual machine setting #
##############################################################
# setting port 80 forward -
virtual_server 192.168.6.66 80 {
delay_loop 6
lb_algo wlc
lb_kind DR
# persistence_timeout 20
protocol TCP
real_server 192.168.6.114 80 {
weight 100
TCP_CHECK {
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
connect_port 80
}
}
real_server 192.168.6.115 80 {
weight 100
TCP_CHECK {
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
connect_port 80
}
}
}
- 啟動keepalive
-
[root@localhost ~]# /etc/init.d/keepalived start
- 檢視ipvsadm情況
-
[root@localhost keepalived]# ipvsadm -ln
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
TCP 192.168.6.66:80 wlc
-> 192.168.6.115:80 Route 100 0 0
-> 192.168.6.114:80 Route 100 0 0
5 測試web負載
-
瀏覽器訪問
-
-
-
分發成功,可以寫個指令碼去測試
- 瀏覽器訪問
-
-
- 分發成功,可以寫個指令碼去測試
6 擴充
也可用做keepalive+lvs+mysql的負載均衡啊參考文件
http://blog.csdn.net/yuchou123456789/article/details/7287890
http://blog.csdn.net/m582445672/article/details/7670015 --分發web
http://blog.itpub.net/29654823/viewspace-1844282/ ---分發mysql
mark一下
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29096438/viewspace-2120663/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- MySQL進階:主主複製+Keepalived高可用MySql
- MySQL 高可用性—keepalived+mysql雙主MySql
- mysql5.6主主複製及keepalived 高可用MySql
- mysql實現主從複製MySql
- docker實現mysql主從複製DockerMySql
- 基於MySQL雙主複製架構下部署LVS+KeepAlived負載均衡MySql架構負載
- Mysql實現主從複製(一主雙從)MySql
- MySQL主主模式+Keepalived高可用MySql模式
- mysql5.7主從複製,主主複製MySql
- MySQL 主從複製實操MySql
- MySQL主從複製MySql
- MySQL++:Liunx - MySQL 主從複製MySql
- MySQL(13)---MYSQL主從複製原理MySql
- mysql資料庫實現主從複製MySql資料庫
- MySQL 的主從複製(高階篇)MySql
- 簡單實踐實現 MySQL 主從複製MySql
- mysql複製--主從複製配置MySql
- MySQL 的主從複製實踐MySql
- mysql資料庫的主從複製和主主複製實踐MySql資料庫
- mysql 8.4 主從複製MySql
- mysql--主從複製MySql
- mysql主從複製搭建MySql
- MySQL主從複製原理MySql
- MySQL的主從複製MySql
- MySQL叢集之 主從複製 主主複製 一主多從 多主一叢 實現方式MySql
- MySQL(14)---Docker搭建MySQL主從複製(一主一從)MySqlDocker
- MySQL主從複製之GTID複製MySql
- MHA+MySQL主從配置實現MySQL高可用MySql
- Windows 環境下,MySQL 的主從複製和主主複製WindowsMySql
- windows環境下,Mysql的主從複製和主主複製WindowsMySql
- MySQL-18.主從複製MySql
- MySQL主從複製歷程MySql
- Mysql 傳統主從複製MySql
- MySQL8.0主從複製MySql
- Windows Mysql主從複製部署WindowsMySql
- windows 下mysql主從複製WindowsMySql
- mysql主從延遲複製MySql
- MYSQL主從複製配置(整理)MySql
- Mysqldump實現mysql的master-slave主從複製MySqlAST