一、介绍

  配置文件位置(yum 安装):/etc/haproxy/haproxy.cfg

  全局配置  

#---------------------------------------------------------------------
# Global settings
#---------------------------------------------------------------------
global
log 127.0.0.1 local2 chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 4000
user haproxy
group haproxy
daemon
stats socket /var/lib/haproxy/stats

  默认配置  

#---------------------------------------------------------------------
# common defaults that all the 'listen' and 'backend' sections will
# use if not designated in their block
#---------------------------------------------------------------------
defaults
mode http
log global
option httplog
option dontlognull
option forwardfor
option redispatch
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 10s
timeout check 10s
maxconn 3000

  配置haproxy 的统计页面  

#---------------------------------------------------------------------
# tong ji ye mian pei zhi
#---------------------------------------------------------------------
listen stats
bind 10.6.32.200:1080
mode http
option httplog
log 127.0.0.1 local0 err
stats refresh 30s
maxconn 10
stats uri /admin
stats realm Haproxy\ Statistics
stats auth admin:admin #web登录的账号密码
stats hide-version
stats admin if TRUE

    在浏览器中访问:http://10.6.32.200:1080/admin

    

1、httpd 服务  

#---------------------------------------------------------------------
# listen httpd server
#---------------------------------------------------------------------
listen httpd_cluster
bind 10.6.32.200:
balance roundrobin
option tcpka
option httpchk
option tcplog
server controller1 controller1: check port inter rise fall
server controller2 controller2: check port inter rise fall
server controller3 controller3: check port inter rise fall

2、mysql 服务  

#---------------------------------------------------------------------
# listen Mysql-db server
#---------------------------------------------------------------------
listen mysql_cluster
mode tcp
bind 10.6.32.200:
balance source
option mysql-check user haproxy # 需要在数据库中创建没有密码的 haproxy用户,不需要有任何权限,详情查看博客:Mysql 5.7 弱密码限制,及创建用户无密码用户
server controller1 controller1: weight check inter rise fall
server controller2 controller2: weight check inter rise fall
server controller3 controller3: weight check inter rise fall

3、 keystone-admin API  

#---------------------------------------------------------------------
# listen keystone-admin server
#---------------------------------------------------------------------
listen keystone_admin
bind 10.6.32.200:35357
balance source
option tcpka
option httpchk
option tcplog
http-request del-header X-Forwarded-Proto if { ssl_fc }
server controller1 10.6.32.51:35357 check inter 2000 rise 2 fall 5
server controller2 10.6.32.52:35357 check inter 2000 rise 2 fall 5
server controller3 10.6.32.53:35357 check inter 2000 rise 2 fall 5

  

4、keystone-public 和 keystone-internal  API

#---------------------------------------------------------------------
# listen keystone-public and keystone-internal server
#---------------------------------------------------------------------
listen keystone_pub_int
bind 10.6.32.200:5000 #需要将haproxy 默认自带的 frontend main *:5000 区块注释掉,有端口冲突
balance source
option tcpka
option httpchk
option tcplog
http-request del-header X-Forwarded-Proto if { ssl_fc }
server controller1 controller1:5000 check inter 2000 rise 2 fall 5
server controller2 controller2:5000 check inter 2000 rise 2 fall 5
server controller3 controller3:5000 check inter 2000 rise 2 fall 5

5、Glance-api server

#---------------------------------------------------------------------
# listen glance-admin,glance-public,glance-internal server
#---------------------------------------------------------------------
listen glance-api
bind 10.6.32.200:9292
balance source
option tcpka
option httpchk
option tcplog
server controller1 10.6.32.51:9292 check inter 2000 rise 2 fall 5
server controller2 10.6.32.52:9292 check inter 2000 rise 2 fall 5
server controller3 10.6.32.53:9292 check inter 2000 rise 2 fall 5

6、Glance-registery server

#---------------------------------------------------------------------
# listen glance-registery server
#---------------------------------------------------------------------
listen glance-registery
bind 10.6.32.200:9191
balance source
option tcpka
option tcplog
server controller1 10.6.32.51:9191 check inter 2000 rise 2 fall 5
server controller2 10.6.32.52:9191 check inter 2000 rise 2 fall 5
server controller3 10.6.32.53:9191 check inter 2000 rise 2 fall 5

7、rabbitmq-web

#---------------------------------------------------------------------
# listen Rabbitmq-web server
#---------------------------------------------------------------------
listen rabbitmq-web
mode tcp
bind 10.6.32.200:15671
balance roundrobin
server controller1 10.6.32.51:15672 check inter 2000 rise 2 fall 5
server controller2 10.6.32.52:15672 check inter 2000 rise 2 fall 5
server controller3 10.6.32.53:15672 check inter 2000 rise 2 fall 5

8、nova-api  server

#---------------------------------------------------------------------
# listen nova-api server
#---------------------------------------------------------------------
listen nova-api
bind 10.6.32.200:8774
balance source
option tcpka
option httpchk
option tcplog
http-request del-header X-Forwarded-Proto if { ssl_fc }
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

  

9、nova novncproxy server 

#---------------------------------------------------------------------
# listen nova-novncproxy server
#---------------------------------------------------------------------
listen nova_novncproxy
bind 10.6.32.200:6080
balance source
option tcpka
option tcplog
http-request del-header X-Forwarded-Proto if { ssl_fc }
http-request set-header X-Forwarded-Proto https if { ssl_fc }
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

10、nova-placement-api  server

#---------------------------------------------------------------------
# listen nova-placement public、internal、admin server
#---------------------------------------------------------------------
listen nova_placement-api
bind 10.6.32.200:8778
balance source
option tcpka
option tcplog
http-request del-header X-Forwarded-Proto if { ssl_fc }
server controller1 controller1:8778 check inter 2000 rise 2 fall 5
server controller2 controller2:8778 check inter 2000 rise 2 fall 5
server controller3 controller3:8778 check inter 2000 rise 2 fall 5

11、neutron server

#---------------------------------------------------------------------
# listen neutron server
#---------------------------------------------------------------------
listen neutron
  bind 10.6.32.200: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

12、 memcache server

#---------------------------------------------------------------------
# listen memcached server
#---------------------------------------------------------------------
listen memcache
mode tcp
bind 10.6.32.200:11211
balance static-rr
server controller1 controller1:11211 weight 1 check inter 2000 rise 2 fall 5
server controller2 controller2:11211 weight 10 check inter 2000 rise 2 fall 5
server controller3 controller3:11211 weight 20 check inter 2000 rise 2 fall 5

 

13、cinder server

#---------------------------------------------------------------------
# listen cinder_api server
#---------------------------------------------------------------------
listen cinder_api
  bind 10.6.32.200:8776
  balance source
  option tcpka
  option tcplog
  http-request del-header X-Forwarded-Proto if { ssl_fc }
  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配置的更多相关文章

  1. openstack高可用haproxy配置

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

  2. 企业运维实践-还不会部署高可用的kubernetes集群?使用kubeadm方式安装高可用k8s集群v1.23.7

    关注「WeiyiGeek」公众号 设为「特别关注」每天带你玩转网络安全运维.应用开发.物联网IOT学习! 希望各位看友[关注.点赞.评论.收藏.投币],助力每一个梦想. 文章目录: 0x00 前言简述 ...

  3. 15套java互联网架构师、高并发、集群、负载均衡、高可用、数据库设计、缓存、性能优化、大型分布式 项目实战视频教程

    * { font-family: "Microsoft YaHei" !important } h1 { color: #FF0 } 15套java架构师.集群.高可用.高可扩 展 ...

  4. openstack集群访问外部服务出现访问失败

    场景描述: openstack私有云中的容器服务A(部署在openshift上)需要通过http访问阿里云中的B服务,中间需要经过openstack的nat网关,以及阿里云的lb.但在访问时发现访问失 ...

  5. Linux下"负载均衡+高可用"集群的考虑点 以及 高可用方案说明(Keepalive/Heartbeat)

    当下Linux运维技术越来越受到企业的关注和追捧, 在某些企业, 尤其是牵涉到电子商务和电子广告类的网站,通常会要求作负载均衡和高可用的Linux集群方案.那么如何实施Llinux集群架构,才能既有效 ...

  6. Java集群优化——dubbo+zookeeper构建高可用分布式集群

    不久前,我们讨论过Nginx+tomcat组成的集群,这已经是非常灵活的集群技术,但是当我们的系统遇到更大的瓶颈,全部应用的单点服务器已经不能满足我们的需求,这时,我们要考虑另外一种,我们熟悉的内容, ...

  7. 基于zookeeper(集群)+LevelDB的ActiveMq高可用集群安装、配置、测试

    一. zookeeper安装(集群):http://www.cnblogs.com/wangfajun/p/8692117.html  √ 二. ActiveMq配置: 1. ActiveMq集群部署 ...

  8. Redis Cluster 集群三主三从高可用环境搭建

    前言 Redis 是我们目前大规模使用的缓存中间件,由于它强大高效而又便捷的功能,得到了广泛的使用. Window环境下载地址:https://github.com/tporadowski/redis ...

  9. centos7下用kubeadm安装k8s集群并使用ipvs做高可用方案

    1.准备 1.1系统配置 在安装之前,需要先做如下准备.三台CentOS主机如下: 配置yum源(使用腾讯云的) 替换之前先备份旧配置 mv /etc/yum.repos.d/CentOS-Base. ...

随机推荐

  1. Windows系统不同磁盘间的扩容教程

    1.windows系统不同磁盘的空间扩展: https://www.cnblogs.com/yunweis/p/8023098.html

  2. c# word操作

    合并单元格  http://www.360doc.com/content/11/0729/21/2097544_136620405.shtml

  3. JSP-打印动态表格

    input.html <script language="javascript"> function validate(f){ if(!(/\w+/.test(f.in ...

  4. UEditor 在ie中报console未定义解决方案

    解决办法:                  1.注释掉该代码               2.或者加入如下代码即可,本人已经测试过,没有问题. window.console = window.con ...

  5. Python基础3 函数、递归、内置函数

    本节内容 1. 函数基本语法及特性 2. 参数与局部变量 3. 返回值 嵌套函数 4.递归 5.匿名函数 6.函数式编程介绍 7.高阶函数 8.内置函数 温故知新 1. 集合 主要作用: 去重 关系测 ...

  6. 异常+远程控制Linux-14

    什么是异常 a=8950/0              ZeroDivisioonError: division by zero print (a) ************** b = [1,2] ...

  7. cp命令 复制目录

    格式:cp -R {源目录地址} {目标目录地址} 假设文件夹download下有两个目录 download/a download/b 现在想将文件夹a复制到文件夹b下,执行 cp -R downlo ...

  8. cx_Oracle.DatabaseError: DPI-1047

    ODPI-C Installation¶ Overview Oracle Client and Database Versions Linux Oracle Instant Client Zip Or ...

  9. vue:监听数据

    1:普通的监听: data () { return { watchNum:1, } }, watch: { watchNum(newValue, oldValue) { console.log(old ...

  10. Windows系统封装总结

    注:使用虚拟机或者实体机进行封装均可,实体机进行封装的成功率更高.虚拟机进行封装建议使用VMware,12版本.过高的版本容易造成封装失败 一.            Windows 10系统封装 1 ...