www.haproxy.org/download/1.5/doc/configuration.txt 或 configuration.txt
旧版编译加
1
| |
比较新的加
1
| |
默认编译会加入
编译加入了也要在配置文件中开启才有效
1 2 3 | |
在global中关闭splice功能
1
| |
www.haproxy.org/download/1.5/doc/configuration.txt 或 configuration.txt
旧版编译加
1
| |
比较新的加
1
| |
默认编译会加入
编译加入了也要在配置文件中开启才有效
1 2 3 | |
在global中关闭splice功能
1
| |
http://sharadchhetri.com/2013/10/16/how-to-enable-logging-of-haproxy-in-rsyslog/
After installing the HAproxy 1.4 in CentOS 6.4 bydefault logging of haproxy was not enable.To enable the logging of HAProxy you have to enable it in rsyslog(In CentOS 6.4 minimal installation,rsyslog version 5.2 is shipped). To setup logging in HAproxy,follow the given below steps
In Global Section of haproxy.cfg put the value log 127.0.0.1 local0 .Like given below
1 2 | |
Create new haproxy configuration file in /etc/rsyslog.d . Here we are keeping the log in localhost or in other words we should say HAproxy server
local0.=info -/var/log/haproxy.log defines the http log will be saved in haproxy.log
local0.notice -/var/log/haproxy-status.log defines the Server status like start,stop,restart,down,up etc. will be saved in haproxy-status.log
UDPServerRun 514 means opening UDP port no. 514 to listen haproxy messages
1 2 3 4 5 6 7 8 9 | |
Now restart the HAproxy service
1
| |
After restarting the haproxy service two logs will be created itself i.e haproxy.log and haproxy-status.log
Check your logrotae file for haproxy also so that logs keep on rotating and compress itself. If bydefault it is not present in /etc/logrotate.d directory then create a new file called haproxy and paste the given below code.
Here I am keeping the logs upto 120 days hence rotate 120 and daily is written in file.
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
HAProxy提供高可用性、负载均衡以及基于TCP和HTTP应用的代理,支持虚拟主机,它是免费、快速并且可靠的一种解决方案。HAProxy特别适用于那些负载特大的web站点,这些站点通常又需要会话保持或七层处理。HAProxy运行在当前的硬件上,完全可以支持数以万计的并发连接。并且它的运行模式使得它可以很简单安全的整合进您当前的架构中,同时可以保护你的web服务器不被暴露到网络上.
haproxy 配置中分成五部分内容,分别如下:
1、global:参数是进程级的,通常是和操作系统相关。这些参数一般只设置一次,如果配置无误,就不需要再次进行修改
2、defaults:配置默认参数,这些参数可以被用到frontend,backend,Listen组件
3、frontend:接收请求的前端虚拟节点,Frontend可以更加规则直接指定具体使用后端的backend
4、backend:后端服务集群的配置,是真实服务器,一个Backend对应一个或者多个实体服务器
5、Listen Fronted和backend的组合体
官网:http://www.haproxy.org ,如果不能访问,可以使用在线代理访问下载。下载:http://fossies.org/linux/misc/haproxy-1.5.14.tar.gz 或 haproxy-1.5.14.tar.gz
1
| |
创建目录/home/haproxy/haproxy
CentOS5编译新的haproxy需要在Makefile中禁掉USE_ACCEPT4
1 2 3 | |
进入/home/haproxy/haproxy 目录创建/home/haproxy/haproxy/conf目录,复制配置examples
1
| |
配置说明如下:(参考:http://freehat.blog.51cto.com/1239536/1347882)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | |
1 2 3 4 | |
1 2 3 | |
启动服务:
1
| |
重启服务:
1
| |
停止服务:
1
| |