码迷,mamicode.com
首页 > 其他好文 > 详细

Haproxy安装配置(二)

时间:2019-01-21 16:14:36      阅读:152      评论:0      收藏:0      [点我收藏+]

标签:tcp   -o   c++   daemon   lan   start   chroot   mode   lob   

1.yum安装
yum install net-tools vim tree screen lsof tcpdump nc mtr nmap gcc glibc gcc-c++ make haproxy keepalived nginx

2.haproxy.cfg配置文件
global
maxconn 100000
chroot /var/lib/haproxy
user haproxy
group haproxy
daemon
nbproc 1
pidfile /var/run/haproxy.pid
log 127.0.0.1 local3 info

defaults
option http-keep-alive
maxconn 100000
mode http
timeout connect 5000ms
timeout client 50000ms
timeout server 50000ms

listen stats
mode http
bind 0.0.0.0:8888
stats enable
stats uri /haproxy-status
stats auth haproxy:haproxy

frontend main
bind 192.168.168.32:80
mode http
option httplog
log global
default_backend backend_test

backend backend_test
option forwardfor header X-REAL-IP
option httpchk HEAD / HTTP/1.0
balance source #源IP roundrobin轮询
server web-node1 192.168.168.32:8080 check inter 2000 rise 30 fall 15
server web-node2 192.168.168.33:8080 check inter 2000 rise 30 fall 15

3.启动
systemctl start haproxy

nginx请自己配置
http://192.168.1.1:8888/haproxy-status
技术分享图片

Haproxy安装配置(二)

标签:tcp   -o   c++   daemon   lan   start   chroot   mode   lob   

原文地址:http://blog.51cto.com/yangxiongchun/2344981

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!