openstack controller ha测试环境搭建记录(三)——配置haproxy
haproxy.cfg请备份再编辑:
# vi /etc/haproxy/haproxy.cfg
global
chroot /var/lib/haproxy
daemon
group haproxy
maxconn 4000
pidfile /var/run/haproxy.pid
user haproxy
defaults
log global
maxconn 4000
option redispatch
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout check 10s
listen galera_cluster
bind 10.0.0.10:3306
balance source
option httpchk
server controller2 10.0.0.12:3306 check port 9200 inter 2000 rise 2 fall 5
server controller3 10.0.0.13:3306 check port 9200 inter 2000 rise 2 fall 5
每个节点都要编辑haproxy.cfg。
此处只是测试haproxy,为每个节点的3306端口做负责平衡。3306是mariadb的监听端口,此处未安装,将在下一篇文章中安装。
由于需要将集群资源绑定到VIP,需要修改各节点的内核参数:
# echo 'net.ipv4.ip_nonlocal_bind = 1'>>/etc/sysctl.conf
# sysctl -p
在集群中增加haproxy服务资源:
# crm configure primitive haproxy lsb:haproxy op monitor interval="30s"
“lsb:haproxy”表示haproxy服务。
ERROR: lsb:haproxy: got no meta-data, does this RA exist?
ERROR: lsb:haproxy: got no meta-data, does this RA exist?
ERROR: lsb:haproxy: no such resource agent
Do you still want to commit (y/n)? n
似乎crm命令不识别“haproxy”服务。查看crm目前能识别哪些服务:
# crm ra list lsb
netconsole network
netconsole和network位于/etc/rc.d/init.d目录中,是centos7默认情况下仅有的服务脚本,推测在此目录创建haproxy的服务脚本即可(每个节点均要):
# vi /etc/rc.d/init.d/haproxy
内容如下:
#!/bin/bash
case "$1" in
start)
systemctl start haproxy.service
;;
stop)
systemctl stop haproxy.service
;;
status)
systemctl status -l haproxy.service
;;
restart)
systemctl restart haproxy.service
;;
*)
echo '$1 = start|stop|status|restart'
;;
esac
记得授予可执行权限:
chmod 755 /etc/rc.d/init.d/haproxy
再次确认crm命令是否能识别“haproxy”:
# crm ra list lsb
haproxy netconsole network
已经有了haproxy,“service haproxy status”命令也能用了,请再次尝试创建haproxy服务资源。
查看资源状态:
# crm_mon
Last updated: Tue Dec 8 11:28:35 2015
Last change: Tue Dec 8 11:28:28 2015
Stack: corosync
Current DC: controller2 (167772172) - partition with quorum
Version: 1.1.12-a14efad
2 Nodes configured
2 Resources configured
Online: [ controller2 controller3 ]
myvip (ocf::heartbeat:IPaddr2): Started controller2
haproxy (lsb:haproxy): Started controller3
目前haproxy资源在节点controller3上,在controller3上查看haproxy服务状态,已是active:
# systemctl status -l haproxy.service
定义HAProxy和VIP必须在同一节点上运行:
# crm configure colocation haproxy-with-vip INFINITY: haproxy myvip
定义先接管VIP之后才启动HAProxy:
# crm configure order haproxy-after-vip mandatory: myvip haproxy
--------------------------------------------------------------------------------------------
把HAProxy实例部署在openstack的控制节点上,已经成为一种共识。实例的数量最好是奇数,如3、5等。
官网完整的haproxy.cfg实例内容如下:
global
chroot /var/lib/haproxy
daemon
group haproxy
maxconn 4000
pidfile /var/run/haproxy.pid
user haproxy
defaults
log global
maxconn 4000
option redispatch
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout check 10s
listen dashboard_cluster
bind <Virtual IP>:443
balance source
option tcpka
option httpchk
option tcplog
server controller1 10.0.0.1:443 check inter 2000 rise 2 fall 5
server controller2 10.0.0.2:443 check inter 2000 rise 2 fall 5
server controller3 10.0.0.3:443 check inter 2000 rise 2 fall 5
listen galera_cluster
bind <Virtual IP>:3306
balance source
option httpchk
server controller1 10.0.0.4:3306 check port 9200 inter 2000 rise 2 fall 5
server controller2 10.0.0.5:3306 backup check port 9200 inter 2000 rise 2 fall 5
server controller3 10.0.0.6:3306 backup check port 9200 inter 2000 rise 2 fall 5
listen glance_api_cluster
bind <Virtual IP>:9292
balance source
option tcpka
option httpchk
option tcplog
server controller1 10.0.0.1:9292 check inter 2000 rise 2 fall 5
server controller2 10.0.0.2:9292 check inter 2000 rise 2 fall 5
server controller3 10.0.0.3:9292 check inter 2000 rise 2 fall 5
listen glance_registry_cluster
bind <Virtual IP>:9191
balance source
option tcpka
option tcplog
server controller1 10.0.0.1:9191 check inter 2000 rise 2 fall 5
server controller2 10.0.0.2:9191 check inter 2000 rise 2 fall 5
server controller3 10.0.0.3:9191 check inter 2000 rise 2 fall 5
listen keystone_admin_cluster
bind <Virtual IP>:35357
balance source
option tcpka
option httpchk
option tcplog
server controller1 10.0.0.1:35357 check inter 2000 rise 2 fall 5
server controller2 10.0.0.2:35357 check inter 2000 rise 2 fall 5
server controller3 10.0.0.3:35357 check inter 2000 rise 2 fall 5
listen keystone_public_internal_cluster
bind <Virtual IP>:5000
balance source
option tcpka
option httpchk
option tcplog
server controller1 10.0.0.1:5000 check inter 2000 rise 2 fall 5
server controller2 10.0.0.2:5000 check inter 2000 rise 2 fall 5
server controller3 10.0.0.3:5000 check inter 2000 rise 2 fall 5
listen nova_ec2_api_cluster
bind <Virtual IP>:8773
balance source
option tcpka
option tcplog
server controller1 10.0.0.1:8773 check inter 2000 rise 2 fall 5
server controller2 10.0.0.2:8773 check inter 2000 rise 2 fall 5
server controller3 10.0.0.3:8773 check inter 2000 rise 2 fall 5
listen nova_compute_api_cluster
bind <Virtual IP>:8774
balance source
option tcpka
option httpchk
option tcplog
server controller1 10.0.0.1:8774 check inter 2000 rise 2 fall 5
server controller2 10.0.0.2:8774 check inter 2000 rise 2 fall 5
server controller3 10.0.0.3:8774 check inter 2000 rise 2 fall 5
listen nova_metadata_api_cluster
bind <Virtual IP>:8775
balance source
option tcpka
option tcplog
server controller1 10.0.0.1:8775 check inter 2000 rise 2 fall 5
server controller2 10.0.0.2:8775 check inter 2000 rise 2 fall 5
server controller3 10.0.0.3:8775 check inter 2000 rise 2 fall 5
listen cinder_api_cluster
bind <Virtual IP>:8776
balance source
option tcpka
option httpchk
option tcplog
server controller1 10.0.0.1:8776 check inter 2000 rise 2 fall 5
server controller2 10.0.0.2:8776 check inter 2000 rise 2 fall 5
server controller3 10.0.0.3:8776 check inter 2000 rise 2 fall 5
listen ceilometer_api_cluster
bind <Virtual IP>:8777
balance source
option tcpka
option httpchk
option tcplog
server controller1 10.0.0.1:8777 check inter 2000 rise 2 fall 5
server controller2 10.0.0.2:8777 check inter 2000 rise 2 fall 5
server controller3 10.0.0.3:8777 check inter 2000 rise 2 fall 5
listen spice_cluster
bind <Virtual IP>:6080
balance source
option tcpka
option tcplog
server controller1 10.0.0.1:6080 check inter 2000 rise 2 fall 5
server controller2 10.0.0.2:6080 check inter 2000 rise 2 fall 5
server controller3 10.0.0.3:6080 check inter 2000 rise 2 fall 5
listen neutron_api_cluster
bind <Virtual IP>:9696
balance source
option tcpka
option httpchk
option tcplog
server controller1 10.0.0.1:9696 check inter 2000 rise 2 fall 5
server controller2 10.0.0.2:9696 check inter 2000 rise 2 fall 5
server controller3 10.0.0.3:9696 check inter 2000 rise 2 fall 5
listen swift_proxy_cluster
bind <Virtual IP>:8080
balance source
option tcplog
option tcpka
server controller1 10.0.0.1:8080 check inter 2000 rise 2 fall 5
server controller2 10.0.0.2:8080 check inter 2000 rise 2 fall 5
server controller3 10.0.0.3:8080 check inter 2000 rise 2 fall 5
openstack controller ha测试环境搭建记录(三)——配置haproxy的更多相关文章
- openstack controller ha测试环境搭建记录(一)——操作系统准备
为了初步了解openstack controller ha的工作原理,搭建测试环境进行学习. 在学习该方面知识时,当前采用的操作系统版本是centos 7.1 x64.首先在ESXi中建立2台用于测试 ...
- openstack controller ha测试环境搭建记录(二)——配置corosync和pacemaker
corosync.conf请备份再编辑:# vi /etc/corosync/corosync.conf totem { version: 2 token: 10000 t ...
- openstack controller ha测试环境搭建记录(四)——配置mysql数据库集群
内容正式开始前,我已经在集群中添加了新的节点controller1(IP地址为10.0.0.14). 在所有节点上安装软件:# yum install -y mariadb-galera-server ...
- openstack controller ha测试环境搭建记录(十五)——创建实例
# source demo-openrc.sh # ssh-keygenGenerating public/private rsa key pair.Enter file in which to sa ...
- openstack controller ha测试环境搭建记录(十三)——配置cinder(控制节点)
在任一控制节点创建用户:mysql -u root -pCREATE DATABASE cinder;GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'loc ...
- openstack controller ha测试环境搭建记录(七)——配置glance
在所有集群安装glance软件:yum install -y openstack-glance python-glanceclient 在任一节点创建glance用户:mysql -u root -p ...
- openstack controller ha测试环境搭建记录(六)——配置keystone
在所有节点的hosts文件添加:10.0.0.10 myvip 在所有节点安装# yum install -y openstack-keystone python-keystoneclient# yu ...
- openstack controller ha测试环境搭建记录(五)——配置rabbitmq集群
配置rabbitmq集群的步骤非常简单,因为其本身含集群功能,参考openstack官网文档:http://docs.openstack.org/ha-guide/controller-ha-rabb ...
- openstack controller ha测试环境搭建记录(十)——配置neutron(控制节点)
创建neutron用户:mysql -u root -p CREATE DATABASE neutron;GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@ ...
随机推荐
- MyEclipse build path no actions available
MyEclipse,是在eclipse 基础上加上自己的插件开发而成的功能强大的企业级集成开发环境,主要用于Java.Java EE以及移动应用的开发.MyEclipse的功能非常强大,支持也十分广泛 ...
- asp发邮件控件
<% Set jmail = Server.CreateObject("JMAIL.SMTPMail") ’创建一个JMAIL对象 jmail.silent = true ’ ...
- Dreamweaver使用过程的小技巧
在用Dreamweaver中制作网站的过程中,经常会遇到这样的问题,我们要修改一些属性类的标签,如<a href="abc/def.html">,如果我们要把href= ...
- java模式:深入单例模式
原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://devbean.blog.51cto.com/448512/203501 在GoF ...
- selenium2(WebDriver) API
selenium2(WebDriver) API 作者:Glen.He出处:http://www.cnblogs.com/puresoul/ 1.1 下载selenium2.0的包 官方downl ...
- Android 使用存放在存assets文件夹下的SQLite数据库
因为这次的项目需要自带数据,所以就就把数据都放到一个SQLite的数据库文件中了,之后把该文件放到了assets文件夹下面.一开始打算每次都从assets文件夹下面把该文件夹拷贝到手机的SD卡或者手机 ...
- 字段为空sql语句,设置当前模式
delete from t_corpinfo where CORPID='' and CORPNAME='' 该命令是删除字段为空的记录 SET CURRENT SCHEMA DB2INST1;
- 拖拽加点ui吧
有一段时间没写东西了,真的是静下心来不容易的事情. 把之前的代码再翻看下,想想要加点ui什么的. 2d 塔防ui之前 我看过,但放到3d上做,其实难度是很大的. 不过,这不算什么,关键是 合理的 布 ...
- oracle 基础使用以及sql语句基础
oracle的安装与卸载 要记住数据库口令,适用于sys.system.sysman/dbsnmp等账户,而scott帐号密码默认为tiger, 以oracle 10g来说,scott账户默 ...
- circularprogressbar/smoothprogressbar开源视图使用学习
github地址:https://github.com/castorflex/SmoothProgressBar 多彩圆形进度条和多彩水平进度条 colors.xml 定义变化的颜色内容,用gplus ...