openstack高可用haproxy配置

Posted Elvin笔记分享

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了openstack高可用haproxy配置相关的知识,希望对你有一定的参考价值。

#openstack高可用haproxy配置

openstack pike 部署 目录汇总 http://www.cnblogs.com/elvi/p/7613861.html
#openstack高可用haproxy配置

###########全局配置#########
    global
    log 127.0.0.1 local0
    log 127.0.0.1 local1 notice
    daemon
    #nbproc 1     #进程数量 
    maxconn 4096  #最大连接数 
    user haproxy  #运行用户  
    group haproxy #运行组 
    chroot /var/lib/haproxy
    pidfile /var/run/haproxy.pid
########默认配置############
    defaults
    log global
    mode http            #默认模式{ tcp|http|health }
    option httplog       #日志类别,采用httplog
    option dontlognull   #不记录健康检查日志信息  
    retries 2            #2次连接失败不可用
    option forwardfor    #后端服务获得真实ip
    option httpclose     #请求完毕后主动关闭http通道
    option abortonclose  #服务器负载很高,自动结束比较久的链接  
    maxconn 4096         #最大连接数  
    timeout connect 5m   #连接超时  
    timeout client 1m    #客户端超时  
    timeout server 31m   #服务器超时  
    timeout check 10s    #心跳检测超时  
    balance roundrobin   #负载均衡方式,轮询 
########统计页面配置########
    listen stats  
    bind 0.0.0.0:1080 
    mode http
    option httplog
    log 127.0.0.1 local0 err 
    stats refresh 30s
    maxconn 10               #最大连接数  
    stats uri /admin         #状态页面 http//ip:1080/admin访问  
    stats realm Haproxy\\ Statistics
    stats auth admin:admin   #用户和密码:admin
    stats hide-version       #隐藏版本信息  
    stats admin if TRUE      #设置手工启动/禁用

########以下为openstack高可用配置############

#dashboard_cluster
listen dashboard_cluster  
    bind controller:80
    balance  roundrobin  
    #balance  source
    option  tcpka  
    option  httpchk  
    option  tcplog  
    server controller1 controller1:8080 check port 8080 inter 2000 rise 2 fall 5
    server controller2 controller2:8080 check port 8080 inter 2000 rise 2 fall 5
    server controller3 controller3:8080 check port 8080 inter 2000 rise 2 fall 5

#mariadb_cluster
listen mariadb_cluster
    mode tcp
    bind controller:3306
    balance leastconn
    option mysql-check user haproxy     
    server controller1 controller1:3306 weight 1 check inter 2000 rise 2 fall 5
    server controller2 controller2:3306 weight 1 check inter 2000 rise 2 fall 5
    server controller3 controller3:3306 weight 1 check inter 2000 rise 2 fall 5

#RabbitMQ_cluster
listen RabbitMQ-Server
    bind controller:5673
    mode tcp
    balance roundrobin
    option tcpka
    timeout client  30m
    timeout server  30m
    option  clitcpka
    server controller1 controller1:5672 check inter 5s rise 2 fall 3
    server controller2 controller2:5672 check inter 5s rise 2 fall 3
    server controller3 controller3:5672 check inter 5s rise 2 fall 3

#RabbitMQ
listen RabbitMQ-Web
    bind controller:15673
    balance roundrobin
    mode tcp
    option tcpka
    server controller1 controller1:15672 check inter 5s rise 2 fall 3
    server controller2 controller2:15672 check inter 5s rise 2 fall 3
    server controller3 controller3:15672 check inter 5s rise 2 fall 3
#

#keystone
listen keystone_admin_cluster
    bind controller:35357
    #balance  source
    option  tcpka
    option  httpchk 
    option  tcplog
    server controller1 controller1:35356 check inter 2000 rise 2 fall 5
    server controller2 controller2:35356 check inter 2000 rise 2 fall 5
    server controller3 controller3:35356 check inter 2000 rise 2 fall 5

listen keystone_public_cluster
    bind controller:5000
    #balance  source
    option  tcpka
    option  httpchk 
    option  tcplog
    server controller1 controller1:4999 check inter 2000 rise 2 fall 5
    server controller2 controller2:4999 check inter 2000 rise 2 fall 5
    server controller3 controller3:4999 check inter 2000 rise 2 fall 5

#glance_api_cluster
listen glance_api_cluster
    bind controller:9292
    #balance  source
    option  tcpka
    option  httpchk
    option  tcplog
    server controller1 controller1:9292 check inter 2000 rise 2 fall 5
    server controller2 controller2:9292 check inter 2000 rise 2 fall 5
    server controller3 controller3:9292 check inter 2000 rise 2 fall 5
#
listen glance_registry_cluster
    bind controller:9191
    balance  source
    option  tcpka
    option  tcplog
    server controller1 controller1:9191 check inter 2000 rise 2 fall 5
    server controller2 controller2:9191 check inter 2000 rise 2 fall 5
    server controller3 controller3:9191 check inter 2000 rise 2 fall 5


##nova_compute
listen nova_compute_api_cluster
    bind controller:8774
    #balance source
    option tcpka
    option httpchk
    option tcplog
    server controller1 controller1:8774 check inter 2000 rise 2 fall 5
    server controller2 controller2:8774 check inter 2000 rise 2 fall 5
    server controller3 controller3:8774 check inter 2000 rise 2 fall 5
#Nova-api-metadata
listen Nova-api-metadata_cluster
    bind controller:8775
    balance source
    option tcpka
    option httpchk
    option tcplog
    server controller1 controller1:8775 check inter 2000 rise 2 fall 5
    server controller2 controller2:8775 check inter 2000 rise 2 fall 5
    server controller3 controller3:8775 check inter 2000 rise 2 fall 5
#nova_placement
listen nova_placement_cluster
    bind controller:8778
    #balance source
    option tcpka
    option tcplog
    server controller1 controller1:9778 check inter 2000 rise 2 fall 5
    server controller2 controller2:9778 check inter 2000 rise 2 fall 5
    server controller3 controller3:9778 check inter 2000 rise 2 fall 5
#nova_vncproxy
listen nova_vncproxy_cluster
    bind controller:6080
    #balance source
    option tcpka
    option tcplog
    server controller1 controller1:6080 check inter 2000 rise 2 fall 5
    server controller2 controller2:6080 check inter 2000 rise 2 fall 5
    server controller3 controller3:6080 check inter 2000 rise 2 fall 5

#Neutron_API
listen Neutron_API_cluster
    bind controller:9696
    #balance source
    option tcpka
    option tcplog
    server controller1 controller1:9696 check inter 2000 rise 2 fall 5
    server controller2 controller2:9696 check inter 2000 rise 2 fall 5
    server controller3 controller3:9696 check inter 2000 rise 2 fall 5
#Cinder_API_cluster
listen Cinder_API_cluster
    bind controller:8776
    #balance source
    option tcpka
    option httpchk
    option tcplog
    server controller1 controller1:8776 check inter 2000 rise 2 fall 5
    server controller2 controller2:8776 check inter 2000 rise 2 fall 5
    server controller3 controller3:8776 check inter 2000 rise 2 fall 5
#

 

以上是关于openstack高可用haproxy配置的主要内容,如果未能解决你的问题,请参考以下文章

keepalived集群高可用

HaProxy+Keepalived+Mycat高可用群集配置

0656-6.2.0-如何配置Haproxy高可用

HaProxy+Keepalived+Mycat高可用群集配置

理解 OpenStack 高可用(HA):Neutron 分布式虚拟路由

Keepalived配置实现HaProxy高可用