GIS+=地理資訊+雲端計算+大資料+容器+物聯網+...
阿新 • • 發佈:2018-12-31
題記:
在我們學習openstack知識過程中,經常會部署幾臺物理伺服器,但是也有可能某些物理伺服器另作他用,也就是物理伺服器修改IP或者角色轉換,但是可能這些物理伺服器作為宿主機(計算節點)還包含了已經執行的虛擬機器例項,類似這種情況,我們無法直接將計算節點暴力清除(也就是斷開網路),這樣操作會出現一個問題就是,實際的計算節點資訊在資料庫中並沒有清除,導致我們在建立新的虛擬機器伺服器預設還會進行排程,但是實際這些計算節點是不存在的,所以我們需要有步驟的對這些進行操作。
1,刪除例項
[email protected]:~$ nova list
+--------------------------------------+--------------------------------------------+---------+------------+-------------+---------------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+--------------------------------------------+---------+------------+-------------+---------------------------+
| 0d9d319b-3387-4ee1-93db-d98f03c20621 | devstack_icehouse | SHUTOFF | - | Shutdown | sharednet1=192.168.12.105 |
| decf3b3b-2bc7-4bb3-af0e-ef12479778b6 | hadoop | ACTIVE | - | Running | sharednet1=192.168.12.125 |
| e0482e04-7c85-45cf-97a0-7ef0f0203871 | idesktop | SHUTOFF | - | Shutdown | sharednet1=192.168.12.112 |
| 088844ae-c012-4d35-83d0-dc3a06a1ef8a | mq_ha-088844ae-c012-4d35-83d0-dc3a06a1ef8a | ACTIVE | - | Running | sharednet1=192.168.12.129 |
| 0b095133-8c76-4a8c-acfd-a66948920089 | mq_ha-0b095133-8c76-4a8c-acfd-a66948920089 | ACTIVE | - | Running | sharednet1=192.168.12.131 |
| 4b1c2010-3a9e-42b8-971d-86118c108f2d | mq_ha-4b1c2010-3a9e-42b8-971d-86118c108f2d | ACTIVE | - | Running | sharednet1=192.168.12.130 |
| 582dddf4-5d33-4689-a946-d5958aa263d6 | ubuntu1404_server_LIWH | ACTIVE | - | Running | sharednet1=192.168.12.143 |
| 6c16999c-e94a-4947-8489-1333d28862f8 | vm2 | ACTIVE | - | Running | sharednet1=192.168.12.116 |
+--------------------------------------+--------------------------------------------+---------+------------+-------------+---------------------------+
[email protected]:~$ nova delete devstack_icehouse
2,移除nova-compute
查詢所有nova 服務
[email protected]:~$ nova service-list +------------------+------------+----------+----------+-------+----------------------------+------------------------------------+ | Binary | Host | Zone | Status | State | Updated_at | Disabled Reason | +------------------+------------+----------+----------+-------+----------------------------+------------------------------------+ | nova-cert | controller | internal | enabled | up | 2016-01-08T03:01:20.000000 | - | | nova-consoleauth | controller | internal | enabled | up | 2016-01-08T03:01:27.000000 | - | | nova-scheduler | controller | internal | enabled | up | 2016-01-08T03:01:28.000000 | - | | nova-conductor | controller | internal | enabled | up | 2016-01-08T03:01:24.000000 | - | | nova-compute | compute | nova | enabled | up | 2016-01-08T03:01:20.000000 | None | | nova-compute | network | nova | enabled | up | 2016-01-08T03:01:29.000000 | None | | nova-compute | compute2 | nova | disabled | down | 2016-01-07T07:37:07.000000 | AUTO: Failed to connect to libvirt | +------------------+------------+----------+----------+-------+----------------------------+------------------------------------+
刪除nova-compute
在J 版本以上有nova service-delete compute2 直接刪除
Juno之前版本可以用nova service-disable
執行 nova service-disable compute2 nova-compute
[email protected]:~# nova service-disable compute2 nova-compute
+----------+--------------+----------+
| Host | Binary | Status |
+----------+--------------+----------+
| compute2 | nova-compute | disabled |
+----------+--------------+----------+
[email protected]:~# nova service-list
+------------------+------------+----------+----------+-------+----------------------------+-----------------+
| Binary | Host | Zone | Status | State | Updated_at | Disabled Reason |
+------------------+------------+----------+----------+-------+----------------------------+-----------------+
| nova-cert | controller | internal | enabled | up | 2016-01-13T03:17:46.000000 | - |
| nova-consoleauth | controller | internal | enabled | up | 2016-01-13T03:17:39.000000 | - |
| nova-scheduler | controller | internal | enabled | up | 2016-01-13T03:17:42.000000 | - |
| nova-conductor | controller | internal | enabled | up | 2016-01-13T03:17:42.000000 | - |
| nova-compute | compute | nova | enabled | up | 2016-01-13T03:17:47.000000 | None |
| nova-compute | network | nova | enabled | up | 2016-01-13T03:17:39.000000 | None |
| nova-compute | compute2 | nova | disabled | up | 2016-01-13T03:17:41.000000 | - |
+------------------+------------+----------+----------+-------+----------------------------+-----------------+
3,登入nova資料庫清理 如下資料
mysql -unovadbadmin -pnovapasswd
select * from nova.services;
select * from compute_nodes
delete from nova.services where host="compute2";
delete from compute_nodes where hypervisor_hostname="compute";
4,關機移除compute2