openstack搭建之-glance配置(17)
一、 base節點配置
#設置數據庫,創建glance數據庫,並設置權限
mysql -u root -proot
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‘;
二、 ctrl節點配置
#運行變量
. admin-openrc
#創建用戶glance、角色為admin
openstack user create --domain default --password GLANCE_PASS glance
openstack role add --project service --user glance admin
#創建glance服務並設置endpoint
openstack service create --name glance --description "OpenStack Image" image
openstack endpoint create --region RegionOne image public http://ctrl.test.com:9292
openstack endpoint create --region RegionOne image internal http://ctrl.test.com:9292
openstack endpoint create --region RegionOne image admin http://ctrl.test.com:9292
#安裝鏡像軟件並編輯glance-api配置文件
yum install openstack-glance -y
vim /etc/glance/glance-api.conf
[database]
connection = mysql+pymysql://glance:[email protected]/glance
[keystone_authtoken]
auth_uri = http://ctrl.test.com:5000
auth_url = http://ctrl.test.com:35357
memcached_servers = base.test.com:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = GLANCE_PASS
[paste_deploy]
flavor = keystone
[glance_store]
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
#編輯glance-registry的註冊配置文件
vim /etc/glance/glance-registry.conf
[database]
connection = mysql+pymysql://glance:[email protected]/glance
[keystone_authtoken]
auth_uri = http://ctrl.test.com:5000
auth_url = http://ctrl.test.com:35357
memcached_servers = base.test.com:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = GLANCE_PASS
[paste_deploy]
flavor = keystone
#初始化鏡像數據庫(21個數據表)
su -s /bin/sh -c "glance-manage db_sync" glance
#啟動服務
systemctl restart openstack-glance-api.service
systemctl restart openstack-glance-registry.service
systemctl enable openstack-glance-api.service
systemctl enable openstack-glance-registry.service
#運行變量
. admin-openrc
#下載鏡像
wget http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img
scp [email protected]:/var/lib/libvirt/image/chen.qcow2 /root/
openstack image create "cirros" \
--file cirros-0.3.5-x86_64-disk.img \
--disk-format qcow2 --container-format bare \
--public
openstack image create "chen" \
--file chen.qcow2 \
--disk-format qcow2 --container-format bare \
--public
#查看image鏡像:openstack image list
openstack搭建之-glance配置(17)