增加集群服务器ha配置;更新pyinstaller打包后找不到依赖库的bug.
This commit is contained in:
22
roles/ha_backup/templates/check_oam_service.sh.j2
Normal file
22
roles/ha_backup/templates/check_oam_service.sh.j2
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
#running:0, stop:3
|
||||
STATE=$(systemctl status oam_cluster.service)
|
||||
|
||||
if [ $STATE -ne 0 ]
|
||||
then
|
||||
systemctl restart oam_cluster
|
||||
sleep 10
|
||||
STATE=$(systemctl status oam_cluster.service)
|
||||
if [ $STATE -ne 0 ]
|
||||
then
|
||||
killall keepalived
|
||||
exit 1
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#todo ,check consul_cluster, check influxdb
|
||||
50
roles/ha_backup/templates/keepalived_backup.conf.j2
Normal file
50
roles/ha_backup/templates/keepalived_backup.conf.j2
Normal file
@@ -0,0 +1,50 @@
|
||||
! Configuration File for keepalived
|
||||
|
||||
global_defs {
|
||||
router_id LVSTEST2
|
||||
}
|
||||
|
||||
#监控服务httpd, mysql等
|
||||
vrrp_script chk_http_service {
|
||||
script "/etc/keepalived/chk_http_service.sh"
|
||||
#每2s检查一次
|
||||
interval 3
|
||||
#每次检查-20
|
||||
weight -10
|
||||
fail 3
|
||||
#失败次数,如果请求失败2次就认为此节点资源发生故障将进行切换
|
||||
|
||||
rise 1
|
||||
#监测成功就立即成功,如果请求一次成功就默认此节点资源恢复正常
|
||||
}
|
||||
|
||||
vrrp_instance VI_1 {
|
||||
state BACKUP
|
||||
interface eth0
|
||||
virtual_router_id 51
|
||||
priority 10
|
||||
advert_int 1
|
||||
authentication {
|
||||
auth_type PASS
|
||||
auth_pass 1111
|
||||
}
|
||||
virtual_ipaddress {
|
||||
192.168.44.244
|
||||
}
|
||||
#触发的脚本
|
||||
track_script {
|
||||
chk_http_service #检测脚本,上面配置的
|
||||
}
|
||||
}
|
||||
|
||||
virtual_server 192.168.44.244 80 {
|
||||
delay_loop 6
|
||||
lb_algo rr
|
||||
lb_kind NAT
|
||||
persistence_timeout 50
|
||||
protocol TCP
|
||||
|
||||
#real_server 127.0.0.1 80 {
|
||||
# weight 1
|
||||
#}
|
||||
}
|
||||
46
roles/ha_backup/templates/keepalived_master.conf.j2
Normal file
46
roles/ha_backup/templates/keepalived_master.conf.j2
Normal file
@@ -0,0 +1,46 @@
|
||||
! Configuration File for keepalived
|
||||
|
||||
global_defs {
|
||||
router_id LVSTEST1
|
||||
}
|
||||
|
||||
#监控服务httpd, mysql等
|
||||
vrrp_script chk_http_service {
|
||||
script "/etc/keepalived/chk_http_service.sh"
|
||||
#每2s检查一次
|
||||
interval 3
|
||||
#每次检查-20
|
||||
weight -10
|
||||
fail 3
|
||||
#失败次数,如果请求失败2次就认为此节点资源发生故障将进行切换
|
||||
|
||||
rise 1
|
||||
#监测成功就立即成功,如果请求一次成功就默认此节点资源恢复正常
|
||||
}
|
||||
|
||||
vrrp_instance VI_1 {
|
||||
state MASTER
|
||||
interface eth0
|
||||
virtual_router_id 51
|
||||
priority 100
|
||||
advert_int 1
|
||||
authentication {
|
||||
auth_type PASS
|
||||
auth_pass 1111
|
||||
}
|
||||
virtual_ipaddress {
|
||||
192.168.44.244
|
||||
}
|
||||
#触发的脚本
|
||||
track_script {
|
||||
chk_http_service #检测脚本,上面配置的
|
||||
}
|
||||
}
|
||||
|
||||
virtual_server 192.168.44.244 80 {
|
||||
delay_loop 6
|
||||
lb_algo rr
|
||||
lb_kind NAT
|
||||
persistence_timeout 50
|
||||
protocol TCP
|
||||
}
|
||||
Reference in New Issue
Block a user