一、 Haproxy负载均衡配置
实验环境:
redhat6.5
关闭红帽官方套件进程
三台虚拟机:
调度器:
172.25.32.1
后端服务器:
172.25.32.5
172.25.32.6
1.安装haproxy
下载haproxy-1.6.11.tar.gz
安装haproxy
1)安装rpm-build ,解压haproxy-1.6.11.tar.gz
[root@server1 ~]# yum install rpm-build -y
[root@server1 ~]# tar zxf haproxy-1.6.11.tar.gz
2.切换到cd haproxy-1.6.11/examples/下,执行命令:
[root@server1 examples]# rpmbuild -bb haproxy.spec
# 会报错
error: File /root/rpmbuild/SOURCES/haproxy-1.6.11.tar.gz: No such file or directory
# 复制安装包到/root/rpmbuild/SOURCES/
[root@server1 examples]# cp /root/haproxy-1.6.11.tar.gz /root/rpmbuild/SOURCES/
## 再次执行命令
[root@server1 examples]# rpmbuild -bb haproxy.spec
3.切换目录,查询haproxy配置文件
4.安装haproxy-1.6.11-1.x86_64.rpm
5.切换到cd haproxy-1.6.11/examples/下,复制配置文件
6.添加haproxy用户
7.修改配置文件
8.修改 /etc/security/limits.conf 对服务做限制
9.启动服务
10.访问http://172.25.32.1 http://172.25.32.1/monitoruri http://172.25.32.1/stats 监控页面
11.修改日志位置(/etc/rsyslog.conf)
接受日志文件: