本文为《建立HA Openstack云》第五篇。第一篇:《建立高可用OpenStack云(一):安装集群》,第二篇:《建立高可用OpenStack云(二):安装Mysql》,第三篇:《建立HA Openstack云(三):安装RabbitMQ》,第四篇:《建立HA Openstack云 (四):安装Keystone》。
在Keystone教程里,我假定你已经安装了Glance并使用了。
与通常的设置不同的地方是:
·当设置/etc/glance/glance-api-paste.ini和/etc/glance/glance-registry-paste.ini时,记得也要编辑auth host:
service_protocol=http
service_host = clusterkeystone
service_port = 5000
auth_host = clusterkeystone
auth_port = 35357
auth_protocol = http
auth_uri = http://clusterkeystone:5000/
admin_tenant_name = service
admin_user = glance
admin_password = glance
”
·当设置/etc/glance/glance-registry.conf时,使用“clustermysql”作为MySQL主机
·在设置的最后,运行glance-manage version_control 0 和 glance-manage db_sync
·一定要安装curl,glance-registry资源代理没说但你需要它
现在我们要让Pacemaker在需要时运行glance,首先我们要停止glance服务并在启动时禁用,然后下载资源代理,在所有主机上做以下操作:
echo "manual" > /etc/init/glance-api.override
echo "manual" > /etc/init/glance-registry.override
service glance-api stop
service glance-registry stop
cd /usr/lib/ocf/resource.d/openstack/
wget https://raw.github.com/madkiss/glance/ha/tools/ocf/glance-api
wget https://raw.github.com/madkiss/glance/ha/tools/ocf/glance-registry
chmod u+x *
然后添加资源:
crm configure primitive glanceApiService ocf:openstack:glance-api
params config="/etc/glance/glance-api.conf" os_auth_url="http://clusterkeystone:5000/v2.0/" os_password="admin"
os_tenant_name="admin" os_username="admin" user="glance" client_binary="/usr/bin/glance"
op monitor interval="15s" timeout="30s"
crm configure primitive glanceRegistryService ocf:openstack:glance-registry
params config="/etc/glance/glance-registry.conf" os_auth_url="http://clusterkeystone:5000/v2.0/"
os_password="admin" os_tenant_name="admin" os_username="admin" user="glance"
op monitor interval="15s" timeout="30s"
现在pacemaker可以在我们的集群上运行Glance API and Registry了。
按惯例,分组并给Glance添加正确的命令:
group Glance glanceIP glanceApiService glanceRegistryService
crm configure order glance_after_keystone inf: Keystone Glance
我设置让Glance在Keystone之后运行,因为它依赖于那两者还有MySQL,因为Keystone在MySQL之后运行,你只能让它在Keystone之后运行。
这是由此产生的配置:
============
Last updated: Mon Jul 30 16:14:09 2012
Last change: Mon Jul 30 16:11:54 2012 via crm_attribute on server1
Stack: openais
Current DC: server1 – partition with quorum
Version: 1.1.6-9971ebba4494012a93c03b40a2c58ec0eb60f50c
2 Nodes configured, 2 expected votes
8 Resources configured.
============
Online: [ server1 server2 ]
mysqlmasterIP (ocf::heartbeat:IPaddr2): Started server1
Master/Slave Set: ms_MySQL [clustermysql]
Masters: [ server1 ]
Slaves: [ server2 ]
Resource Group: Keystone
keystoneIP (ocf::heartbeat:IPaddr2): Started server2
keystoneService (ocf::openstack:keystone): Started server2
Resource Group: Glance
glanceIP (ocf::heartbeat:IPaddr2): Started server1
glanceApiService (ocf::openstack:glance-api): Started server1
glanceRegistryService (ocf::openstack:glance-registry): Started server1