haproxy 笔记

  • 全局配置
global
    log         127.0.0.1 local0 notice
    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     102400
    user        haproxy
    group       haproxy
    daemon
    stats socket /var/lib/haproxy/stats
  • 默认配置
defaults
    log global
    option dontlognull
    option redispatch
    option abortonclose
    timeout check 8s
  • tcp 连接 ceph 的 rgw
frontend  ceph-radosgw *:7480
    timeout client 8s
    default_backend eph-radosgw
backend ceph-radosgw
    mode tcp
    balance roundrobin
    timeout connect 8s
    timeout server 8s
    retries 2
    server cpeh240 10.9.10.240:7480 check 
    server ceph241 10.9.10.241:7480 check 
    server ceph243 10.9.10.243:7480 check
  • tcp 连接 mysql
frontend mysql *:3306
    timeout client 1800s
    default_backend mysql
backend mysql
    mode tcp
    balance roundrobin
    timeout connect 8s
    timeout server 1800s
    retries 2
    server mysql242 10.9.10.242:3306 check inter 2s
  • 状态页面
listen admin_stats
    bind 0.0.0.0:10080
    mode http
    maxconn 100
    timeout client 1m
    timeout connect 4s
    timeout server 4s
    stats refresh 30s
    stats uri /
    stats auth username:password
    stats realm haproxy for private user, enter username/password
    stats hide-version

猜你喜欢

转载自my.oschina.net/colben/blog/1782831