1,两台主机安装keepalived
配置keepalived
安装haproxy
make PREFIX=/usr/local/haproxy TARGET=linux2628
make install PREFIX=/usr/local/haproxy
创建配置文件
配置haproxy
vim /etc/haproxy/haproxy.cfg
添加为系统服务
cp /root/haproxy-1.7.2/examples/haproxy.init /etc/init.d/haproxy
vim /etc/init.d/haproxy
修改: 35行 内容为 BIN=/usr/local/haproxy/sbin/$BASENAME
chmod +x /etc/init.d/haproxy
chkconfig --add /etc/init.d/haproxy
添加3和5运行级别下自启动
chkconfig haproxy --level 35 on
chkconfig --list
重启两个服务
关闭master的keepalived
网站测试