openstack搭建之镜像服务glance的安装之ceph版(四)

本地文件系统版本请参照:

openstack搭建之镜像服务glance的安装(四)<本地文件系统版本> - 运维术 (cnbugs.com)

以下所有操作均在controller节点完成

认证服务创建

创建glance数据库并配置权限

mysql -uroot -p000000
create database glance;
grant all privileges on glance.* to 'glance'@'%' identified by '000000';
grant all privileges on glance.* to 'glance'@'localhost' identified by '000000';
exit

创建glance服务的认证

source admin-openrc

创建用户

openstack user create --domain default --password-prompt glance

创建角色

openstack role add --project service --user glance admin

创建service entity和api endpoints:

openstack service create --name glance --description "OpenStack Image" image
openstack endpoint create --region RegionOne image public http://controller:9292
openstack endpoint create --region RegionOne image internal http://controller:9292
openstack endpoint create --region RegionOne image admin  http://controller:9292

安装glance服务

yum install -y openstack-glance  ceph-common

配置glance服务

mv /etc/glance/glance-api.conf /etc/glance/glance-api.conf_bak
cat>/etc/glance/glance-api.conf<<EOF
[DEFAULT]
show_image_direct_url = True
[cinder]
[cors]
[database]
connection = mysql+pymysql://glance:000000@controller/glance
[file]
[glance.store.http.store]
[glance.store.rbd.store]
[glance.store.sheepdog.store]
[glance.store.swift.store]
[glance.store.vmware_datastore.store]
[glance_store]
stores = rbd
default_store = rbd
rbd_store_pool = glance-images
rbd_store_user = glance
rbd_store_ceph_conf = /etc/ceph/ceph.conf
[image_format]
[keystone_authtoken]
www_authenticate_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = glance
password = 000000
[oslo_concurrency]
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_middleware]
[oslo_policy]
[paste_deploy]
flavor = keystone
[profiler]
[store_type_location_strategy]
[task]
[taskflow_executor]
EOF

复制ceph集群配置文件

从ceph1复制集群配置文件/etc/ceph/ceph.conf到/etc/glance/

scp  /etc/ceph/ceph.conf root@10.168.1.103:/etc/glance/ceph.conf

初始化数据库

su -s /bin/sh -c "glance-manage db_sync" glance

在ceph1节点获得ceph密钥

ceph auth get-or-create client.glance mon "allow r" osd 'allow class-read object_prefix rbd_children,allow rwx pool=images'

将获得的密钥保存

cat>/etc/glance/ceph.client.glance.keyring<<EOF
[client.glance]
        key = AQA1NwBlabNhBRAAdHxB4FySg8EgcEGoa7bOig==
EOF

启动glance服务并设开机启动

systemctl enable openstack-glance-api.service
systemctl start openstack-glance-api.service

查看服务状态

systemctl status openstack-glance-api.service

至此,glance服务告一段落。

发表评论

后才能评论