编译安装
我只有两台服务器 就在两台服务器上体验
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=0;i<${#status[*]};i++))
do
if [ 2 = ${status[i]} ];then
# echo ${online_hostname[i]}
result[${#result[*]}]=${online_hostname[i]}
fi
don

本文介绍了在两台服务器上进行Haproxy 2.3.0的平滑发布过程,包括编译安装步骤,并提供了一段用于平滑发布的Shell脚本,确保服务的连续性和稳定性。
最低0.47元/天 解锁文章
3134

被折叠的 条评论
为什么被折叠?



