假設已經搭建好了mysql並且存在正常狀態的主主複製
1、安裝keepalived並且根據業務的vip及主機網絡卡,ip配置好/etc/keepalived/keepalived.conf,具體操作已在**框中實現
1、安裝環境(謹慎,建議先編譯,能通過就不要進行第一步了)
yum -y install popt popt-devel popt-static openssl-devel kernel-devel
【必要時解除安裝掉libnl 和 libnl-devel】
2、編譯安裝
#tar -zxvf keepalived-1.2.23
.tar.gz
#cd keepalived-1.2.23
#./configure --prefix=/usr/local/keepalived
編譯結果如下則正確,不必每一項都比對
keepalived configuration
------------------------keepalived version :
1.2.23
compiler : gcc
compiler flags : -g -o2
extra lib : -lssl -lcrypto -lcrypt
use ipvs framework : yes
ipvs sync daemon support : yes
ipvs use libnl : no
fwmark socket support : yes
use vrrp framework : yes
use vrrp vmac : yes
use vrrp authentication : yes
snmp keepalived support : no
snmp checker support : no
snmp rfcv2 support : no
snmp rfcv3 support : no
sha1 support : no
use debug flags : no
memory alloc check : no
libnl version : none
use ipv4 devconf : no
use libiptc : no
use libipset : no
#make &&make install
3、配置環境
#cp /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/init.d/#cp /usr/local/keepalived/sbin/keepalived /usr/sbin/#cp /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig/#mkdir -p /etc/keepalived
#cp /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/#chmod +x /etc/init.d/keepalived
4、編輯配置檔案
#vim /etc/keepalived/keepalived.conf
global_defs
vrrp_instance vi_1
virtual_ipaddress
}
2、主機上配置高可用環境(主從兩台機子做相同配置)
1、編寫監控指令碼
#mkdir /home/mysql/watch
#touch /home/mysql/watch/check_mysql_process.sh
### check_mysql_process.sh 內容如下 ###
#!/bin/sh
#check mysql & switch hb ha process n/a
rm -f /home/mysql/watch/mysql_process.exist
ps -ef|grep mysql|grep datadir|grep 8808 |grep -v grep > /home/mysql/watch/mysql_process.exist
if [ -s /home/mysql/watch/mysql_process.exist ] ;then
echo "ok
"else
/etc/init.d/keepalived stop
#echo
"hahaha
" > /tmp/wocao
echo `date` >> /home/mysql/watch/result.txt
fi### 其中需要注意的是資料庫例項埠號 ###
2、部署監控指令碼,每10s中執行一次
#chmod a+x /home/mysql/watch/check_mysql_process.sh
#crontab -e
### mysql ha ###
* * * * * /home/mysql/watch/check_mysql_process.sh >/dev/null
2>&1
* * * * * sleep 10;/home/mysql/watch/check_mysql_process.sh >/dev/null
2>&1
* * * * * sleep 20;/home/mysql/watch/check_mysql_process.sh >/dev/null
2>&1
* * * * * sleep 30;/home/mysql/watch/check_mysql_process.sh >/dev/null
2>&1
* * * * * sleep 40;/home/mysql/watch/check_mysql_process.sh >/dev/null
2>&1
* * * * * sleep 50;/home/mysql/watch/check_mysql_process.sh >/dev/null
2>&1
milvus高可用搭建
基於keepalived部署milvus高可用問題 雙寫冷備 兩個寫節點不能同時啟動,否則會導致資料重複,通過增加與閘道器的連通性來解決可能同時啟動的問題,但不能完全保證沒有特殊情況的存在。另外宕機時可能會導致資料丟失。一寫一讀 可以同時啟動,但是寫節點宕機時,資料不能寫入。基於minio的共享儲存...
搭建eureka高可用
1.設定伺服器之間的host,測試環境是在window10上搭建的,所以去修改c windows system32 drivers etc檔案,如下 2.建立專案 一組服務需要使用相同的服務名稱,才能被識別為一組!name eureka server eureka client 集群模式需要設定為t...
lvs keepalived DR搭建高可用集群
lvs keepalived dr搭建高可用集群 環境準備 lvsserver1 192.168.1.10 lvsserver2 192.168.1.11 vip 192.168.1.15 rs1 192.168.1.12 rs2 192.168.1.13 lvsserver1和lvsserver2...