编译安装
我只有两台服务器 就在两台服务器上体验
47.110.136.12
47.114.138.34
平滑发布脚本
#!/bin/sh
getHealthy(){
result=`ssh root@$haproxy_node "echo 'show servers state $backend_name' | socat stdio /var/lib/haproxy/haproxy.sock"`
sum=0
online_array=()
status=()
sumby=28
temp=26
# 记录实例名称
online_hostname=()
for val in $result
do
let "sum += 1"
# echo $sum
if [ $temp == $sum ];then
online_hostname[${#online_hostname[*]}]=${val}
# echo $val
let "temp+=20"
fi
if [ $sumby == $sum ];then
# echo $val
status[${#status[*]}]=${val}
let "sumby+=20"
fi
done
#echo 数组变量arr的值为:"${online_hostname[*]}"
#echo 数组变量arr的值为:"${status[*]}"
length=${#status[*]}
result=()
#下标遍历
for((i=