Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to master the configuration method of Haporxy load balancing

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

The following brings you how to master the configuration method of Haporxy load balancing, hoping to bring some help to you in practical application. Load balancing involves many things, and there are not many theories. There are many books on the Internet. Today, we will use the accumulated experience in the industry to do an answer.

Vim / etc/haproxy/haproxy.cfgglobal log 127.0.0.1 local2 chroot / var/lib/haproxy pidfile / var/run/haproxy.pid maxconn 4000 user haproxy group haproxy daemon stats socket / var/lib/haproxy/statsdefaults mode httplog global option httplog option Dontlognull option http-server-close option forwardfor except 127.0.0.0On8 option redispatch retries 3 timeout http-request 10s timeout queue 1m timeout connect 10s timeout client 1m timeout server 1m timeout http-keep-alive 10s timeout check 10s maxconn 3000frontend main *: 80 Use_backend webserver frontend stats_ser # defines the stats front end bind *: 8800 # defines the stats listening port use_backend web_statsbackend webserver balance roundrobin cookie WEBSVR insert nocache server web1 192.168.199.126 weight 80 weight 1 maxconn 500 maxqueue 300 cookie cklser1 check server web2 192.168.199.194 maxqueue 80 weight 1 maxconn 500 maxqueue 300 cookie cklser2 check server web3 192.168.199.180 maxqueue 80 weight 1 maxconn 500 maxqueue 300 cookie cklser3 check backend web _ stats server web1 192.168.199.126 check server web3 80 check server web2 192.168.199.194 check server web3 192.168.199.180 check server web3 80 check stats enable # enable stats function stats hide-version # hide haproxy version information Good for security # stats scope. # uri stats realm Haproxy\ Statistics # remarks stats auth ckl:1QAZnji9 # user name password stats auth zld:4rfvBHU8 # user name password stats auth admin:7uj4rf99 # user name password stats admin if TRUE # if this item is not added, the administrator function stats refresh 5s # page refresh interval will not be enabled

10.2. Reload the service

Systemctl restart haproxy.service

10.3. Test status page:

After reading the above about how to master the configuration method of Haporxy load balancer, if you have anything else you need to know, you can find out what you are interested in in the industry information or find our professional and technical engineers for answers. Technical engineers have more than ten years of experience in the industry.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report