socat管理haproxy配置
阿新 • • 發佈:2019-01-04
strong stat dmi 啟動 serve 安裝 isa 權限 提示 haproxy是可以通過socat命令管理haproxy.cfg文件的;
1.安裝socat
1.安裝socat
yum install socat -y
2.配置haproxy.cfg,啟動socket
修改:stats socket /var/lib/haproxy/stats
修改為:stats socket /var/lib/haproxy/stats mode 600 level admin
註:level為admin,否則使用socat時會提示權限拒絕
3.socat使用方法
a.獲取使用幫助 echo "help" | socat stdio /var/lib/haproxy/stats b.獲取常用信息 echo "show info" | socat stdio /var/lib/haproxy/stats c.把某個backend的主機設置為維護 echo "disable server web_port/10.10.5.146" | socat stdio /var/lib/haproxy/stats d.取消維護 echo "enable server web_port/10.10.5.146" | socat stdio /var/lib/haproxy/stats
socat管理haproxy配置