版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
云基礎(chǔ)架構(gòu)平臺運(yùn)維模塊簡介進(jìn)一步熟悉平臺中的各種云服務(wù)組件,如云基礎(chǔ)服務(wù)組件、存儲服務(wù)組件和高級服務(wù)組件,掌握云服務(wù)組件的運(yùn)維、管理和排錯(cuò)方法,熟練應(yīng)用和管理OpenStack云平臺。模塊知識(1)掌握云服務(wù)組件基礎(chǔ)運(yùn)維技能。(2)具備云服務(wù)組件的運(yùn)維、管理和排錯(cuò)的綜合能力。(3)掌握更多高級服務(wù)組件的運(yùn)維方法。環(huán)境準(zhǔn)備云基礎(chǔ)服務(wù)組件運(yùn)維管理已部署完成的OpenStack集群環(huán)境或AllInOne環(huán)境。存儲服務(wù)組件運(yùn)維管理已部署完成的OpenStack集群環(huán)境或AllInOne環(huán)境。高級服務(wù)組件運(yùn)維管理已部署完成的OpenStack集群環(huán)境或AllInOne環(huán)境。模塊內(nèi)容實(shí)戰(zhàn)案例——云基礎(chǔ)服務(wù)組件運(yùn)維管理云基礎(chǔ)服務(wù)組件運(yùn)維管理涉及Keystone認(rèn)證服務(wù)運(yùn)維管理、Glance鏡像服務(wù)運(yùn)維管理、Neutron網(wǎng)絡(luò)服務(wù)運(yùn)維管理和Nova計(jì)算服務(wù)運(yùn)維管理。Keystone認(rèn)證服務(wù)運(yùn)維管理云平臺上有兩個(gè)租戶,租戶A和租戶B,他們分別屬于兩個(gè)部門,該公司對鏡像管理比較嚴(yán)格,只有管理員有權(quán)限對鏡像進(jìn)行上傳和管理。但公司有一個(gè)鏡像需要共享給租戶A,而對租戶B為不可見。要實(shí)現(xiàn)這樣的資源隔離最簡單的方法就是由租戶A中的用戶自行上傳鏡像,這樣租戶A中的用戶就能看到這個(gè)鏡像,而租戶B中的用戶是看不到的。但由于租戶A中的用戶是普通用戶,無權(quán)管理鏡像,只能由管理員通過命令開放給租戶A才能得以實(shí)現(xiàn)。接下來通過如下步驟實(shí)現(xiàn)上述目標(biāo)。(1)創(chuàng)建租戶創(chuàng)建租戶A,命令如下所示。#openstackprojectcreate--domaindefaultA#openstackprojectcreate--domaindefaultA創(chuàng)建租戶B,命令如下所示。#openstackprojectcreate--domaindefaultB#openstackprojectcreate--domaindefaultB(2)創(chuàng)建用戶創(chuàng)建普通用戶userA,密碼為123456,命令如下所示。#openstackusercreate--domaindefault--password123456userA#openstackusercreate--domaindefault--password123456userA創(chuàng)建普通用戶userB,密碼為123456,命令如下所示。#openstackusercreate--domaindefault--password123456userB#openstackusercreate--domaindefault--password123456userB(3)賦予角色將用戶userA分配到租戶A中,賦予用戶userA以member的角色,命令如下所示。#openstackroleadd--projectA--useruserAmember#openstackroleadd--projectA--useruserAmember將用戶userB分配到租戶B中,賦予用戶userB以member的角色,命令如下所示。#openstackroleadd--projectB--useruserBmember#openstackroleadd--projectB--useruserBmember使用命令查詢租戶列表信息和用戶列表信息,命令及結(jié)果如下所示。++---------------------------------------------+----------+||||002279a051e7467a9abfcd6807effd71|admin… … …|67e2ed4906b84d06b7cbb56ff22a190e|userA|b0ae165b5a6f4037a5a64962bf00e7b9|userB|c9f4c50ba58045929a90572f5701d7e9|service |+---------------------------------------------+-------------+#openstackuserlist+---------------------------------------------+----------+|ID |Name |+---------------------------------------------+----------+||||92dec96a7ff14ff5a73ff70943df7fc3 |B#openstackprojectlist+---------------------------------------------+------------+|ID |Name |+---------------------------------------------+------------+|06267a21b9494e31b2e30b1ee5f0fdc8|admin|23edd9dbe4b94befbb8d5477e52b352f|A通過上面的操作可以看到兩個(gè)租戶和兩個(gè)用戶都已存在。(4)上傳鏡像將cirros-0.6.1-x86_64-disk.img下載至控制節(jié)點(diǎn)的/root目錄下,命令如下所示。#openstackimagecreate--disk-formatqcow2\#openstackimagecreate--disk-formatqcow2\--container-formatbare\--progress--filecirros-0.6.1-x86_64-disk.img"cirros-0.6.1"#openstackimagelist+--------------------------------------------------+--------------+--------+|ID |Name |Status|+--------------------------------------------------+--------------+--------+|24d60cc1-9396-47d3-bc54-5c31bf092c4d|cirros-0.6.1|active|+--------------------------------------------------+--------------+--------+和userB都不能看到該鏡像。接下來做相關(guān)配置,使得A租戶中的用戶可以看到該鏡像。(5)權(quán)限配置首先將鏡像共享給A租戶,命令格式為openstackimageaddproject<imagenameorID><projectnameorID>,命令如下所示。#openstackimageaddprojectcirros-0.6.1A#openstackimageaddprojectcirros-0.6.1A在共享之后,鏡像的狀態(tài)是Pending狀態(tài),此時(shí)還需要激活鏡像,命令如下所示。#openstackimagesetcirros-0.6.1--projectA--accept#openstackimagesetcirros-0.6.1--projectA--accept#openstackimagememberlistcirros-0.6.1此時(shí)鏡像的狀態(tài)變?yōu)锳ccepted,切換至用戶userA和用戶userB中,分別查看鏡像列表信息,命令如下所示。#exportOS_PROJECT_NAME=A#exportOS_PROJECT_NAME=A#exportOS_USERNAME=userA#exportOS_PASSWORD=123456#glanceimage-list+-------------------------------------------------+--------------+| ID | Name|+--------------------------------------------------+--------------+|24d60cc1-9396-47d3-bc54-5c31bf092c4d|cirros-0.6.1|+--------------------------------------------------+--------------+#exportOS_PROJECT_NAME=B#exportOS_USERNAME=userB#exportOS_PASSWORD=123456#glanceimage-list+----+------+|ID|Name|+----+------++----+------+可以發(fā)現(xiàn),用戶userA可查詢到該鏡像,用戶userB不可以。通過這種方式,可以使管理員設(shè)置不同租戶對不同鏡像或文件資源的訪問權(quán)限,實(shí)現(xiàn)資源隔離。Glance鏡像服務(wù)運(yùn)維管理(1)上傳鏡像并創(chuàng)建名為openEuler-22.09、格式為qcow2的鏡像,命令和結(jié)果如下所示。#wget/openeuler/openEuler-#wget/openeuler/openEuler-22.09/virtual_machine_img/x86_64/openEuler-22.09-x86_64.qcow2.xz#xz-dopenEuler-22.09-x86_64.qcow2.xz#openstackimagecreate--disk-formatqcow2\--container-formatbare\--progress--fileopenEuler-22.09-x86_64.qcow2\"openEuler-22.09"(2)查看鏡像列表使用相關(guān)命令查詢鏡像列表,并查詢openEuler-22.09鏡像的詳細(xì)信息,命令如下所示。#openstackimagelist#openstackimagelist+-----------------------------------------------------------------+-----------------+---------------+| ID | Name | Status |+-----------------------------------------------------------------+-----------------+---------------+| 7f200158-bd9b-4e87-88fd-8042b21f198b | openEuler-22.09| active |+-----------------------------------------------------------------+-----------------+---------------+(3)刪除鏡像使用相關(guān)命令刪除剛剛創(chuàng)建的鏡像,命令如下所示。#openstackimagedelete7f200158-bd9b-4e87-88fd-8042b21f198b#openstackimagedelete7f200158-bd9b-4e87-88fd-8042b21f198bNeutron網(wǎng)絡(luò)服務(wù)運(yùn)維管理(1)創(chuàng)建網(wǎng)絡(luò)使用OpenStack相關(guān)命令創(chuàng)建名稱為neutron-test的網(wǎng)絡(luò),命令如下所示。#openstacknetworkcreateneutron-test#openstacknetworkcreateneutron-test(2)網(wǎng)絡(luò)列表使用相關(guān)命令查詢所創(chuàng)建網(wǎng)絡(luò)的列表信息,命令和結(jié)果如下所示。#openstacknetworklist#openstacknetworklist+--------------------------------------------------+---------------+----------+|ID |Name|Subnets|+--------------------------------------------------+---------------+----------+|5340f2e8-1227-4d53-94db-abd3de11d7f8|neutron-test| |+--------------------------------------------------+---------------+----------+(3)刪除網(wǎng)絡(luò)使用相關(guān)命令刪除上一步創(chuàng)建的網(wǎng)絡(luò),并進(jìn)行驗(yàn)證,命令和結(jié)果如下所示。#openstacknetworkdeleteneutron-test#openstacknetworkdeleteneutron-test#openstacknetworklist此處并沒有返回值,表示網(wǎng)絡(luò)已經(jīng)被刪除。(4)創(chuàng)建路由使用相關(guān)命令創(chuàng)建一個(gè)名為route-test的路由,查看路由列表之后便刪除,命令如下所示。#openstackroutercreateroute-test#openstackroutercreateroute-test#openstackrouterlist#openstackrouterdelete[routeID]+----------------------------+---------+-------------++----------------------------+---------+-------------+--------+-----------------+-------+--------+#openstackrouterdelete2e16a07f-6627-409a-aedf-d8794589f4b3#openstackrouterlistFalse||06267a21b9494e31b2e30blee5f0fdc8UPACTIVE ||route-test ||True| 2e16a07f-6627-409a-aedf-d8794589f4b3|+----------------------------+---------+-------------+--------+-----------------+-------+--------+| Status | Sstate | Project| Distributed| HANameID |||#openstackrouterlist+----------------------------+---------+-------------+--------+-----------------+-------+--------+Nova計(jì)算服務(wù)運(yùn)維管理(1)創(chuàng)建實(shí)例創(chuàng)建實(shí)例類型,命令如下所示。#openstackflavorcreate2V_4G_20G--vcpus2--ram4096--disk#openstackflavorcreate2V_4G_20G--vcpus2--ram4096--disk20查看可用實(shí)例類型列表,命令如下所示。#openstackflavorlist#openstackflavorlist查看可用鏡像列表,命令和結(jié)果如下所示。#openstackimagelist#openstackimagelist+--------------------------------------------------+--------------+--------+|ID |Name|Status|+--------------------------------------------------+--------------+--------+|55758bd0-031b-455d-aea8-ca5c9e9e19e0|cirros-0.6.1|active|+--------------------------------------------------+--------------+--------+查看可用網(wǎng)絡(luò)列表,結(jié)果如下所示。#openstacknetworklist#openstacknetworklist+-------------------------------------------+-----------+-------------------------------------------+| ID | Name | Subnets|+-------------------------------------------+-----------+-------------------------------------------+| 68be109f-9f38-48c8-b65d-0f42f1b14f32 | int-net| 268cf0e6-6af2-45d2-98cf-9fc75bb45b3d || ccde2b6e-96ab-48a5-af7a-9dc26bf6294c | ext-net| e54e217c-6d99-4063-969e-3c9a5137570b |+-------------------------------------------+-----------+-------------------------------------------+創(chuàng)建實(shí)例使用的安全組,命令如下所示。#openstacksecuritygroupcreatesecgroup01#openstacksecuritygroupcreatesecgroup01創(chuàng)建用于連接實(shí)例的SSH密鑰對并查看密鑰對列表,命令和結(jié)果如下所示。#openstackkeypaircreate--public-key.ssh/id_rsa.pub#openstackkeypaircreate--public-key.ssh/id_rsa.pubcontroller_key#openstackkeypairlist+-----------------+------------------------------------------------------------+-----+|Name |Fingerprint |Type|+-----------------+------------------------------------------------------------+-----+|controller_key|61:99:00:64:39:c6:1e:c3:9b:e7:6a:42:58:b2:14:3e|ssh |+-----------------+------------------------------------------------------------+-----+創(chuàng)建實(shí)例cirros-0.6.1,命令如下所示。#netID=$(openstacknetworklist|grepint-net|awk'{print$2#netID=$(openstacknetworklist|grepint-net|awk'{print$2}')#openstackservercreate--flavor2V_4G_20G--imagecirros-0.6.1\--security-groupsecgroup01--nicnet-id=$netID\--key-namecontroller_key "cirros-0.6.1"查看外部網(wǎng)絡(luò)列表,申請浮動IP地址并綁定至實(shí)例上。首先查看網(wǎng)絡(luò)列表,命令和結(jié)果如下所示。#openstacknetworklist–external#openstacknetworklist–external+--------------------------------------------+-----------+-----------------------------------------+| ID | Name | Subnets|+--------------------------------------------+-----------+-----------------------------------------+| ccde2b6e-96ab-48a5-af7a-9d26bf6294c| ext-net| e5e217c-6d99-4063-969e-3c9a5137570b|+--------------------------------------------+-----------+-----------------------------------------+申請浮動IP地址3,命令如下所示。#openstackfloatingipcreateext-net--floating-ip-address#openstackfloatingipcreateext-net--floating-ip-address3綁定浮動IP地址到實(shí)例,命令和結(jié)果如下所示。#openstackserverlist+---------------------+--------------+------------+-------------+--------------+------------------+| ID | Name | Status | Networks | Image | Flavor |+---------------------+--------------+------------+-------------+--------------+------------------+| 46ec44a0-ad70-42b3-9d29-d7050c8500fc | cirros-0.6.1 | ACTIVE |int-net=10.0_0.185 | cirros-0.6.1 | 2V_4G_20G |+---------------------+--------------+------------+-------------+--------------+------------------+#openstackportlist--device-id\46ec44a0-ad70-42b3-9d29-d7050c8500fc+------------------------+---------+--------------+------------------------------------+----------+| ID | Name | MACAddress| FixedIPAddresses | Image |+------------------------+---------+--------------+------------------------------------+----------+1c7f3208-b375-495f-985f-e67c596652bd | | fa:16:3e:bb:2e:0c |ip_address='85,subnet_id=’268cf0e6-6af2-45d2-98cf-9fc75bb45b3d’| ACTIVE |+------------------------+---------+--------------+------------------------------------+----------+#openstackfloatingipset–port\1c7f3208-b375-495f-985f-e67c596652bd3#openstackserverlist+---------------------+--------------+------------+-------------------+------------+--------------+| ID | Name | Status | Networks | Image | Flavor |+---------------------+--------------+------------+-------------------+------------+--------------+| 46ec44a0-ad70-42b3-9d29-d7050c8500fc | cirros-0.6.1 | ACTIVE |int-net=85,3 | cirros-0.6.1 | 2V_4G_20G |+---------------------+--------------+------------+-------------------+------------+--------------+為安全組secgroup01添加因特網(wǎng)控制報(bào)文協(xié)議(InternetControlMessageProtocol,ICMP)協(xié)議入口訪問規(guī)則,命令和結(jié)果如下所示。#openstacksecuritygrouprulecreate--protocolicmp--ingresssecgroup01#openstacksecuritygrouprulecreate--protocolicmp--ingresssecgroup01為安全組secgroup01添加TCP協(xié)議入口訪問規(guī)則,命令和結(jié)果如下所示。##openstacksecuritygrouprulecreate--protocoltcp--dst-port22:22secgroup01使用SSH登錄實(shí)例進(jìn)行測試,命令和結(jié)果如下所示。#openstackserverlist#openstackserverlist+--------------------------------+--------+---------+---------------------+-------+---------------+| ID | Name | Status | Networks | Image | Flavor |+--------------------------------+--------+---------+---------------------+-------+---------------+| 46ec44a0-ad70-42b3-9d29-d7050c8500fc | cirros-0.6.1 | ACTIVE |int-net=85,3 | cirros-0.6.1 | 2V_4G_20G |+--------------------------------+--------+---------+---------------------+-------+---------------+#sshcirros@3Theauthenticityofhost'3(3)'can'tbeestablished.ED25519keyfingerprintisSHA256:Kv3rZ9TlzPokBJ+RSPGukzvv0kMsp6e46eiAeqx/e7I.ThiskeyisnotknownbyanyothernamesAreyousureyouwanttocontinueconnecting.(yes/no/[fingerprint])?yeswarning:Permanentlyadded'3'(ED25519)tothelistofknownhosts.$ping-c3PING56(56)56(84)bytesofdata.64bytesfrom56(56):icmp_seq=1ttl=127time=65.1ms64bytesfrom56(56):icmp_seq=2ttl=127time=78.9ms64bytesfrom56(56):icmp_seq=3ttl=127time=112ms---56pingstatistics---3packetstransmitted,3received,0%packetloss,time2003msrttmin/avg/max/mdev=65.089/85.274/111.796/19.587ms$cat/etc/os-releasePRETTY_NAME="cirros0.6.1"NAME="cirros"VERSION_ID="0.6.1"ID=cirrosHOME_URL=""BUG_REPORT_URL="https://github.com/cirros-dev/cirros/issues"$route-nKernelIProutingtableDestinationGatewayGenmask FlagsMetricRefUseIface UG100200eth0 U100200eth05455 UGH100200eth0查看實(shí)例詳細(xì)信息,命令如下所示。#openstackconsoleurlshowcirros-0.6.1#openstackconsoleurlshowcirros-0.6.1#openstackservershowcirros-0.6.1(2)使用OpenStackAPI啟動、關(guān)閉和重建實(shí)例curl命令是一種在命令行下使用的網(wǎng)絡(luò)工具,用于向服務(wù)器發(fā)送請求并獲取響應(yīng),它可以模擬各種HTTP請求,常用于調(diào)試Web服務(wù)器和API。使用curl調(diào)用后返回的JSON(JavaScriptObjectNotation,JavaScript對象表示法)數(shù)據(jù)不易讀,這時(shí)可以使用python3-mjson.tool命令將響應(yīng)數(shù)據(jù)格式化輸出,下面使用curl命令進(jìn)行部分OpenStackAPI的調(diào)用示例。查詢實(shí)例列表,命令和結(jié)果如下。#curl-s\#curl-s\-H"X-Auth-Token:`openstacktokenissue-fjson|jq-r'.id'`"\http://controller:8774/v2.1/servers|python3-mjson.tool{"servers":[{{"id":"46ec44a0-ad70-42b3-9d29-d7050c8500fc","name":"cirros-0.6.1","links":[{"rel":"self","href":"http://controller:8774/v2.1/servers/46ec44a0-ad70-42b3-9d29-d7050c8500fc"}{"rel":"bookmark","href":"http://controller:8774/servers/46ec44a0-ad70-42b3-9d29-d7050c8500fc"}]}]}查詢實(shí)例cirros-0.6.1的ID、狀態(tài)等,命令和結(jié)果如下。#SERVER_ID=`openstackservershowcirros-0.6.1-fjson|jq-r#SERVER_ID=`openstackservershowcirros-0.6.1-fjson|jq-r".id"`#curl-s-XGET\-H"X-Auth-Token:`openstacktokenissue-fjson|jq-r'.id'`"\http://controller:8774/v2.1/servers/$SERVER_ID|\python3-mjson.tool|\jq-r'.,.server.id,.server.status,.server.addresses'cirros-0.6.146ec44a0-ad70-42b3-9d29-d7050c8500fcACTIVE{"int-net":[{"version":4,"addr":"85","OS-EXT-IPS:type":"fixed","OS-EXT-IPS-MAC:mac_addr":"fa:16:3e:bb:2e:0c"},{"version":4,"addr":"3","OS-EXT-IPS:type":"floating","OS-EXT-IPS-MAC:mac_addr":"fa:16:3e:bb:2e:0c"}]}停止和啟動實(shí)例cirros-0.6.1,命令和結(jié)果如下。#curl-s-XPOST-H"Content-Type:application/json"\#curl-s-XPOST-H"Content-Type:application/json"\-H"X-Auth-Token:`openstacktokenissue-fjson|jq-r'.id'`"\-d'{"os-stop":null}'\http://controller:8774/v2.1/servers/$SERVER_ID/action#openstackserverlist-cID-cName-cStatus+----------------------------------------------------+--------------------+-------------------------+| ID | Name| ID | Name| Status |+-------------------------------------------------------------------------+-------------------------+| 46ec44a0-ad70-42b3-9d29-d7050c8500fc | cirros-0.6.1 | SHUTOFF|+----------------------------------------------------+--------------------+-------------------------+#curl-XPOST\-H"X-Auth-Token:`openstacktokenissue-fjson|jq-r'.id'`"\-H"Content-Type:application/json"\-d'{"os-start":null}'\http://controller:8774/v2.1/servers/$SERVER_ID/action#openstackserverlist-cID-cName-cStatus+----------------------------------------------------+--------------------+-------------------------+| ID | Name | Status |+-------------------------------------------------------------------------+-------------------------+| 46ec44a0-ad70-42b3-9d29-d7050c8500fc | cirros-0.6.1 | ACTIVE |+----------------------------------------------------+--------------------+-------------------------+重建實(shí)例cirros-0.6.1,命令和結(jié)果如下。#IMAGE_ID=`openstackimageshowcirros-0.6.1-fjson|jq-r".id"`#echo$IMAGE_ID55758bd0-031b-455d-aea8-ca5c9e9e19e0#curl-s-XPOST-H"Content-Type:application/json"\-H"X-Auth-Token:`openstacktokenissue-fjson|jq-r'.id'`"\-d'{"rebuild":{"imageRef":"55758bd0-031b-455d-aea8-ca5c9e9e19e0"}}'\http://controller:8774/v2.1/servers/$SERVER_ID/action|python3-mjson.tool{"server":{"id":"46ec44a0-ad70-42b3-9d29-d7050c8500fc","name":"cirros-0.6.1","status":"REBUILD","tenant_id":"d502ed6ca8304eb9a7eee463f5e8a924","user_id":"8d1170212a4c4d7f92d185b08de629e7","metadata":{},"hostId":"b4933f8dde14227cf20b7488edd8f762c386d051fbf409f6d3176093"
"image":{"id":"55758bd0-031b-455d-aea8-ca5c9e9e19e0","links":[{-aea8-ca5c9e9e19e0"}
"rel":"bookmark","href":"http://controller:8774/images/55758bd0-031b-455d]},"favor":{"id":"337ca314-4e57-45a3-a5c6-2e18ce80a981","links":[{"rel":"bookmark""href":"http://controller:8774/flavors/337ca314-4e57-45a3-a5c6-2e18ce80a981",}}]},"accessIPv4":"","accessIPv6":"","links":[{"rel":"self","href":"http://controller:8774/v2.1/servers/46ec44a0-ad70-42b3-9d29-d7050c8500fc"},{"rel":"bookmark""href":"http://controller:8774/servers/46ec44a0-ad70-42b3-9d29-d7050c8500fc"}],"OS-DCF:diskConfig":"MANUAL","progress":0,"adminPass":"jvwvEY6kUtdY"}}實(shí)戰(zhàn)案例——存儲服務(wù)組件運(yùn)維管理存儲服務(wù)組件運(yùn)維管理涉及Cinder塊存儲服務(wù)運(yùn)維管理、Swift對象存儲服務(wù)運(yùn)維管理和Manila共享文件系統(tǒng)服務(wù)運(yùn)維管理。Cinder塊存儲服務(wù)運(yùn)維管理(1)創(chuàng)建鏡像和網(wǎng)絡(luò)創(chuàng)建名為cirros-0.6.1的鏡像,命令如下所示。#openstackimagecreate--disk-formatqcow2\#openstackimagecreate--disk-formatqcow2\--container-formatbare\--progress--filecirros-0.6.1-x86_64-disk.img"cirros-0.6.1"創(chuàng)建網(wǎng)絡(luò)network-?at,網(wǎng)絡(luò)類型為?at,命令如下所示。#openstacknetworkcreate--provider-network-typeflat\#openstacknetworkcreate--provider-network-typeflat\--provider-physical-networkprovider--externalnetwork-flat創(chuàng)建子網(wǎng)network-?at-subnet,網(wǎng)絡(luò)地址分配為00~00,網(wǎng)關(guān)為,命令如下所示。#openstacksubnetcreate--networknetwork-flat\#openstacksubnetcreate--networknetwork-flat\--subnet-range/24\--allocation-poolstart=00,end=00\--gatewaynetwork-flat-subnet(2)啟動云主機(jī)創(chuàng)建云主機(jī)類型2V_1G_10G,命令如下所示。#openstackflavorcreate2V_1G_10G--vcpus2--ram1024--disk#openstackflavorcreate2V_1G_10G--vcpus2--ram1024--disk10使用先前創(chuàng)建的鏡像、云主機(jī)類型和網(wǎng)絡(luò),啟動云主機(jī)cirros-test,命令如下所示。#openstackservercreate--imagecirros-0.6.1\#openstackservercreate--imagecirros-0.6.1\--flavor2V_1G_10G--networknetwork-flatcirros-test查看云主機(jī)列表,命令如下所示。#openstackserverlist#openstackserverlist+---------------------+---------+------------+----------------+--------------+-------------------+| ID | Name | status | Networks | Image | Flavor |+---------------------+---------+------------+----------------+--------------+-------------------+| f6850bc3-3606-4c3d-b14e-3764bf8f1549 | cirros-test| ACTIVE |network-flat=23 | cirros-0.6.1 | 2V_1G_10G |+---------------------+---------+------------+----------------+--------------+-------------------+(3)查看Cinder服務(wù)狀態(tài)查看Cinder服務(wù)狀態(tài),命令如下所示。#openstackvolumeservicelist#openstackvolumeservicelist+---------------------+---------------+--------+--------------+-------+--------------------------+| Binary | Host | Zone | Status | State | UpdatedAt |+---------------------+---------------+--------+--------------+-------+--------------------------+| cinder-scheduler | controller | nova | enabled| up |2023-01-13T13:19:56.000000|| cinder-volume | compute01@lvm-1| nova | enabled| up |2023-01-13T13:19:54.000000|| cinder-backup | compute01 | nova | enabled| up | 2023-01-13T13:19:53.000000|+---------------------+---------------+--------+--------------+-------+--------------------------+(4)創(chuàng)建卷創(chuàng)建一個(gè)2GB云硬盤(卷),命令如下所示。++--------------------------------------+----------------+----------------+-------------------------+| SSD_2G | available | 26917f023-1316-4807-b8ac-f8572d72770b|||#openstackvolumecreate--size2SSD_2G#openstackvolumelist+--------------------------------------+----------------+----------------+-------------------------+| ID | Name | Status | Size | Attachedto|+--------------------------------------+----------------+----------------+-------------------------+(5)掛載云硬盤給云主機(jī)cirros-test掛載SSD_2G卷(云硬盤),命令如下所示。#openstackserveraddvolumecirros-testSSD_2G#openstackserveraddvolumecirros-testSSD_2G查看當(dāng)前卷列表,命令如下所示。#openstackvolumelist#openstackvolumelist+-------------------------+-------------+---------+-------+-------------------------------------+| ID | Name | Status | Size | Attachedto|+-------------------------+-------------+---------+-------+-------------------------------------+| 6917f023-1316-4807-b8ac-f8572d72770b | SSD_2G | in-use | 2 |Attachedtocirros-teston/dev/vdb|+-------------------------+-------------+---------+-------+-------------------------------------+(6)擴(kuò)展卷將云主機(jī)cirros-test上掛載的volume卷(云硬盤)移除,該卷(云硬盤)仍存在,命令如下所示。#openstackserverremovevolumecirros-testSSD_2G#openstackserverremovevolumecirros-testSSD_2G查看當(dāng)前卷列表,命令如下所示。++-------------------------------------------+-------------+------------+-------+-----------------+| SSD_2G | available | 299c48f61-9f63-4c0c-80bc-3731b7127a3b|||#openstackvolumelist+-------------------------------------------+-------------+------------+-------+-----------------+| ID | Name | Status | Size | Attachedto|+-------------------------------------------+-------------+------------+-------+-----------------+將volume卷(云硬盤)由原來的2GB擴(kuò)容為3GB,并更名為SSD_3G,命令如下所示。#openstackvolumesetSSD_2G--size3--nameSSD_3G#openstackvolumesetSSD_2G--size3--nameSSD_3G查看當(dāng)前卷列表,命令如下所示。++---------------------------------+------------+-------------+-------+---------------------------+| SSD_3G | available | 323326e1f-bf73-4e3c-8c25-3631540691b0|||#openstackvolumelist+---------------------------------+------------+-------------+-------+---------------------------+| ID | Name | Status | Size | Attachedto|+---------------------------------+------------+-------------+-------+---------------------------+(7)掛載云硬盤,驗(yàn)證卷大小給云主機(jī)cirros-test掛載擴(kuò)容后的SSD_3G卷(云硬盤),命令和查詢結(jié)果如下所示。#openstackserveraddvolumecirros-testSSD_3G#openstackserveraddvolumecirros-testSSD_3G查看當(dāng)前卷列表,命令如下所示。#openstackvolumelist#openstackvolumelist+---------------------------------+------------+-------------+-------+---------------------------+| ID | Name | Status | Size | Attachedto|+---------------------------------+------------+-------------+-------+---------------------------+| 23326e1f-bf73-4e3c-8c25-3631540691b0 | SSD_3G | in-use | 3 |Attachedtocirros-teston/dev/vdb|+---------------------------------+------------+-------------+-------+---------------------------+列出所有的虛擬機(jī),命令如下所示。[root@compute01[root@compute01~]#dnf-yinstalllibvirt-client[root@compute01~]#virshlist--allId Name State--------------------------------------------------2 instance-00000003 running使用命令行切換到云主機(jī)cirros-test的控制臺,命令如下所示。[root@compute01~][root@compute01~]#virshconsoleinstance-00000003用戶名和密碼登錄云主機(jī)cirros-test的控制臺,命令如下所示。[root@compute01[root@compute01~]#virshconsoleinstance-00000003Connectedtodomain'instance-00000003'Escapecharacteris^](Ctrl]) 回車loginas'cirros'user.defaultpassword:'gocubsgo'.use'sudo'forroot.cirroslogin:cirrosPassword:列出云主機(jī)所cirros-test有可用的塊設(shè)備信息,驗(yàn)證volume卷(云硬盤)擴(kuò)容的大小,命令如下所示。$lsblk$lsblkNAME MAJ:MINRMSIZEROTYPEMOUNTPOINTSvda 252:0 0 10G 0 disk|-vda1 252:1 0 10G 0 part /`-vda15 252:15 0 8M 0 partvdb 252:16 0 3G 0 diskSwift對象存儲服務(wù)運(yùn)維管理(1)服務(wù)運(yùn)維基礎(chǔ)命令查看對象存儲服務(wù)狀態(tài),命令如下所示。#swiftstat#swiftstat創(chuàng)建容器swift-wxic,命令如下所示。#openstackcontainercreateswift-wxic#openstackcontainercreateswift-wxic查看當(dāng)前容器列表,命令如下所示。#openstackcontainerlist#openstackcontainerlist查看容器swift-wxic的詳細(xì)信息,命令如下所示。#openstackcontainershowswift-wxic#openstackcontainershowswift-wxic(2)上傳對象創(chuàng)建wxic目錄,命令如下所示。#mkdirwxic#mkdirwxic查看當(dāng)前位置下的所有文件,命令如下所示。#ls#lswxiccirros-0.6.1-x86_64-disk.img將cirros-0.6.1-x86_64-disk.img復(fù)制到wxic目錄中,命令如下所示。#mvcirros-0.6.1-x86_64-disk.imgwxic/#mvcirros-0.6.1-x86_64-disk.imgwxic/將wxic/cirros-0.6.1-x86_64-disk.img文件上傳到swift-wxic容器,命令如下。#openstackobjectcreateswift-wxicwxic/cirros-0.6.1-x86_64-disk.img#openstackobjectcreateswift-wxicwxic/cirros-0.6.1-x86_64-disk.img(3)查看對象查看swift-wxic容器內(nèi)的上傳對象,命令如下所示。||#openstackobjectlistswift-wxic+------------------------------------------+|Name+------------------------------------------+|wxic/cirros-0.6.1-x86_64-disk.img|+------------------------------------------+查看上傳swift-wxic容器中的wxic/cirros-0.6.1-x86_64-disk.img文件的詳細(xì)信息,命令如下所示。#openstackobjectshowswift-wxicwxic/cirros-0.6.1-x86_64-disk.img#openstackobjectshowswift-wxicwxic/cirros-0.6.1-x86_64-disk.img(4)下載對象進(jìn)入/opt目錄,命令如下所示。#cd/opt/#cd/opt/將swift-wxic容器中的wxic/cirros-0.6.1-x86_64-disk.img文件下載到/opt目錄中,命令如下所示。#openstackobjectsaveswift-wxicwxic/cirros-0.6.1-x86_64-disk.img#openstackobjectsaveswift-wxicwxic/cirros-0.6.1-x86_64-disk.img查看下載結(jié)果,命令如下所示。#lswxic/#lswxic/cirros-0.6.1-x86_64-disk.img如果想要下載容器里面所有的文件,命令語法如下所示。#openstackcontainersave<#openstackcontainersave<容器名>(5)刪除對象查看swift-wxic容器內(nèi)的上傳對象,命令如下所示。++------------------------------------------+|wxic/cirros-0.6.1-x86_64-disk.img|+------------------------------------------+|#openstackobjectlistswift-wxic+------------------------------------------+| Name刪除swift-wxic容器內(nèi)的上傳對象wxic/cirros-0.6.1-x86_64-disk.img,命令如下所示。#openstackobjectdeleteswift-wxicwxic/cirros-0.6.1-x86_64-disk.img#openstackobjectdeleteswift-wxicwxic/cirros-0.6.1-x86_64-disk.img再次查看swift-wxic容器內(nèi)的上傳對象,命令如下所示。#openstackobjectlistswift-wxic#openstackobjectlistswift-wxic(6)刪除容器查看容器列表,命令如下所示。#openstackcontainerlist#openstackcontainerlist+-------------+|Name |+-------------+|swift-wxic|+-------------+刪除swift-wxic容器,命令如下所示。#openstackcontainerdeleteswift-wxic#openstackcontainerdeleteswift-wxic再次查看容器列表,檢驗(yàn)上述操作結(jié)果,命令如下所示。#openstackcontainerlist#openstackcontainerlist如果需要遞歸刪除對象和容器,則需要加--recursive參數(shù),命令語法如下所示。#openstackcontainerdelete<#openstackcontainerdelete<容器名>--recursive(7)分片存儲案例創(chuàng)建一個(gè)名為wxic的容器,命令如下所示。#openstackcontainercreatewxic#openstackcontainercreatewxic將cirros-0.6.1-x86_64-disk.img鏡像文件按10M的大小分片存儲在wxic容器中,命令如下所示。#swiftuploadwxic-S10Mcirros-0.6.1-x86_64-disk.img#swiftuploadwxic-S10Mcirros-0.6.1-x86_64-disk.img查看wxic容器中上傳對象cirros-0.6.1-x86_64-disk.img的詳細(xì)信息,命令如下所示。#swiftstatwxiccirros-0.6.1-x86_64-disk.img#swiftstatwxiccirros-0.6.1-x86_64-disk.img查看wxic容器中的分片情況,命令如下所示。#swiftlistwxic_segments#swiftlistwxic_segmentscirros-0.6.1-x86_64-disk.img/1669128161.000000/21233664/10485760/00000000cirros-0.6.1-x86_64-disk.img/1669128161.000000/21233664/10485760/00000001cirros-0.6.1-x86_64-disk.img/1669128161.000000/21233664/10485760/00000002數(shù)據(jù)分片分別存放在不同的存儲設(shè)備中,以減小每個(gè)存儲設(shè)備的數(shù)據(jù)訪問壓力,從而提高整個(gè)數(shù)據(jù)系統(tǒng)的性能。Manila共享文件系統(tǒng)服務(wù)運(yùn)維管理Manila服務(wù)命令了解(1)通過幫助命令了解Manila服務(wù)的使用方法共享文件系統(tǒng)服務(wù)的使用命令較多,命令行工具提供的幫助說明也比較詳細(xì),可以參考進(jìn)行學(xué)習(xí),由于命令回顯過多,下面只給出幫助命令示例,讀者可自行在已有環(huán)境下執(zhí)行查看。#openstackhelpshare#openstackhelpshare#openstackhelpsharetypecreate#openstackhelpsharecreate#openstackhelpshareaccesscreate#openstackhelpshareexportlocationlist(2)服務(wù)狀態(tài)查看命令列出服務(wù)組件以驗(yàn)證每個(gè)進(jìn)程是否成功啟動,命令如下所示。20232023-05-08T09:08:17.906948|+------+-------------+----------+-------------+----------+---------+----------------------------+up |enabled||novacompute@lvm|manila-share ||22023-05-08T09:08:17.070795| enabled| up| maniTa-scheduler | controller | nova1||||#openstackshareservicelist+------+-------------+----------+-------------+-----------+---------+----------------------------+| ID | Binary | status | Networks | Image | Flavor |UpdatedAt |+------+-------------+----------+-------------+-----------+---------+--------------
溫馨提示
- 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)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2024版離婚合同書:不含子女撫養(yǎng)權(quán)簡易版版B版
- 2024電子商務(wù)平臺軟件許可及技術(shù)支持合同2篇
- 2024鋁合金門窗工程承包合同范文
- 2024年三季度報(bào)醫(yī)療服務(wù)行業(yè)A股凈利潤排名前五大上市公司
- 2025年度床墊產(chǎn)品廣告投放與宣傳合同3篇
- 2024版借款居間服務(wù)合同
- 2025年度二零二五年度離婚后子女撫養(yǎng)及財(cái)產(chǎn)分割執(zhí)行協(xié)議3篇
- 動物與中國文化知到智慧樹章節(jié)測試課后答案2024年秋東北林業(yè)大學(xué)
- 產(chǎn)科病房助產(chǎn)士招聘協(xié)議
- ISO 56007-2023創(chuàng)新管理 管理機(jī)會和想法的工具和方法 指南雷澤佳譯-2024
- 2024版食材配送合同協(xié)議書范本
- 2024版第三方代付協(xié)議模板
- 育嬰師服務(wù)合同協(xié)議書(2024版)
- 情侶分手經(jīng)濟(jì)協(xié)議書范本
- 心理健康教育國內(nèi)外研究現(xiàn)狀
- 偉大的《紅樓夢》智慧樹知到期末考試答案章節(jié)答案2024年北京大學(xué)
- 廣州社會保險(xiǎn)退款申請表
- 2024年知識競賽-競彩知識筆試參考題庫含答案
- 高效協(xié)同-培訓(xùn)課件
- 20XX年市場洞察模板
評論
0/150
提交評論