Openstack控制节点删除计算节点的方法

控制节点Controller的操作:删除计算节点名称为compute
1.查看计算主机及服务相关:

[root@controller ~]# openstack host list

Host NameServiceZone
controllerschedulerinternal
controllerconsoleauthinternal
controllerconductorinternal
computecomputenova
compute1computenova

[root@controller ~]# nova service-list

IdBinaryHostZoneStatusStateUpdated_atDisabled ReasonForced down
ecbbf8bd-85cb-45e2-b01a-8cb58032d908nova-schedulercontrollerinternalenabledup2019-03-15T00:56:31.000000-False
d8776bed-bdfd-460e-9573-4b64478860b7nova-consoleauthcontrollerinternalenabledup2019-03-15T00:56:40.000000-False
d6e90239-b63a-4a54-b010-44c28aff8a7cnova-conductorcontrollerinternalenabledup2019-03-15T00:56:33.000000-False
bf635c36-2b14-44bc-aeaa-fff05d80c15bnova-computecomputenovaenableddown2019-02-27T03:01:48.000000-False
bcbfc8f0-5df8-4e81-8c3a-2bf60b0b6bdcnova-computecompute1novaenabledup2019-03-15T00:56:39.000000-False

计算节点compute的State状态是down,但Status状态还是enabled可用。
2.修改compute为不可用状态。

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

IDHostBinaryStatus
bf635c36-2b14-44bc-aeaa-fff05d80c15bcomputenova-computedisabled

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

IdBinaryHostZoneStatusStateUpdated_atDisabled ReasonForced down
ecbbf8bd-85cb-45e2-b01a-8cb58032d908nova-schedulercontrollerinternalenabledup2019-03-15T00:58:11.000000-False
d8776bed-bdfd-460e-9573-4b64478860b7nova-consoleauthcontrollerinternalenabledup2019-03-15T00:58:10.000000-False
d6e90239-b63a-4a54-b010-44c28aff8a7cnova-conductorcontrollerinternalenabledup2019-03-15T00:58:13.000000-False
bf635c36-2b14-44bc-aeaa-fff05d80c15bnova-computecomputenovadisableddown2019-03-15T00:57:56.000000-False
bcbfc8f0-5df8-4e81-8c3a-2bf60b0b6bdcnova-computecompute1novaenabledup2019-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 Server

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

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

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 -A

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 NameServiceZone
controllerschedulerinternal
controllerconsoleauthinternal
controllerconductorinternal
compute1computenova

[root@controller ~]# nova service-list

IdBinaryHostZoneStatusStateUpdated_atDisabled ReasonForced down
ecbbf8bd-85cb-45e2-b01a-8cb58032d908nova-schedulercontrollerinternalenabledup2019-03-15T01:00:21.000000-False
d8776bed-bdfd-460e-9573-4b64478860b7nova-consoleauthcontrollerinternalenabledup2019-03-15T01:00:21.000000-False
d6e90239-b63a-4a54-b010-44c28aff8a7cnova-conductorcontrollerinternalenabledup2019-03-15T01:00:23.000000-False
bcbfc8f0-5df8-4e81-8c3a-2bf60b0b6bdcnova-computecompute1novaenabledup2019-03-15T01:00:19.000000-False

再次查看计算节点,就发现compute已经被删除了。

相关推荐