首页 > 其他 > 详细

haproxy 安装配置 centos 7

时间:2019-10-21 15:50:23      阅读:68      评论:0      收藏:0      [点我收藏+]

haproxy 安装配置 centos 7

yum install -y haproxy

##忽略VIP
echo "net.ipv4.ip_nonlocal_bind = 1" >>/etc/sysctl.conf
sysctl -p

cat > /etc/haproxy/haproxy.cfg << EOF
global 
    log 127.0.0.1 local3 info 
    chroot /var/lib/haproxy 
    user haproxy 
    group haproxy 
    daemon
defaults
    log global
    mode http
    option httplog
    option dontlognull
    timeout connect 5000
    timeout client 50000
    timeout server 50000
frontend k8s_api
    mode tcp
    bind *:16443
    default_backend k8s_api

backend k8s_api
    mode tcp
    balance roundrobin
    server k8s150 192.168.0.150:6443 check 
    server k8s151 192.168.0.151:6443 check 
   
listen stats
    mode http
    bind 0.0.0.0:1080
    stats enable
    stats hide-version
    stats uri /stats
    stats realm Haproxy\ Statistics
    stats auth admin:admin123
    stats admin if TRUE
EOF

systemctl enable haproxy.service 
systemctl restart haproxy.service 
systemctl status haproxy.service 
netstat -lnt | grep -E "16443|1080"

 

haproxy 安装配置 centos 7

原文:https://www.cnblogs.com/blog-lhong/p/11713088.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!