首页 > 其他 > 详细

openstack controller ha测试环境搭建记录(七)——配置glance

时间:2015-12-14 19:05:00      阅读:460      评论:0      收藏:0      [点我收藏+]

在所有集群安装glance软件:
yum install -y openstack-glance python-glanceclient


在任一节点创建glance用户:
mysql -u root -p
CREATE DATABASE glance;
GRANT ALL PRIVILEGES ON glance.* TO ‘glance‘@‘localhost‘ IDENTIFIED BY ‘123456‘;
GRANT ALL PRIVILEGES ON glance.* TO ‘glance‘@‘%‘ IDENTIFIED BY ‘123456‘;
quit


在任一节点初始化glance的一系列表:
su -s /bin/sh -c "glance-manage db_sync" glance


在任一节点设置环境变量:
source admin-openrc.sh


在任一节点创建keystone中的相关用户、服务、endpoint等:
keystone user-create --name=glance --pass=123456
keystone user-role-add --user=glance --tenant=service --role=admin
keystone service-create --name=glance --type=image --description="OpenStack Image Service"
keystone endpoint-create \
  --service-id=$(keystone service-list | awk ‘/ image / {print $2}‘) \
  --publicurl=http://myvip:9292 \
  --internalurl=http://myvip:9292 \
  --adminurl=http://myvip:9292


在所有节点修改配置文件:
openstack-config --set /etc/glance/glance-api.conf database connection mysql://glance:123456@myvip/glance
openstack-config --set /etc/glance/glance-registry.conf database connection mysql://glance:123456@myvip/glance

openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_uri http://myvip:5000/v2.0
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_tenant_name service
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_user glance
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_password 123456
openstack-config --set /etc/glance/glance-api.conf paste_deploy flavor keystone
openstack-config --set /etc/glance/glance-api.conf DEFAULT notification_driver noop
openstack-config --set /etc/glance/glance-api.conf glance_store default_store file
openstack-config --set /etc/glance/glance-api.conf glance_store filesystem_store_datadirs /var/lib/glance/images/
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_uri http://myvip:5000/v2.0
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_tenant_name service
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_user glance
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_password 123456
openstack-config --set /etc/glance/glance-registry.conf paste_deploy flavor keystone
openstack-config --set /etc/glance/glance-registry.conf DEFAULT notification_driver noop

openstack-config --set /etc/glance/glance-api.conf DEFAULT rpc_backend rabbit
openstack-config --set /etc/glance/glance-api.conf DEFAULT rabbit_password 123456
openstack-config --set /etc/glance/glance-api.conf DEFAULT rabbit_hosts controller1:5672,controller2:5672,controller2:5673
openstack-config --set /etc/glance/glance-api.conf DEFAULT rabbit_retry_interval 1
openstack-config --set /etc/glance/glance-api.conf DEFAULT rabbit_retry_backoff 2
openstack-config --set /etc/glance/glance-api.conf DEFAULT rabbit_max_retries 0
openstack-config --set /etc/glance/glance-api.conf DEFAULT rabbit_durable_queues true
openstack-config --set /etc/glance/glance-api.conf DEFAULT rabbit_ha_queues true
openstack-config --set /etc/glance/glance-registry.conf DEFAULT rpc_backend rabbit
openstack-config --set /etc/glance/glance-registry.conf DEFAULT rabbit_password 123456
openstack-config --set /etc/glance/glance-registry.conf DEFAULT rabbit_hosts controller1:5672,controller2:5672,controller2:5673
openstack-config --set /etc/glance/glance-registry.conf DEFAULT rabbit_retry_interval 1
openstack-config --set /etc/glance/glance-registry.conf DEFAULT rabbit_retry_backoff 2
openstack-config --set /etc/glance/glance-registry.conf DEFAULT rabbit_max_retries 0
openstack-config --set /etc/glance/glance-registry.conf DEFAULT rabbit_durable_queues true
openstack-config --set /etc/glance/glance-registry.conf DEFAULT rabbit_ha_queues true

openstack-config --set /etc/glance/glance-api.conf DEFAULT bind_host $(hostname)
openstack-config --set /etc/glance/glance-registry.conf DEFAULT bind_host $(hostname)

疑问:/etc/glance/glance-api.conf中的filesystem_store_datadirs指向的是本地路径,是否有官方的说法来消除此问题。


在所有节点设置服务自动启动并启动服务:
systemctl enable openstack-glance-api.service
systemctl enable openstack-glance-registry.service
systemctl start openstack-glance-api.service
systemctl start openstack-glance-registry.service


修改haproxy的配置文件:
vi /etc/haproxy/haproxy.cfg

listen glance_api_cluster
    bind 10.0.0.10:9292
    balance source
    option tcpka
    option httpchk
    option tcplog
    server controller1 10.0.0.14:9292 check inter 2000 rise 2 fall 5
    server controller2 10.0.0.12:9292 check inter 2000 rise 2 fall 5
    server controller3 10.0.0.13:9292 check inter 2000 rise 2 fall 5

listen glance_registry_cluster
    bind 10.0.0.10:9191
    balance source
    option tcpka
    option tcplog
    server controller1 10.0.0.14:9191 check inter 2000 rise 2 fall 5
    server controller2 10.0.0.12:9191 check inter 2000 rise 2 fall 5
    server controller3 10.0.0.13:9191 check inter 2000 rise 2 fall 5


查看haproxy资源当前在哪个节点:
# crm_mon


重启haproxy服务:
systemctl restart haproxy.service
systemctl status -l haproxy.service

openstack controller ha测试环境搭建记录(七)——配置glance

原文:http://www.cnblogs.com/endoresu/p/5045952.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!