global

log 127.0.0.1 local3

chroot /var/lib/haproxy

daemon

nbproc 16

group nobody

user nobody

pidfile /var/run/haproxy.pid


########默认配置############

defaults

mode tcp               #默认的模式mode { tcp|http|health },tcp是4层,http是7层,health只会返回OK

retries 3              #两次连接失败就认为是服务器不可用,也可以通过后面设置

option redispatch      #当serverId对应的服务器挂掉后,强制定向到其他健康的服务器

option abortonclose    #当服务器负载很高的时候,自动结束掉当前队列处理比较久的链接

maxconn 32000          #默认的最大连接数

timeout connect 5000ms #连接超时

timeout client 30000ms #客户端超时

timeout server 30000ms #服务器超时

#timeout check 2000    #心跳检测超时

listen admin_stat                   #status

    bind 0.0.0.0:10000              #监听端口

    mode http                       #http的7层模式

    stats refresh 30s               #统计页面自动刷新时间

    stats uri /haproxy_stats_url    #统计页面URL

    stats realm Haproxy\ Statistics #统计页面密码框上提示文本

    stats auth rongcapital:uluoj1iuL2pie7shocho          #统计页面用户名和密码设置

    stats hide-version              #隐藏统计页面上HAProxy的版本信息

    stats admin if TRUE             #手工启用/禁用,后端服务器


listen dashboard *:80

mode tcp

timeout client 300000ms #客户端超时

timeout server 300000ms #服务器超时

balance source

server s_10.203.3.10_90 10.203.3.10:90 weight 1 maxconn 32000 check inter 10s rise 3 fall 3

server s_10.203.3.11_90 10.203.3.11:90 weight 1 maxconn 32000 check inter 10s rise 3 fall 3 backup



listen ceph_radosgw *:81

mode tcp

timeout client 300000ms #客户端超时

timeout server 300000ms #服务器超时

balance source

server s_10.203.3.10_91 10.203.3.10:91 weight 1 maxconn 32000 check inter 10s rise 3 fall 3

server s_10.203.3.11_91 10.203.3.11:91 weight 1 maxconn 32000 check inter 10s rise 3 fall 3 backup


listen keystone_internal_and_public *:5000

mode tcp

balance source

server s_10.203.3.10_6000 10.203.3.10:6000 weight 1 maxconn 32000 check inter 10s rise 3 fall 3

server s_10.203.3.11_6000 10.203.3.11:6000 weight 1 maxconn 32000 check inter 10s rise 3 fall 3


listen keystone_admin *:35357

mode tcp

balance source

server s_10.203.3.10_45357 10.203.3.10:45357 weight 1 maxconn 32000 check inter 10s rise 3 fall 3

server s_10.203.3.11_45357 10.203.3.11:45357 weight 1 maxconn 32000 check inter 10s rise 3 fall 3


#listen heat-cfn *:8000

#mode tcp

#balance roundrobin

#server s_10.203.3.10_8000 10.203.3.10:8000 weight 1 maxconn 32000 check inter 10s rise 3 fall 3

#server s_10.203.3.11_8000 10.203.3.11:8000 weight 1 maxconn 32000 check inter 10s rise 3 fall 3


#listen nova_heat *:8004

#mode tcp

#balance roundrobin

#server s_10.203.3.10_8004 10.203.3.10:8004 weight 1 maxconn 32000 check inter 10s rise 3 fall 3

#server s_10.203.3.11_8004 10.203.3.11:8004 weight 1 maxconn 32000 check inter 10s rise 3 fall 3


listen nova_api *:8774

mode tcp

balance roundrobin

server s_10.203.3.10_9774 10.203.3.10:9774 weight 1 maxconn 32000 check inter 10s rise 3 fall 3

server s_10.203.3.11_9774 10.203.3.11:9774 weight 1 maxconn 32000 check inter 10s rise 3 fall 3



listen nova-api-metadata *:8775

mode tcp

balance roundrobin

server s_10.203.3.10_9775 10.203.3.10:9775 weight 1 maxconn 32000 check inter 10s rise 3 fall 3

server s_10.203.3.11_9775 10.203.3.11:9775 weight 1 maxconn 32000 check inter 10s rise 3 fall 3


listen cinder-api *:8776

mode tcp

balance roundrobin

server s_10.203.3.10_9776 10.203.3.10:9776 weight 1 maxconn 32000 check inter 10s rise 3 fall 3

server s_10.203.3.11_9776 10.203.3.11:9776 weight 1 maxconn 32000 check inter 10s rise 3 fall 3


#listen ceilometer_api *:8777

#mode tcp

#balance roundrobin

#server s_10.203.3.10_8777 10.203.3.10:8777 weight 1 maxconn 32000 check inter 10s rise 3 fall 3

#server s_10.203.3.11_8777 10.203.3.11:8777 weight 1 maxconn 32000 check inter 10s rise 3 fall 3



listen glance_registry *:9191

mode tcp

balance roundrobin

server s_10.203.3.10_10191 10.203.3.10:10191 weight 1 maxconn 32000 check inter 10s rise 3 fall 3

server s_10.203.3.11_10191 10.203.3.11:10191 weight 1 maxconn 32000 check inter 10s rise 3 fall 3


listen glance_api *:9292

mode tcp

balance roundrobin

server s_10.203.3.10_10292 10.203.3.10:10292 weight 1 maxconn 32000 check inter 10s rise 3 fall 3

server s_10.203.3.11_10292 10.203.3.11:10292 weight 1 maxconn 32000 check inter 10s rise 3 fall 3


listen neutron-server *:9696

mode tcp

balance roundrobin

server s_10.203.3.10_10696 10.203.3.10:10696 weight 1 maxconn 32000 check inter 10s rise 3 fall 3

server s_10.203.3.11_10696 10.203.3.11:10696 weight 1 maxconn 32000 check inter 10s rise 3 fall 3


listen memcache *:11211

mode tcp

balance roundrobin

server s_10.203.3.10_21211 10.203.3.10:21211 weight 1 maxconn 32000 check inter 10s rise 3 fall 3

server s_10.203.3.11_21211 10.203.3.11:21211 weight 1 maxconn 32000 check inter 10s rise 3 fall 3 backup



listen mariadb *:3306

mode tcp

balance roundrobin

server s_10.203.3.10_4306 10.203.3.10:4306 weight 1 maxconn 32000 check inter 10s rise 3 fall 3

server s_10.203.3.11_4306 10.203.3.11:4306 weight 1 maxconn 32000 check inter 10s rise 3 fall 3  backup


listen rabbitmq *:5672

mode tcp

timeout client 600000ms #客户端超时

timeout server 600000ms #服务器超时

balance roundrobin

server s_10.203.3.10_6672 10.203.3.10:6672 weight 1 maxconn 32000 check inter 10s rise 3 fall 3

server s_10.203.3.11_6672 10.203.3.11:6672 weight 1 maxconn 32000 check inter 10s rise 3 fall 3 backup


listen rabbitmq_management *:15672

mode tcp

balance roundrobin

server s_10.203.3.10_15672 10.203.3.10:15672 weight 1 maxconn 32000 check inter 10s rise 3 fall 3

server s_10.203.3.11_15672 10.203.3.11:15672 weight 1 maxconn 32000 check inter 10s rise 3 fall 3 backup


listen nova-novncproxy  *:6080

timeout client 300000ms #客户端超时

timeout server 300000ms #服务器超时

balance source

option tcpka

option tcplog

server s_10.203.3.10_7080 10.203.3.10:7080 weight 1 maxconn 32000 check inter 2s rise 3 fall 3

server s_10.203.3.11_7080 10.203.3.11:7080 weight 1 maxconn 32000 check inter 2s rise 3 fall 3 backup


#listen mongodb  *:27017

#timeout client 300000ms #客户端超时

#timeout server 300000ms #服务器超时

#balance source

#option tcpka

#option tcplog

#server s_10.203.3.10_27017 10.203.3.10:27017 weight 1 maxconn 32000 check inter 2s rise 3 fall 3

#server s_10.203.3.11_27017 10.203.3.11:27017 weight 1 maxconn 32000 check inter 2s rise 3 fall 3 backup