控制节点镜像服务
离线下载
bash
复制代码
apt install --download-only glance
mkdir /controller/glance
mv /var/cache/apt/archives/*.deb /controller/glance/
dpkg -i /controller/glance/*.deb
在一个控制节点操作
sql
复制代码
CREATE DATABASE glance;
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'GLANCE_DBPASS';
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'GLANCE_DBPASS';
FLUSH PRIVILEGES;
bash
复制代码
source ~/admin-openrc
openstack user create --domain default --password GLANCE_PASS glance
openstack role add --project service --user glance admin
openstack service create --name glance --description "OpenStack Image" image
openstack endpoint create --region RegionOne image public http://<VIP>:9292
openstack endpoint create --region RegionOne image internal http://<VIP>:9292
openstack endpoint create --region RegionOne image admin http://<VIP>:9292
在三个控制节点操作
确保文件在节点可用:
/etc/ceph/ceph.conf
/etc/ceph/client.glance.keyring
bash
复制代码
chown glance:glance /etc/ceph/ceph.client.glance.keyring
chmod 640 /etc/ceph/ceph.client.glance.keyring
bash
复制代码
vim /etc/glance/glance-api.conf
[database]
connection = mysql+pymysql://glance:GLANCE_DBPASS@<VIP>/glance
[keystone_authtoken]
www_authenticate_uri = http://<VIP>:5000
auth_url = http://<VIP>:5000
memcached_servers = ip1:11211,ip2:11211,ip3:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = glance
password = GLANCE_PASS
service_token_roles_required = true
service_token_roles = admin
region_name = RegionOne
[paste_deploy]
# 启用keystone认证
flavor = keystone
[glance_store]
# 指定后端类型:ceph块设备、url导入
stores = rbd,http
default_store = rbd
rbd_store_chunk_size = 8
# 存放镜像的pool
rbd_store_pool = images
# ceph授权的用户名
rbd_store_user = glance
# ceph的主配置文件路径
rbd_store_ceph_conf = /etc/ceph/ceph.conf
[DEFAULT]
# 本机IP,其余节点填对应IP
bind_host = ip1
bind_port = 9292
transport_url = rabbit://glance:GLANCE_PASS@ip1,ip2,ip3
[oslo_concurrency]
lock_path = /var/lib/glance/tmp
在一个控制节点操作
bash
复制代码
# 数据库同步
su -s /bin/sh -c "glance-manage db_sync" glance
在三个控制节点操作
bash
复制代码
systemctl start glance-api && systemctl enable glance-api
systemctl status glance-api
source ~/admin-openrc
openstack image list