首页 > Linux操作系统 > Linux操作系统 > HAProxy 负载均衡

[root@xutest src]cd /usr/local/
[root@xutest src]wget http://www.dbasky.net/tool/haproxy-1.3.15.7.tar.gz
[root@xutest src]tar -zxvf haproxy-1.3.15.7.tar.gz
[root@xutest src]cd haproxy-1.3.15.7
[root@xutest src]make TARGET=linux26 USE_STATIC_PCRE=1
[root@xutest src]make install PREFIX=/home
[root@xutest src]groupadd haproxy
[root@xutest src]useradd haproxy -g haproxy
[root@xutest src]vi /etc/passwd
haproxy:x:500:500::/home/haproxy:/bin/bash
[root@xutest opt]#mkdir /opt/haproxy
[root@xutest opt]#touch /opt/haproxy/haproxy.cfg
[root@xutest opt]#vi /opt/haproxy/haproxy.cfg
global
log 127.0.0.1 local0
maxconn 4096
chroot /opt/haproxy
uid 500
gid 500
daemon
nbproc 1
#pidfile /home/haproxy/logs/haproxy.pid
#debug
#quiet
defaults
log 127.0.0.1 local3
mode http
option httplog
option httpclose
option dontlognull
option forwardfor
option redispatch
retries 2
maxconn 2000
balance roundrobin
stats uri /haproxy-stats
contimeout 5000
clitimeout 50000
srvtimeout 50000
listen web_proxy 0.0.0.0:8888
option httpchk
server web1 192.168.1.250:8080 weight 3 check
server web2 192.168.1.238:8080 weight 3 check
[root@xutest haproxy]# /usr/local/sbin/haproxy -f /opt/haproxy/haproxy.cfg
[root@xutest haproxy]# ps aux|grep haproxy
[root@xutest haproxy]# kill -9 + 进程ID
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/17172228/viewspace-777239/ ,如需转载,请注明出处,否则将追究法律责任。