glance部署及操作
?
注意部署時(shí)一定要集中精力,不要亂想一些七情六欲意淫一些亂七八糟的事,否則容易寫錯(cuò)配置文件
?一 部署glance
part 1:glance關(guān)于數(shù)據(jù)庫的操作
a.登錄數(shù)據(jù)庫;
mysql -u root -pb.創(chuàng)建glance數(shù)據(jù)庫;
CREATE DATABASE glance;c.新建本地訪問glance數(shù)據(jù)庫的賬號(hào);
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' \IDENTIFIED BY '123';d.新建遠(yuǎn)程訪問glance數(shù)據(jù)庫的賬號(hào)
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' \IDENTIFIED BY '123';
part 2:glance關(guān)于keystone的操作
a.執(zhí)行管理員腳本(腳本在上一篇keystone部署中)
source admin-openrcb.為glance的使用者創(chuàng)建用戶
openstack user create --domain default --password-prompt glancec.對(duì)glance-service添加role角色,提示:用戶glance只有在一個(gè)確定的項(xiàng)目service內(nèi)才有角色的概念,單獨(dú)的用戶或者單獨(dú)的項(xiàng)目都是無法綁定角色的。
openstack role add --project service --user glance admind.創(chuàng)建glance服務(wù)的catalog:service+endpoint
openstack service create --name glance \ --description "OpenStack Image" image?
openstack endpoint create --region RegionOne \image public http://192.168.1.109:9292 openstack endpoint create --region RegionOne \image internal http://192.168.1.109:9292 openstack endpoint create --region RegionOne \image admin http://192.168.1.109:9292part 3:安裝glance相關(guān)軟件包
yum -y install openstack-glancepart 4 :創(chuàng)建存儲(chǔ)設(shè)備
注意:
1.一定要在opesntack-glance-api.service服務(wù)啟動(dòng)之前部署好存儲(chǔ)設(shè)備,因?yàn)樵摲?wù)在啟動(dòng)時(shí)會(huì)加載存儲(chǔ)驅(qū)動(dòng)檢索存儲(chǔ)設(shè)備,如果事先不存在,就意味著該服務(wù)沒有識(shí)別到任何可用的存儲(chǔ)設(shè)備,即便是后來你又新增了存儲(chǔ),仍然是無效的,最終導(dǎo)致你上傳鏡像失敗;
2.一定要賦予opesntack-glance-api.service服務(wù)對(duì)存儲(chǔ)設(shè)備的可寫權(quán)限。
a.創(chuàng)建本地存儲(chǔ)
mkdir /var/lib/glance/imagesb.賦予對(duì)存儲(chǔ)設(shè)備的可寫權(quán)限
chown -R glance.glance /var/lib/glance/imagespart 5:配置/etc/glance/glance.conf
大前提:
每一條配置都應(yīng)該新增到文件中,一定不要打開注釋在原有的基礎(chǔ)上修改。請(qǐng)注意看圖!
?
a..配置/etc/glance/glance-api.conf
vim /etc/glance/glance-api.conf [database] connection = mysql+pymysql://glance:123@192.168.1.109/glance?
[keystone_authtoken] auth_uri = http://192.168.1.109:5000 auth_url = http://192.168.1.109:35357 memcached_servers = 192.168.1.109:11211 auth_type = password project_domain_name = Default user_domain_name = Default project_name = service username = glance password = 123?
[paste_deploy] flavor = keystone?
?
[glance_store] stores = file,http default_store = file filesystem_store_datadir = /var/lib/glance/images/?
b.配置/etc/glance/glance-registry.conf
vim /etc/glance/glance-registry.conf [database] connection = mysql+pymysql://glance:123@192.168.1.109/glance?
part 6: 初始化數(shù)據(jù)庫glance
su -s /bin/sh -c "glance-manage db_sync" glance?紅色框內(nèi)容乃正常性行為,忽略以下打印:
?
step 7:啟動(dòng)glance且設(shè)置開機(jī)啟動(dòng)
?a.設(shè)置glance開機(jī)自啟動(dòng)
systemctl enable openstack-glance-api.service \ openstack-glance-registry.serviceb.啟動(dòng)glance服務(wù)
systemctl start openstack-glance-api.service \ openstack-glance-registry.service?二 上傳鏡像進(jìn)行驗(yàn)證
a.執(zhí)行管理員腳本
source admin-openrcb.安裝wget命令
yum -y install wgetc.下載鏡像
wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.imgd.上傳鏡像
openstack image create "cirros" \--file cirros-0.3.4-x86_64-disk.img \--disk-format qcow2 --container-format bare \--public?e.查看鏡像(是否上傳成功)
openstack image list?
For information about the openstack image create parameters, see?Create or update an image (glance)?in the OpenStack User Guide.
For information about disk and container formats for images, see?Disk and container formats?for images in the OpenStack Virtual Machine Image Guide.
轉(zhuǎn)載于:https://www.cnblogs.com/hui520/p/6403328.html
總結(jié)
以上是生活随笔為你收集整理的glance部署及操作的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [转]MyBatis的foreach语句
- 下一篇: 《深入浅出MFC》第六章 MFC程序的生