一、修改配置文件
[root@ansible ~]# vim /etc/haproxy/haproxy.cfg
二、安装hatop
参考: http://www.ttlsa.com/cluster/haproxy-hatop/
参考:http://feurix.org/projects/hatop/install/#install
[root@ansible src]# cd /usr/local/src/
[root@ansible src]# wget https://github.com/Wirehive/hatop/archive/master.zip
[root@ansible src]# unzip master.zip
[root@ansible src]# cd hatop-master/
[root@ansible hatop-master]# install -m 755 bin/hatop /usr/local/bin
[root@ansible hatop-master]# install -m 644 man/hatop.1 /usr/local/share/man/man1
[root@ansible hatop-master]# gzip /usr/local/share/man/man1/hatop.1
三、使用hatop
关于使用,可以参考:http://feurix.org/projects/hatop/readme/
[root@ansible hatop-master]# hatop -s /var/lib/haproxy/stats
关闭webservers下面的一个server:ng1
1、按5进入CLI
2、输入disable server
3、tab键回到1
4、上下键选择ng1,然后按下空格
5、然后回车
6、此时,tab切换回来1
已经变为维护模式
四、多用几次技巧就会了
# 对backend名为webservers下面的一台server:ng1取消维护模式
> enable server webservers/ng1
# 对前段web进入维护模式
> disable frontend web
# 退出维护模式
> enable frontend web