OpenStack組件-Glance鏡像服務_第1頁
OpenStack組件-Glance鏡像服務_第2頁
已閱讀5頁,還剩5頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、OpenStackGlance鏡像服務Glance是Openstack項中負責鏡像管理的模塊,其功能包括虛擬機鏡像的查找、注冊和檢索等。 Glance提供RestfulAPI可以查詢虛擬機鏡像的metadata及獲取鏡像。 Glance可以將鏡像保存到多種后端存儲上,如簡單的件存儲或者對象存儲。1)在傳統(tǒng) IT 環(huán)境下,安裝個系統(tǒng)要么從安裝 CD 從頭安裝,要么 Ghost 等克隆具恢復。這兩種式有如下個問題:(1)如果要安裝的系統(tǒng)多了效率就很低(2)時間長,作量(3)安裝完還要進配置,如安裝其他的軟件,設置 IP 等(4)備份和恢復系統(tǒng)不靈活2)云環(huán)境下需要更效的案,這就是 Image。 I

2、mage 是個模板,包含了基本的操作系統(tǒng)和其他的軟件。舉例來說,有家公司需要為每位員配置套辦公的系統(tǒng),般需要個 Windows系統(tǒng)再加 office 軟件。 OpenStack 是這么做的:(1)先安裝好這么個虛機(2)然后對虛機執(zhí) snapshot,這樣就得到了個 image(3)當有新員職需要辦公環(huán)境時,馬啟動個或多個該 image 的 instance(虛機)就可以了在這個過程中,第 1 步跟傳統(tǒng)式類似,需要操作和定時間,但第 2、3 步常快,全動化,般都是秒級別。且 2、3步可以循環(huán)做。 如公司新上了套 OA 系統(tǒng),每個員的 PC 上都得有客戶端軟件。 那么可以在某個現(xiàn)有虛機中先安裝好

3、 OA 客戶端,然后執(zhí) snapshot 操作,得到新的 image,以后可以就直接使新 image 創(chuàng)建虛機了。另外,snapshot 還有備份的作,能夠常便的恢復系統(tǒng)。3)Image Service 的功能是管理 Image,讓戶能夠發(fā)現(xiàn)、獲取和保存 Image。在 OpenStack 中,提供 Image Service 的是Glance,其具體功能如下:(1)提供 REST API讓戶能夠查詢和獲取 image 的元數(shù)據和 image 本(2)持多種式存儲 image,包括普通的件系統(tǒng)、Swift、Amazon S3 等(3)對 Instance 執(zhí) Snapshot 創(chuàng)建新的 ima

4、ge4)glance架構(1)glance-apiglance-api 是系統(tǒng)后臺運的服務進程。 對外提供 REST API,響應 image 查詢、獲取和存儲的調。glance-api 不會真正處理請求。 如果操作是與 image metadata(元數(shù)據)相關,glance-api會把請求轉發(fā)給glance-registry; 如果操作是與 image 存取相關,glance-api會把請求轉發(fā)給該 image 的 store backend。在控制節(jié)點上可以查看glance-api 與進程ps aux | grep glance-apiglance 7394 1.5 2.8 392164

5、 81780 ?glance 7414 0.0 2.8 399992 82164 ?glance 7415 0.0 2.8 400524 83012 ?Ss 11:55 2:13 /usr/bin/python2 /usr/bin/glance-apiSS11:55 0:00 /usr/bin/python2 /usr/bin/glance-api11:55 0:00 /usr/bin/python2 /usr/bin/glance-apiroot10501 0.0 0.0 112664 972 pts/0 S+ 14:19 0:00 grep -color=auto glance-api(2

6、)glance-registryglance-registry 是系統(tǒng)后臺運的服務進程。 負責處理和存取 image 的 metadata,例如 image 的和類型。在控制節(jié)點上可以查看glance-registry 進程ps aux | grep glance-registryglance 7395 0.0 2.4 350724 72232 ?glance 7412 0.0 2.3 350724 67444 ?glance 7413 0.0 2.3 350724 67444 ?Ss 11:55 0:01 /usr/bin/python2 /usr/bin/glance-registrySS

7、11:55 0:00 /usr/bin/python2 /usr/bin/glance-registry11:55 0:00 /usr/bin/python2 /usr/bin/glance-registryroot10538 0.0 0.0 112664 976 pts/0 S+ 14:20 0:00 grep -color=auto glance-registry(3)Glance 持多種格式的 image,包括(4)DatabaseImage 的 metadata 會保持到 database 中,默認是 MySQL。 在控制節(jié)點上可以查看 glance 的 database 信息(5)S

8、tore backendGlance 并不存儲 image。 真正的 image 是存放在 backend 中的。 Glance 持多種 backend,包括:A directory on a local file system(這是默認配置)GridFSCeph RBDAmazon S3SheepdogOpenStack Block Storage (Cinder)OpenStack Object Storage (Swift)VMware ESX具體使哪種 backend,是在 /etc/glance/glance-api.conf 中配置的。3.glance服務搭建1)條件準備(1)準備

9、數(shù)據庫create database glance;grant all privileges on glance.* to glancelocalhost identified by ;grant all privileges on glance.* to glance% identified by ;(2)登錄openstacksource openrc(3)創(chuàng)建戶、服務創(chuàng)建戶openstack user create -domain default -password=glance glance+-+-+| Field| Value|+-+-+| domain_id| enabled| i

10、d| default| True| 394ed512341541fa827181877505ef4a | name| glance| | options| password_expires_at | None|+-+-+openstack user list+-+-+| ID| Name |+-+-+| 394ed512341541fa827181877505ef4a | glance | cd9ce1eb589b445e9b98c53a36bdc8d8 | admin | e880cc125bb541128c9bc47233d91732 | demo |+-+-+將glance戶設置為adm

11、inopenstack role add -project service -user glance admin創(chuàng)建glance服務openstack service create -name glance -description OpenStack Image image+-+-+| Field| Value|+-+-+| description | OpenStack Image| enabled | True| id| d533cf98bd2f41f8958c2eadbad5d34f | name| type| glance| image|+-+-+(4)創(chuàng)建鏡像服務API的endpo

12、intsopenstack endpoint create -region RegionOne image public http:/node1:9292+-+-+| Field| Value|+-+-+| enabled| id| True| dcc9722a128a43a58f23eb1e9c368292 | interface | public| region| RegionOne| region_id | RegionOne| service_id | d533cf98bd2f41f8958c2eadbad5d34f | service_name | glance| service_t

13、ype | image| url| http:/node1:9292|+-+-+openstack endpoint create -region RegionOne image internal http:/node1:9292+-+-+| Field| Value|+-+-+| enabled| id| True| 3b48b8b801d1486988efed0059faa6ac | interface | internal| region| RegionOne| region_id | RegionOne| service_id | d533cf98bd2f41f8958c2eadbad

14、5d34f | service_name | glance| service_type | image| url| http:/node1:9292|+-+-+openstack endpoint create -region RegionOne image admin http:/node1:9292+-+-+| Field| Value|+-+-+| enabled| id| True| 53eeb5d0e431444eb47de36a77ce04cb | interface | admin| region| RegionOne| region_id | RegionOne| servic

15、e_id | d533cf98bd2f41f8958c2eadbad5d34f | service_name | glance| service_type | image| url| http:/node1:9292|+-+-+2)安裝和配置glance服務(1)安裝軟件包yum install openstack-glance -y(2)修改配置件vim /etc/glance/glance-api.confdatabaseconnection = mysql+pymysql:/glance:GLANCE_DBPASSnode1/glance.keystone_authtokenauth_u

16、ri = http:/node1:5000auth_url = http:/node1:35357memcached_servers = node1:11211auth_type = passwordproject_domain_name = defaultuser_domain_name = defaultproject_name = serviceusername = glancepassword = GLANCE_PASS.paste_deployflavor = keystone.glance_storestores = file,httpdefault_store = filefil

17、esystem_store_datadir = /var/lib/glance/images/vim /etc/glance/glance-registry.confdatabaseconnection = mysql+pymysql:/glance:GLANCE_DBPASSnode1/glance.keystone_authtokenauth_uri = http:/node1:5000auth_url = http:/node1:35357memcached_servers = node1:11211auth_type = passwordproject_domain_name = de

18、faultuser_domain_name = defaultproject_name = serviceusername = glancepassword = GLANCE_PASS. . .paste_deployflavor = keystone或者可以如下法cd /etc/glance/cp glance-api.conf glance-api.conf.bak -acp glance-registry.conf glance-registry.conf.bak -avim glance-api.confDEFAULTcorscors.subdomaindatabaseconnecti

19、on = mysql+pymysql:/glance:GLANCE_DBPASSnode1/glanceglance_storestores = file,httpdefault_store = filefilesystem_store_datadir = /var/lib/glance/images/image_formatkeystone_authtokenauth_uri = http:/node1:5000auth_url = http:/node1:35357memcached_servers = node1:11211auth_type = passwordproject_doma

20、in_name = defaultuser_domain_name = defaultproject_name = serviceusername = glancepassword = glancematchmaker_redisoslo_concurrencyoslo_messaging_amqposlo_messaging_kafkaoslo_messaging_notificationsoslo_messaging_rabbitoslo_messaging_zmqoslo_middlewareoslo_policypaste_deployflavor = keystoneprofiler

21、store_type_location_strategytasktaskflow_executorvim glance-registry.confDEFAULTdatabaseconnection = mysql+pymysql:/glance:GLANCE_DBPASSnode1/glancekeystone_authtokenauth_uri = http:/node1:5000auth_url = http:/node1:35357memcached_servers = node1:11211auth_type = passwordproject_domain_name = defaul

22、tuser_domain_name = defaultproject_name = serviceusername = glancepassword = glancematchmaker_redisoslo_messaging_amqposlo_messaging_kafkaoslo_messaging_notificationsoslo_messaging_rabbitoslo_messaging_zmqoslo_policypaste_deployflavor = keystoneprofilerView Code(3)同步數(shù)據庫su -s /bin/sh -c glance-manage db_sync glance(4)設置開機啟systemctl restart openstack-glance-api.service openstack-glance-registry.servicesystemctl enable openstack-glance-api.service openstack-glance-registry.service3)導鏡像進驗證(1)下載鏡像wget /0.3.5/cirros-0.3.5-x86_64-disk.img(2)上傳鏡像openstack image create cirrors -file cirr

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論