haproxy的部署与配置
一、haproxy简介
HAProxy是法国开发者威利塔罗在2000年使用c语言开发的一个开源软件,是一款具备高并发、高性能的TCP和HTTP负载均衡器
支持cookie的持久性,自动故障切换,支持正则表达式及web状统计
二、HAProxy的安装及配置
1. 安装
yum install haproxy -y
2. 查看配置文件
[root@haproxy ~]# rpm -qc haproxy /etc/haproxy/haproxy.cfg ------配置文件 /etc/logrotate.d/haproxy ------日志文件 /etc/sysconfig/haproxy
gloabl:全局配置
进程及安全配置相关参数
性能调整相关参数
Debug参数
proxies:代理配置
dafeults:为frontend,backend,listen提供默认配置
frontend:前端
backend:后端
listen:同时拥有前端和后端配置,配置简单,推荐使用
3. 配置文件
[root@haproxy ~]# vim /etc/haproxy/haproxy.cfg
两种方式:
1.分开前端后端
2. 合并一起
写完后重启服务
[root@haproxy ~]# systemctl restart haproxy.service
参考文档:https://blog.csdn.net/m0_68096246/article/details/141108241