項(xiàng)目實(shí)訓(xùn)一
本實(shí)訓(xùn)任務(wù)對(duì)實(shí)驗(yàn)環(huán)境要求較高,而且過(guò)程比較復(fù)雜,涉及的步驟非常多,有一定難度,可根據(jù)需要選做??梢钥紤]改為直接觀看相關(guān)的微課視頻
【實(shí)訓(xùn)題目】
增加一個(gè)計(jì)算節(jié)點(diǎn)并進(jìn)行實(shí)例冷遷移
【實(shí)訓(xùn)目的】
熟悉增加一個(gè)計(jì)算節(jié)點(diǎn)的步驟。
熟悉實(shí)例冷遷移的操作方法。
【實(shí)訓(xùn)準(zhǔn)備】
(1)復(fù)習(xí)使用Packstack安裝器增加節(jié)點(diǎn)的基本方法。
(2)另外準(zhǔn)備一臺(tái)操作系統(tǒng)為CentOS 7的主機(jī)作為計(jì)算節(jié)點(diǎn)。
【實(shí)訓(xùn)內(nèi)容】
(1)在實(shí)驗(yàn)1的基礎(chǔ)上克隆一臺(tái)虛擬機(jī),將IP地址改為其他地址,確保跟openstack主機(jī)IP地址不一樣。然后重啟網(wǎng)卡。此為第2個(gè)節(jié)點(diǎn)虛擬機(jī)
cd /etc/sysconfig/network-scripts
修改IP地址:IPADDR=192.168.128.29(自己的IP段)
節(jié)點(diǎn)1:192.168.128.128
節(jié)點(diǎn)2:192.168.128.28
重啟網(wǎng)卡
systemctl restart network
(2)修改主機(jī)名
建議第1個(gè)節(jié)點(diǎn)名為:node-a 第2個(gè)節(jié)點(diǎn)名為:node-b
vi /etc/hostname
修改之后退出重啟虛擬機(jī),在命令行前面就顯示了
init 6
(3)如果需要修改原來(lái)的openstack主機(jī)名,則按照如下步驟實(shí)現(xiàn),建議直接在原來(lái)的主機(jī)名基礎(chǔ)上做,不用修改主機(jī)名
在單節(jié)點(diǎn)的RDO一體化OpenStack云平臺(tái)的基礎(chǔ)上使用Packstack安裝器再增加計(jì)算節(jié)點(diǎn),構(gòu)建雙節(jié)點(diǎn)的實(shí)驗(yàn)平臺(tái)時(shí),如果在部署RDO一體化OpenStack云平臺(tái)時(shí),/etc/hosts配置文件中保留了以下默認(rèn)配置:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
那么,該節(jié)點(diǎn)的計(jì)算主機(jī)名會(huì)顯示為localhost,這種情形在增加計(jì)算節(jié)點(diǎn)之前,為便于區(qū)分不同節(jié)點(diǎn),最好將localhost改為明確的節(jié)點(diǎn)主機(jī)名(如node-a),只是操作有些復(fù)雜,下面給出操作步驟供參考(這可以作為修改計(jì)算節(jié)點(diǎn)名的通用方法)。
(3.1)停止相關(guān)的計(jì)算服務(wù)
systemctl stop libvirtd.service openstack-nova-compute.service openstack-nova-scheduler.service ??openstack-nova-conductor.service openstack-nova-novncproxy.service
?(3.2)修改/etc/nova/nova.conf配置文件,將其中的host改為指定的節(jié)點(diǎn)主機(jī)名,將
#host=<current_hostname>
host=localhost
改為:
#host=<current_hostname>
host=node-a
(3.3)修改底層的數(shù)據(jù)庫(kù)
[root@node-a ~]# mysql -u root
Enter password: ?????????????#密碼可以從Packstack安裝自動(dòng)產(chǎn)生的應(yīng)答文件中查找。
Welcome to the MariaDB monitor. ?Commands end with ; or \g.
Your MariaDB connection id is 3402
Server version: 10.3.20-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> use nova;???????????????????????#指定當(dāng)前數(shù)據(jù)庫(kù)
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
#更改計(jì)算節(jié)點(diǎn)名
MariaDB [nova]> update compute_nodes set host='node-a'?where host='localhost';????
Query OK, 1 row affected (0.001 sec)
Rows matched: 1 ?Changed: 1 ?Warnings: 0
#更改現(xiàn)有虛擬機(jī)實(shí)例的計(jì)算節(jié)點(diǎn)名
MariaDB [nova]> update instances set host='node-a' where host='localhost';
?Query OK, 12 rows affected (0.005 sec)
Rows matched: 12 ?Changed: 12 ?Warnings: 0
#更改現(xiàn)有虛擬機(jī)實(shí)例的啟動(dòng)的計(jì)算節(jié)點(diǎn)名
MariaDB [nova]> update instances set launched_on='node-a' where launched_on='localhost';???????????
Query OK, 14 rows affected (0.002 sec)
Rows matched: 14 ?Changed: 14 ?Warnings: 0
#更改計(jì)算服務(wù)的節(jié)點(diǎn)主機(jī)名
MariaDB [nova]> update services set host='node-a' where host='localhost';
Query OK, 5 rows affected (0.001 sec)
Rows matched: 5 ?Changed: 5 ?Warnings: 0
MariaDB [(none)]> use nova_api;?#指定當(dāng)前數(shù)據(jù)庫(kù)
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
#更改主機(jī)映射的節(jié)點(diǎn)主機(jī)名
MariaDB [nova_api]> update host_mappings set host='node-a' where host='localhost';
MariaDB [nova]> flush privileges;
Query OK, 0 rows affected (0.001 sec)
MariaDB [nova]> quit;
Bye
?(3.4)啟動(dòng)相關(guān)的計(jì)算服務(wù)
systemctl start?libvirtd.service openstack-nova-compute.service openstack-nova-scheduler.service ??openstack-nova-conductor.service openstack-nova-novncproxy.service??
(4)修改/etc/hosts配置文件
(節(jié)點(diǎn)1、節(jié)點(diǎn)2都要改)
vi /etc/hosts
將節(jié)點(diǎn)1的文件改為:?
節(jié)點(diǎn)2的文件改為
節(jié)點(diǎn)1:
節(jié)點(diǎn)2:
(5)在節(jié)點(diǎn)2,安裝必要的軟件
yum -y install centos-release-openstack-train
yum makecache
yum -y install openstack-packstack
(6)在節(jié)點(diǎn)1,編輯應(yīng)答文件
將root文件夾下生成的應(yīng)答文件復(fù)制一份:packstack-answers-addnode.txt
cp packstack-answers-20230922-094512.txt packstack-answers-addnode.txt
vi packstack-answers-addnode.txt
CONFIG_COMPUTE_HOSTS=192.168.233.128,192.168.233.28
CONFIG_PROVISION_DEMO_FLOATRANGE=192.168.233.0/24
CONFIG_KEYSTONE_ADMIN_PW=123456
CONFIG_KEYSTONE_DEMO_PW=123456
(7)在節(jié)點(diǎn)1執(zhí)行,使用修改過(guò)的應(yīng)答文件運(yùn)行Packstack安裝器
packstack --answer-file=packstack-answers-addnode.txt
…
Installing:
Clean Up [ DONE ]
Discovering ip protocol version [ DONE ]
root@192.168.199.32's password: #提供第2個(gè)節(jié)點(diǎn)root賬戶密碼
Setting up ssh keys [ DONE ]
Preparing servers [ DONE ]
…
Copying Puppet modules and manifests [ DONE ]
Applying 192.168.199.31_controller.pp
192.168.199.31_controller.pp: [ DONE ]
Applying 192.168.199.31_network.pp
192.168.199.31_network.pp: [ DONE ]
Applying 192.168.199.31_compute.pp
Applying 192.168.199.32_compute.pp #應(yīng)用第2個(gè)計(jì)算節(jié)點(diǎn)
192.168.199.31_compute.pp: [ DONE ]
192.168.199.32_compute.pp: [ DONE ]
Applying Puppet manifests [ DONE ]
Finalizing [ DONE ]
(7.1)//在節(jié)點(diǎn)2處理錯(cuò)誤,在節(jié)點(diǎn)1繼續(xù)執(zhí)行安裝命令
------------------------------------------------------------------------------------------------------------------
//錯(cuò)誤1:leatherman_curl.so.1.3.0: cannot open shared object file
//處理:# yum downgrade -y leatherman
出現(xiàn)節(jié)點(diǎn)一錯(cuò)誤:
------------------------------------------------------------------------------------------------------------------
//錯(cuò)誤2:Error: Package: python2-qpid-proton-0.26.0-2.el7.x86_64 (centos-openstack-train)
//處理:#?yum install -y python2-qpid-proton-0.26.0-2.el7.x86_64
------------------------------------------------------------------------------------------------------------------
//安裝成功截圖
//錯(cuò)誤3:Could not set 'present' on ensure: undefined method `split' for nil:NilClass
(8)驗(yàn)證雙節(jié)點(diǎn)部署
虛擬機(jī)管理器列表
計(jì)算主機(jī)列表
計(jì)算服務(wù)列表
網(wǎng)絡(luò)代理列表
新創(chuàng)建測(cè)試用的虛擬機(jī)實(shí)例
新創(chuàng)建的虛擬機(jī)實(shí)例在node-b主機(jī)上運(yùn)行
任務(wù)3 遷移虛擬機(jī)實(shí)例
------------------------------------------------------------------------------------------------------------------
1)在計(jì)算節(jié)點(diǎn)之間配置SSH無(wú)密碼訪問(wèn)
------------------------------------------------------------------------------------------------------------------
//配置ssh無(wú)密碼訪問(wèn)(第4步,兩個(gè)節(jié)點(diǎn)都要執(zhí)行)
ls -l /var/lib/nova/.ssh
echo -e?'strictHostKeyChecking no' > /var/lib/nova/.ssh/config?
節(jié)點(diǎn)1:
scp -r /var/lib/nova/.ssh/config ZHT-A:/var/lib/nova/.ssh/config
節(jié)點(diǎn)2:
scp -r /var/lib/nova/.ssh/config zht33:/var/lib/nova/.ssh/config
usermod -s /bin/bash nova
節(jié)點(diǎn)1:
節(jié)點(diǎn)2:
//測(cè)試
su - nova
ssh zht33
ssh ZHT-A
exit
//在兩個(gè)節(jié)點(diǎn)都要重啟nova服務(wù)
# systemctl restart libvirtd openstack-nova-compute
節(jié)點(diǎn)1:
節(jié)點(diǎn)2:
2)執(zhí)行實(shí)例的冷遷移操作(Web界面操作)
------------------------------------------------------------------------------------------------------------------
//admin用戶——管理員——計(jì)算——實(shí)例——遷移實(shí)例
文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-860752.html
文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-860752.html
到了這里,關(guān)于OpenStack云計(jì)算(十)——OpenStack虛擬機(jī)實(shí)例管理,增加一個(gè)計(jì)算節(jié)點(diǎn)并進(jìn)行實(shí)例冷遷移,增加一個(gè)計(jì)算節(jié)點(diǎn)的步驟,實(shí)例冷遷移的操作方法的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!