照著官網來安裝openstack pike之glance安裝
阿新 • • 發佈:2017-10-20
for 本地 net 文件系統 reg poi glance服務 來安 rate
鏡像服務image service(glance)的安裝還是在控制節點上進行:
1、前提條件,數據庫為glance創建庫和賬戶密碼來連接數據庫# mysql -u root -p MariaDB [(none)]> CREATE DATABASE glance; MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO ‘glance‘@‘localhost‘ IDENTIFIED BY ‘glance‘; MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO ‘glance‘@‘%‘IDENTIFIED BY ‘glance‘;
2、在為glance在keystone上創建用戶項目等時,需要先連接keystone,這裏使用keystone的admin賬號來登錄
# source admin-openrc
然後在創建glance用戶:
# openstack user create --domain default --password-prompt glance
輸入密碼:glance
將admin角色添加到glance用戶和service項目中:# openstack role add --project service --user glance admin
為glance創建服務實體:
# openstack service create --name glance --description "OpenStack Image" image
為鏡像服務創建API endpoints:
# openstack endpoint create --region RegionOne image public http://192.168.101.10:9292 # openstack endpoint create --region RegionOne image internal http://192.168.101.10:9292 # openstack endpoint create --region RegionOne image admin http://192.168.101.10:9292
安裝和配置glance:
# yum install openstack-glance
修改配置文件:/etc/glance/glance-api.conf,在[database]部分:
connection = mysql+pymysql://glance:[email protected]/glance
在[keystone_authtoken]和[paste_deploy]分別做如下設置:
[keystone_authtoken] auth_uri = http://192.168.101.10:5000 auth_url = http://192.168.101.10:35357 memcached_servers = 192.168.101.10:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = glance password = glance [paste_deploy] flavor = keystone
在[glance_store]部分設置一個本地文件系統用來存儲本地鏡像:
[glance_store] stores = file,http default_store = file filesystem_store_datadir = /var/lib/glance/images/
修改配置文件:/etc/glance/glance-registry.conf,在[database]配置數據庫的連接:
connection = mysql+pymysql://glance:[email protected]/glance
在[keystone_authtoken]和[paste_deploy]配置如下內容:
[keystone_authtoken] auth_uri = http://192.168.101.10:5000 auth_url = http://192.168.101.10:35357 memcached_servers = 192.168.101.10:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = glance password = glance [paste_deploy] flavor = keystone
向glance庫導入填充數據:
# su -s /bin/sh -c "glance-manage db_sync" glance
Ignore any deprecation messages in this output.
驗證glance是否有table? 最後開啟glance服務:# systemctl enable openstack-glance-api.service openstack-glance-registry.service # systemctl start openstack-glance-api.service openstack-glance-registry.service
校驗glance:校驗image service是否安裝成功?
# source admin-openrc # wget http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img # openstack image create "cirros" --file cirros-0.3.5-x86_64-disk.img --disk-format qcow2 --container-format bare --public
上傳鏡像到鏡像服務上,使用格式qcow2磁盤格式,權限為public,所有的項目都能訪問它
# openstack image list 查看鏡像列表
至此glance的image service組件安裝成功
貼出glance兩個配置文件的配置:
1、/etc/glance/glance-api.conf
[root@node1 ~]# egrep -v "^$|^#" /etc/glance/glance-api.conf [DEFAULT] [cors] [database] connection = mysql+pymysql://glance:[email protected]/glance [glance_store] stores = file,http default_store = file filesystem_store_datadir = /var/lib/glance/images/ [image_format] [keystone_authtoken] auth_uri = http://192.168.101.10:5000 auth_url = http://192.168.101.10:35357 memcached_servers = 192.168.101.10:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = glance password = glance [matchmaker_redis] [oslo_concurrency] [oslo_messaging_amqp] [oslo_messaging_kafka] [oslo_messaging_notifications] [oslo_messaging_rabbit] [oslo_messaging_zmq] [oslo_middleware] [oslo_policy] [paste_deploy] flavor = keystone [profiler] [store_type_location_strategy] [task] [taskflow_executor]
2、配置文件/etc/glance/glance-registry.conf
[root@node1 ~]# egrep -v "^$|^#" /etc/glance/glance-registry.conf [DEFAULT] [database] connection = mysql+pymysql://glance:[email protected]/glance [keystone_authtoken] auth_uri = http://192.168.101.10:5000 auth_url = http://192.168.101.10:35357 memcached_servers = 192.168.101.10:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = glance password = glance [matchmaker_redis] [oslo_messaging_amqp] [oslo_messaging_kafka] [oslo_messaging_notifications] [oslo_messaging_rabbit] [oslo_messaging_zmq] [oslo_policy] [paste_deploy] flavor = keystone [profiler]
照著官網來安裝openstack pike之glance安裝