Cinder的手工安裝與配置_第1頁
Cinder的手工安裝與配置_第2頁
Cinder的手工安裝與配置_第3頁
Cinder的手工安裝與配置_第4頁
Cinder的手工安裝與配置_第5頁
已閱讀5頁,還剩21頁未讀 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、OPENSTACK配置與管理項目式實訓任務(wù)八 Cinder的手工安裝與配置OPENSTACK配置與管理一任務(wù)前提環(huán)境:成功完成任務(wù)9中所有內(nèi)容后開始本實驗,或者從已完成任務(wù)9的鏡像開始,繼續(xù)完成本任務(wù)內(nèi)容。二任務(wù)涉及節(jié)點:controller和compute三任務(wù)目標:1.完成Cinder基本組件的安裝;2.完成Cinder數(shù)據(jù)庫的創(chuàng)建以及授權(quán);3.完成Cinder主配置文件的修改;4.完成Cinder安全與認證配置;5.完成Cinder用戶、租戶、角色以及服務(wù)端點的創(chuàng)建;6.完成Cinder邏輯卷創(chuàng)建。OPENSTACK配置與管理四任務(wù)步驟及其詳解: (此處有視頻:10-1Cinder的安裝

2、與配置)步驟一:在controller節(jié)點完成Cinder基本組件的安裝通過yum命令安裝controller節(jié)點Cinder服務(wù)所需要的依賴包,命令如下。rootcontroller # yum -y install openstack-cinder執(zhí)行上述安裝命令成功后,我們可以看到成功標志,如圖1所示。圖1 Cinder軟件包安裝完成的反饋結(jié)果OPENSTACK配置與管理步驟二:創(chuàng)建Cinder數(shù)據(jù)庫并授權(quán)首先,用root用戶登錄MySQL數(shù)據(jù)庫,命令如下。rootcontroller # mysql -uroot -p000000登陸后,我們首先創(chuàng)建Cinder數(shù)據(jù)庫,命令如下。mys

3、qlCREATE DATABASE cinder;看到提示Query OK, 1 row affected (0.00 sec),表明數(shù)據(jù)庫創(chuàng)建成功。接著創(chuàng)建MySQL的Cinder用戶,并賦予其Cinder數(shù)據(jù)庫的操作權(quán)限,命令如下。mysql GRANT ALL PRIVILEGES ON cinder.* TO cinderlocalhost IDENTIFIED BY 000000;mysql GRANT ALL PRIVILEGES ON cinder.* TO cinder% IDENTIFIED BY 000000;mysql exitOPENSTACK配置與管理上述SQL語句與

4、創(chuàng)建Keystone數(shù)據(jù)庫的語句一致,請參考任務(wù)4中第四小節(jié)“任務(wù)步驟及其詳解”的步驟二“創(chuàng)建Keystone數(shù)據(jù)庫并授權(quán)”部分對創(chuàng)建數(shù)據(jù)庫時SQL語句的說明,在此不做贅述。然后,我們需要為Cinder服務(wù)創(chuàng)建數(shù)據(jù)庫表。與其他OpenStack組件一樣,在創(chuàng)建數(shù)據(jù)庫表之前,需要先修改Cinder配置文件中用于數(shù)據(jù)庫連接的內(nèi)容,命令如下。rootcontroller # openstack-config -set /etc/cinder/cinder.conf database connection mysql:/cinder:000000controller/cinder同樣,我們也可以通過v

5、i/vim編輯器,編輯/etc/cinder/cinder.conf文件中database字段與數(shù)據(jù)庫連接的內(nèi)容,以達到相同效果,編輯時請注意語法格式。OPENSTACK配置與管理我們需要同步數(shù)據(jù)庫,為Cinder服務(wù)創(chuàng)建數(shù)據(jù)庫表,命令如下。rootcontroller # su -s /bin/sh -c cinder-manage db sync cinder與前面幾個組件一樣,我們也可以通過一條SQL命令來查看同步后創(chuàng)建的表,命令如下,結(jié)果如圖2所示。rootcontroller # mysql -u root -p000000 -e use cinder;show tables;圖2查

6、看數(shù)據(jù)庫同步的反饋結(jié)果OPENSTACK配置與管理步驟三:注冊Cinder服務(wù)至Keystone服務(wù)器前面章節(jié)中我們介紹過,在OpenStack中,幾乎所有的服務(wù)(包括Keystone服務(wù))要想正常運行,都必須首先向Keystone服務(wù)器注冊。每一個服務(wù)需要向Keystone注冊以下兩個方面的信息,即用戶信息,服務(wù)(service)和端點(endpoint)信息。首先,我們注冊Cinder用戶信息,注冊用戶信息的目的是為了認證用戶身份的,這在前面章節(jié)已經(jīng)講過?,F(xiàn)在我們添加Cinder用戶,并為用戶設(shè)置密碼,在本書實訓過程中我們所有的密碼統(tǒng)一使用000000,命令如下,結(jié)果如圖3所示。rootc

7、ontroller # keystone user-create -name=cinder -pass=000000圖3 創(chuàng)建Cinder用戶的反饋結(jié)果OPENSTACK配置與管理本書所有的服務(wù)都創(chuàng)建在service租戶下。因此,Cinder用戶必須在service租戶下具有admin權(quán)限。下面,再為Cinder用戶在service租戶下分配admin權(quán)限,命令如下。rootcontroller # keystone user-role-add -user=cinder -tenant=service -role=admin上述命令用法在第六章任務(wù)4步驟七中已經(jīng)提到,在這里不在贅述。接下來,我

8、們注冊Cinder服務(wù)(service)和端點(endpoint)信息,注冊服務(wù)和端點的信息目的是為了確保用戶能夠順利訪問Cinder服務(wù),并執(zhí)行一系列與Cinder服務(wù)有關(guān)的操作,前面已經(jīng)說過。這里需要注意的是,Cinder與其他服務(wù)不同,Cinder的服務(wù)和端點是兩個版本并存的,所以,我們在進行Cinder服務(wù)和端點信息的注冊操作時需要將兩個版本的相關(guān)信息分別注冊,命令如下,版本1即v1的結(jié)果如圖4和5所示,版本2即v2的結(jié)果如圖6和7所示。OPENSTACK配置與管理rootcontroller # keystone service-create -name=cinder -type=v

9、olume -description=OpenStack Block Storage圖4創(chuàng)建Cinder版本1服務(wù)的反饋結(jié)果rootcontroller # keystone endpoint-create -service-id=$(keystone service-list | awk / volume / print $2) -publicurl=http:/controller:8776/v1/%(tenant_id)s -internalurl=http:/controller:8776/v1/%(tenant_id)s -adminurl=http:/controller:8776

10、/v1/%(tenant_id)s圖5 創(chuàng)建Cinder版本1的endpoint的反饋結(jié)果(此處有視頻:10-2Cinder的安裝與配置)OPENSTACK配置與管理rootcontroller # keystone service-create -name=cinderv2 -type=volumev2 -description=OpenStack Block Storage v2圖6創(chuàng)建Cinder版本2服務(wù)的反饋結(jié)果rootcontroller # keystone endpoint-create -service-id=$(keystone service-list | awk / v

11、olumev2 / print $2) -publicurl=http:/controller:8776/v2/%(tenant_id)s -internalurl=http:/controller:8776/v2/%(tenant_id)s -adminurl=http:/controller:8776/v2/%(tenant_id)s圖7 創(chuàng)建Cinder版本2的endpoint的反饋結(jié)果OPENSTACK配置與管理步驟四:配置Cinder使用消息隊列服務(wù)消息隊列我們?nèi)匀皇褂肣pid隊列,可以通過如下命令配置controller節(jié)點及compute節(jié)點的Cinder的消息隊列。rootco

12、ntroller # openstack-config -set /etc/cinder/cinder.conf DEFAULT rpc_backend mon.rpc.impl_qpidrootcontroller # openstack-config -set /etc/cinder/cinder.conf DEFAULT qpid_hostname controller上述命令在第八章任務(wù)5步驟四中講解過,這里不再贅述。OPENSTACK配置與管理步驟五:修改Cinder的配置文件與前面章節(jié)一樣,完成 Cinder用戶信息、服務(wù)和端點信息的注冊后,為了能讓Cinder服務(wù)順利通過Keys

13、tone的認證,我們需要在配置文件/etc/cinder/cinder.conf中記錄Keystone的認證信息,即在配置文件的keystone_authtoken字段中修改Keystone的相關(guān)身份認證信息,同時在DEFAULT字段中添加Keystone支持。命令如下。rootcontroller # openstack-config -set /etc/cinder/cinder.conf DEFAULT auth_strategy keystonerootcontroller # openstack-config -set /etc/cinder/cinder.conf keystone

14、_authtoken auth_uri http:/controller:5000rootcontroller # openstack-config -set /etc/cinder/cinder.conf keystone_authtoken auth_host controllerOPENSTACK配置與管理rootcontroller # openstack-config -set /etc/cinder/cinder.conf keystone_authtoken auth_protocol httprootcontroller # openstack-config -set /etc

15、/cinder/cinder.conf keystone_authtoken auth_port 35357rootcontroller # openstack-config -set /etc/cinder/cinder.conf keystone_authtoken admin_user cinderrootcontroller # openstack-config -set /etc/cinder/cinder.conf keystone_authtoken admin_tenant_name servicerootcontroller # openstack-config -set /

16、etc/cinder/cinder.conf keystone_authtoken admin_password 000000OPENSTACK配置與管理對于上述命令,我們也可以通過vi/vim直接編輯配置文件/etc/cinder/cinder.conf,在相應(yīng)的地方做上述內(nèi)容的修改,以達到相同的效果。修改完成后使用grep命令過濾/etc/cinder/cinder.conf文件中的內(nèi)容,來檢查已完成的配置。命令和結(jié)果如下所示。rootcontroller # grep a-z, /etc/cinder/cinder.confDEFAULTauth_strategy = keystoner

17、pc_backend = mon.rpc.impl_qpidqpid_hostname = controlleriscsi_helper=tgtadmOPENSTACK配置與管理BRCD_FABRIC_EXAMPLEdatabaseconnection = mysql:/cinder:000000controller/cinderfc-zone-managerkeymgrkeystone_authtokenauth_uri = http:/controller:5000auth_host = controllerauth_protocol = httpauth_port = 35357admi

18、n_user = cinderadmin_tenant_name = serviceadmin_password = 000000matchmaker_redismatchmaker_ringsslOPENSTACK配置與管理步驟六:啟動服務(wù)并將其加入開機自啟在controller節(jié)點啟動openstack-cinder-api和openstack-cinder-scheduler服務(wù)并設(shè)置為開機自動啟動,命令如下。rootcontroller # service openstack-cinder-api startrootcontroller # service openstack-cind

19、er-scheduler startrootcontroller # chkconfig openstack-cinder-api onrootcontroller # chkconfig openstack-cinder-scheduler onOPENSTACK配置與管理步驟七:在compute節(jié)點安裝Cinder軟件包通過yum命令安裝compute節(jié)點Cinder服務(wù)所需要的依賴包,命令如下。(此處有視頻:10-3Cinder的安裝及其配置)rootcompute # yum -y install openstack-cinder scsi-target-utils openstack

20、-utilsOPENSTACK配置與管理步驟八:創(chuàng)建LVM物理卷和cinder-volumes卷組將事先創(chuàng)建好的分區(qū)初始化為LVM物理卷,本書采用的是sda2分區(qū),命令如下。rootcompute # pvcreate /dev/sda2使用vgcreate命令創(chuàng)建cinder-volumes卷組,命令如下。rootcompute # vgcreate cinder-volumes /dev/sda2OPENSTACK配置與管理步驟九:在compute節(jié)點修改Cinder配置文件我們可以通過openstack-config命令配置Cinder與數(shù)據(jù)庫的連接,命令如下。rootcompute #

21、 openstack-config -set /etc/cinder/cinder.conf database connection mysql:/cinder:000000controller/cinder修改DEFAULT段落和keystone_authtoken段落中Keystone相關(guān)認證信息命令如下。rootcompute # openstack-config -set /etc/cinder/cinder.conf DEFAULT auth_strategy keystonerootcompute # openstack-config -set /etc/cinder/cinder

22、.conf keystone_authtoken auth_uri http:/controller:5000rootcompute # openstack-config -set /etc/cinder/cinder.conf keystone_authtoken auth_host controllerOPENSTACK配置與管理rootcompute # openstack-config -set /etc/cinder/cinder.conf keystone_authtoken auth_protocol httprootcompute # openstack-config -set

23、 /etc/cinder/cinder.conf keystone_authtoken auth_port 35357rootcompute # openstack-config -set /etc/cinder/cinder.conf keystone_authtoken admin_user cinderrootcompute # openstack-config -set /etc/cinder/cinder.conf keystone_authtoken admin_tenant_name servicerootcompute # openstack-config -set /etc/

24、cinder/cinder.conf keystone_authtoken admin_password 000000OPENSTACK配置與管理在DEFAULT段落中修改消息隊列服務(wù)相關(guān)信息,命令如下。root compute # openstack-config -set /etc/cinder/cinder.conf DEFAULT rpc_backend mon.rpc.impl_qpidrootcompute# openstack-config -set /etc/cinder/cinder.conf DEFAULT qpid_hostname controller在DEFAULT段落中修改glance服務(wù)的主機名為controller節(jié)點,命令如下。rootcompute # openstack-config -set /etc/cinder/cinder.conf DEFAULT glance_host controllerOPENSTACK配置與管理步驟十:在compute節(jié)點配置target目錄為/etc/cinder/volumes/*,命令如下。rootcompute # echo include /etc/cinder/

溫馨提示

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

評論

0/150

提交評論