Haproxy 线上配置文档

本文详细介绍了一项HAProxy线上项目的具体配置,包括全局设置、默认配置、监听配置及错误页面配置等内容。通过实例展示了如何配置负载均衡策略、健康检查方式、会话保持等关键功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Haproxy 某项目线上配置文档


  1. $ cat /usr/local/haproxy/haproxy.cfg 
  2. global 
  3.     maxconn 32000 
  4.     pidfile /usr/local/haproxy/haproxy.pid 
  5.         chroot /usr/local/haproxy 
  6.         uid 504 
  7.         gid 504 
  8.         daemon 
  9.         quiet 
  10.         nbproc 1 
  11.  
  12. defaults 
  13.         log     global 
  14.         mode    http 
  15.         option httplog 
  16.         option dontlognull 
  17.         retries 3 
  18.         #option redispatch 
  19.         maxconn 10000 
  20.         contimeout      5000 
  21.         clitimeout      50000 
  22.         srvtimeout      50000 
  23.  
  24. listen tongji 0.0.0.0:80 
  25.         mode http 
  26.         option httplog 
  27.         option dontlognull 
  28.         cookie SERVERID 
  29.         balance roundrobin 
  30.         option httpchk HEAD /check.html HTTP/1.0 
  31.         option forwardfor 
  32.         stats uri /haproxy_stats_url 
  33.         stats auth admin:password
  34.  
  35. errorfile 502 /usr/local/haproxy/html/maintain.html 
  36. errorfile 503 /usr/local/haproxy/html/maintain.html 
  37. errorfile 504 /usr/local/haproxy/html/maintain.html 
  38.  
  39. server city01 10.10.100.61 cookie city01 check inter 2000 rise 2 fall 3 
  40. server city02 10.10.100.62 cookie city02 check inter 2000 rise 2 fall 3 

详细解释,请参考这里。

http://dngood.blog.51cto.com/446195/738634


本文转自 dongnan 51CTO博客,原文链接:http://blog.51cto.com/dngood/819411

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值