目录
Openstack-Mitaka 高可用之 概述
Openstack-Mitaka 高可用之 环境初始化
Openstack-Mitaka 高可用之 Mariadb-Galera集群部署
Openstack-Mitaka 高可用之 Rabbitmq-server 集群部署
Openstack-Mitaka 高可用之 memcache
Openstack-Mitaka 高可用之 Pacemaker+corosync+pcs高可用集群
Openstack-Mitaka 高可用之 认证服务(keystone)
OpenStack-Mitaka 高可用之 镜像服务(glance)
Openstack-Mitaka 高可用之 计算服务(Nova)
Openstack-Mitaka 高可用之 网络服务(Neutron)
Openstack-Mitaka 高可用之 Dashboard
Openstack-Mitaka 高可用之 启动一个实例
Openstack-Mitaka 高可用之 测试
环境介绍
openstack内部是遵循AMQP(高级消息队列协议)的基础上采用消息队列进行通信。 nova对请求应答进行异步调用,当请求接收后立即出发一个回调。由于使用了异步通信,不会有用户的动作被长置于等待状态。异步使整个系统变得更加高效。
集群搭建
以下操作三个节点都需要执行:
安装rabbitmq
# yum install rabbitmq-server -y
配置监听地址(每个controller节点都需要配置本地监听地址):
[root@controller1 ~]# vim /etc/rabbitmq/rabbitmq-env.conf # 在RHEL7.2系统上默认是不存在该文件的 RABBITMQ_NODE_IP_ADDRESS=192.168.0.11 RABBITMQ_NODE_PORT=5672
只启动第一个节点:
[root@controller1 ~]# systemctl start rabbitmq-server
拷贝.erlang.cookie文件到controller2 controller3,注意该文件的权限是400
[root@controller1 ~]# scp /var/lib/rabbitmq/.erlang.cookie controller2:/var/lib/rabbitmq/ .erlang.cookie 100% 20 0.0KB/s 00:00 [root@controller1 ~]# scp /var/lib/rabbitmq/.erlang.cookie controller3:/var/lib/rabbitmq/ .erlang.cookie 100% 20 0.0KB/s 00:00 [root@controller1 ~]# ll /var/lib/rabbitmq/.erlang.cookie -r-------- 1 rabbitmq rabbitmq 20 Nov 30 00:00 /var/lib/rabbitmq/.erlang.cookie [root@controller2 ~]# chown -R rabbitmq:rabbitmq /var/lib/rabbitmq/.erlang.cookie [root@controller3 ~]# chown -R rabbitmq:rabbitmq /var/lib/rabbitmq/.erlang.cookie
启动controller2、controller3 rabbitmq服务
# systemctl start rabbitmq-server
将controller2、controller3 与controller1组成集群
Controller2:
[root@controller2 ~]# rabbitmqctl stop_app Stopping node rabbit@controller2 ... [root@controller2 ~]# rabbitmqctl join_cluster rabbit@controller1 Clustering node rabbit@controller2 with rabbit@controller1 ... [root@controller2 ~]# rabbitmqctl start_app Starting node rabbit@controller2 ...
Controller3:
[root@controller3 ~]# rabbitmqctl stop_app Stopping node rabbit@controller3 ... [root@controller3 ~]# rabbitmqctl join_cluster rabbit@controller1 Clustering node rabbit@controller3 with rabbit@controller1 ... [root@controller3 ~]# rabbitmqctl start_app Starting node rabbit@controller3 …
在任意节点执行 rabbitmqctl cluster_status 查看集群
[root@controller1 ~]# rabbitmqctl cluster_status Cluster status of node rabbit@controller1 ... [{nodes,[{disc,[rabbit@controller1,rabbit@controller2,rabbit@controller3]}]}, {running_nodes,[rabbit@controller3,rabbit@controller2,rabbit@controller1]}, {cluster_name,<<"rabbit@controller1">>}, {partitions,[]}, {alarms,[{rabbit@controller3,[]}, {rabbit@controller2,[]}, {rabbit@controller1,[]}]}]
设置镜像队列
在任意一个节点上执行:
[root@controller1 rabbitmq]# rabbitmqctl set_policy ha-all '^(?!amq.).*' '{"ha-mode": "all"}' Setting policy "ha-all" for pattern "^(?!amq\.).*" to "{"ha-mode": "all"}" with priority "0" ... ...done.
将所有队列设置为镜像队列,即队列会被复制到各个节点,各个节点状态保持一致。
在rabbitmq中创建openstack用户
[root@controller1 rabbitmq]# rabbitmqctl add_user openstack openstack Creating user "openstack" ... ...done. [root@controller1 rabbitmq]# rabbitmqctl set_permissions openstack ".*" ".*" ".*" Setting permissions for user "openstack" in vhost "/" ... ...done.
到此,rabbitmq高可用搭建完毕。
在配置Mariadb-galera和rabbitmq监听地址的时候,rabbitmq配置监听地址尤其要注意,配置如下:
[root@controller1 ~]# chown rabbitmq:rabbitmq /etc/rabbitmq/rabbitmq-env.conf [root@controller1 ~]# systemctl restart rabbitmq-server [root@controller1 ~]# netstat -ntplu | egrep 5672 tcp 0 0 192.168.0.11:5672 0.0.0.0:* LISTEN 29644/beam.smp tcp 0 0 0.0.0.0:25672 0.0.0.0:* LISTEN 29644/beam.smp
rabbitmq-env.conf 说明:
RABBITMQ_NODE_IP_ADDRESS= //IP地址,空串bind所有地址,指定地址bind指定网络接口
RABBITMQ_NODE_PORT= //TCP端口号,默认是5672
RABBITMQ_NODENAME= //节点名称。默认是rabbit
RABBITMQ_CONFIG_FILE= //配置文件路径 ,即rabbitmq.config文件路径
RABBITMQ_MNESIA_BASE= //mnesia所在路径
RABBITMQ_LOG_BASE= //日志所在路径
RABBITMQ_PLUGINS_DIR= //插件所在路径