Openstack控制節點刪除計算節點的方法

控制節點Controller的操做:刪除計算節點名稱爲compute
1.查看計算主機及服務相關:node

[root@controller ~]# openstack host listmysql

Host Name Service Zone
controller scheduler internal
controller consoleauth internal
controller conductor internal
compute compute nova
compute1 compute nova

[root@controller ~]# nova service-listsql

Id Binary Host Zone Status State Updated_at Disabled Reason Forced down
ecbbf8bd-85cb-45e2-b01a-8cb58032d908 nova-scheduler controller internal enabled up 2019-03-15T00:56:31.000000 - False
d8776bed-bdfd-460e-9573-4b64478860b7 nova-consoleauth controller internal enabled up 2019-03-15T00:56:40.000000 - False
d6e90239-b63a-4a54-b010-44c28aff8a7c nova-conductor controller internal enabled up 2019-03-15T00:56:33.000000 - False
bf635c36-2b14-44bc-aeaa-fff05d80c15b nova-compute compute nova enabled down 2019-02-27T03:01:48.000000 - False
bcbfc8f0-5df8-4e81-8c3a-2bf60b0b6bdc nova-compute compute1 nova enabled up 2019-03-15T00:56:39.000000 - False

計算節點compute的State狀態是down,但Status狀態仍是enabled可用。
2.修改compute爲不可用狀態。數據庫

[root@controller ~]# nova service-disable bf635c36-2b14-44bc-aeaa-fff05d80c15bui

ID Host Binary Status
bf635c36-2b14-44bc-aeaa-fff05d80c15b compute nova-compute disabled

查看是否修改爲功
[root@controller ~]# nova service-listthis

Id Binary Host Zone Status State Updated_at Disabled Reason Forced down
ecbbf8bd-85cb-45e2-b01a-8cb58032d908 nova-scheduler controller internal enabled up 2019-03-15T00:58:11.000000 - False
d8776bed-bdfd-460e-9573-4b64478860b7 nova-consoleauth controller internal enabled up 2019-03-15T00:58:10.000000 - False
d6e90239-b63a-4a54-b010-44c28aff8a7c nova-conductor controller internal enabled up 2019-03-15T00:58:13.000000 - False
bf635c36-2b14-44bc-aeaa-fff05d80c15b nova-compute compute nova disabled down 2019-03-15T00:57:56.000000 - False
bcbfc8f0-5df8-4e81-8c3a-2bf60b0b6bdc nova-compute compute1 nova enabled up 2019-03-15T00:58:09.000000 - False

3.在數據庫(nova)中清理
[root@controller ~]# mysql -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 980
Server version: 10.1.20-MariaDB MariaDB Serverorm

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.get

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.input

MariaDB [(none)]> use nova
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -Ait

Database changed
MariaDB [nova]> delete from nova.services where host="compute";
Query OK, 1 row affected (0.01 sec)

MariaDB [nova]> delete from compute_nodes where hypervisor_hostname="compute";
Query OK, 0 rows affected (0.00 sec)

MariaDB [nova]> select host from nova.services;
host
0.0.0.0
0.0.0.0
compute1
controller
controller
controller

6 rows in set (0.00 sec)

MariaDB [nova]> select hypervisor_hostname from compute_nodes;
hypervisor_hostname
compute1

1 row in set (0.00 sec)

4.校驗

[root@controller ~]# openstack host list

Host Name Service Zone
controller scheduler internal
controller consoleauth internal
controller conductor internal
compute1 compute nova

[root@controller ~]# nova service-list

Id Binary Host Zone Status State Updated_at Disabled Reason Forced down
ecbbf8bd-85cb-45e2-b01a-8cb58032d908 nova-scheduler controller internal enabled up 2019-03-15T01:00:21.000000 - False
d8776bed-bdfd-460e-9573-4b64478860b7 nova-consoleauth controller internal enabled up 2019-03-15T01:00:21.000000 - False
d6e90239-b63a-4a54-b010-44c28aff8a7c nova-conductor controller internal enabled up 2019-03-15T01:00:23.000000 - False
bcbfc8f0-5df8-4e81-8c3a-2bf60b0b6bdc nova-compute compute1 nova enabled up 2019-03-15T01:00:19.000000 - False

再次查看計算節點,就發現compute已經被刪除了。

相關文章
相關標籤/搜索