关闭防火墙
systemctl stop firewalld
setenforce 0
源码安装安装haproxy
tar xzvf haproxy-1.5.15.tar.gz -C /opt
cd /opt/haproxy-1.5.15
make TARGET=linux26 PREFIX=/usr/local/haproxy //标识64为系统
make install PREFIX=/usr/local/haproxy
mkdir /etc/haproxy
useradd -s /sbin/nologin -M haproxy
cp /opt/haproxy-1.5.15/examples/haproxy.cfg /etc/haproxy/
vi /etc/haproxy/haproxy.cfg
cp examples/haproxy.init /etc/init.d/haproxy
chmod 755 /etc/init.d/haproxy
chkconfig --add haproxy
ln -s /usr/local/haproxy/sbin/haproxy /usr/sbin/haproxy
service haproxy start
测试:浏览器中输入
http://192.168.80.100:8089/stats 统计页面
http://192.168.80.100 负载均衡
转载于:https://blog.51cto.com/14150862/2349177