提示信息

haproxy配置脚本

峰子 已关注

mycoding


  1. [root@s1 haproxy-2.0.6]# more conf/haproxy.cfg
  2. #
  3. # This is a sample configuration. It illustrates how to separate static objects
  4. # traffic from dynamic traffic, and how to dynamically regulate the server load.
  5. #
  6. # It listens on 192.168.1.10:80, and directs all requests for Host 'img' or
  7. # URIs starting with /img or /css to a dedicated group of servers. URIs
  8. # starting with /admin/stats deliver the stats page.
  9. #
  10. global
  11. maxconn 10000
  12. stats socket /var/run/haproxy.stat mode 600 level admin
  13. log 127.0.0.1 local0
  14. user root
  15. group root
  16. chroot /var/empty
  17. daemon
  18. # The public 'www' address in the DMZ
  19. frontend public
  20. bind 0.0.0.0:80 name clear
  21. #bind 192.168.1.10:443 ssl crt /etc/haproxy/haproxy.pem
  22. mode http
  23. log global
  24. option httplog
  25. option dontlognull
  26. monitor-uri /monitoruri
  27. maxconn 8000
  28. timeout client 30s
  29. stats uri /admin/stats
  30. use_backend static if { path_end .html .jpg }
  31. default_backend dynamic
  32. # The static backend backend for 'Host: img', /img and /css.
  33. backend static
  34. mode http
  35. balance roundrobin
  36. option prefer-last-server
  37. retries 2
  38. option redispatch
  39. timeout connect 5s
  40. timeout server 5s
  41. option httpchk GET /index.html
  42. server statsrv1 192.168.1.226:80 check inter 1000
  43. server statsrv2 192.168.1.227:80 check inter 1000
  44. # the application servers go here
  45. backend dynamic
  46. mode http
  47. balance roundrobin
  48. retries 2
  49. option redispatch
  50. timeout connect 5s
  51. timeout server 30s
  52. timeout queue 30s
  53. option httpchk GET /index.html
  54. cookie DYNSRV insert indirect nocache
  55. fullconn 4000 # the servers will be used at full load above this number of connections
  56. server dynsrv1 192.168.1.228:80 minconn 50 maxconn 500 cookie s1 check inter 1000
  57. server dynsrv2 192.168.1.229:80 minconn 50 maxconn 500 cookie s2 check inter 1000
  58. server dynsrv3 192.168.1.230:80 minconn 50 maxconn 500 cookie s3 check inter 1000
峰子 关注 已关注

最近一次登录:2019-10-10 14:28:58   

暂时还没有签名,请关注我或评论我的文章
×
分享到朋友圈