⑧.动态管理haproxy

1.安装socat

yum install socat -y

2.修改配置文件

global
	maxconn 5000
	stats socket /var/lib/haproxy24/stats level admin   #提高这个socket的操作权限为admin级别


systemctl restart haproxy

3.实现主机的动态上下线

# 获取详情
[root@centoes7 haproxy]# echo 'show info'|socat stdio /var/lib/haproxy24/stats 

#动态下线主机
[root@centoes7 haproxy]# echo 'disable server app/app1'|socat stdio /var/lib/haproxy24/stats

#动态上线主机
[root@centoes7 haproxy]# echo 'enable server app/app1'|socat stdio /var/lib/haproxy24/stats 


posted @ 2022-07-26 11:02  老夫聊发少年狂88  阅读(42)  评论(0编辑  收藏  举报