上一节我们尝试了追加安装一台计算节点,这一节我们讲一讲,怎么彻底删除。
下面记录了在openstack中彻底删除计算节点nova-node2.openstack的操作:
在控制节点上操作
查看计算节点
[root@nova-node1 src]# openstack host list
+-----------------------+-------------+----------+
| Host Name | Service | Zone |
+-----------------------+-------------+----------+
| nova-node1.openstack | conductor | internal |
| nova-node1.openstack | cert | internal |
| nova-node1.openstack | consoleauth | internal |
| nova-node1.openstack | scheduler | internal |
| nova-node1.openstack | compute | nova |
| nova-node2.openstack | compute | nova |
+-----------------------+-------------+----------+
[root@nova-node1 src]# nova service-list
+----+------------------+-----------------------+----------+---------+-------+----------------------------+-----------------+
| Id | Binary | Host | Zone | Status | State | Updated_at | Disabled Reason |
+----+------------------+-----------------------+----------+---------+-------+----------------------------+-----------------+
| 1 | nova-conductor | nova-node1.openstack | internal | enabled | up | 2016-11-02T11:25:08.000000 | - |
| 4 | nova-cert | nova-node1.openstack | internal | enabled | up | 2016-11-02T11:25:07.000000 | - |
| 5 | nova-consoleauth | nova-node1.openstack | internal | enabled | up | 2016-11-02T11:25:07.000000 | - |
| 6 | nova-scheduler | nova-node1.openstack | internal | enabled | up | 2016-11-02T11:25:07.000000 | - |
| 7 | nova-compute | nova-node1.openstack | nova | enabled | up | 2016-11-02T11:24:59.000000 | - |
| 8 | nova-compute | nova-node2.openstack | nova | enabled | down | 2016-10-31T05:55:24.000000 | - |
+----+------------------+-----------------------+----------+---------+-------+----------------------------+-----------------+
虽然上面显示的一个计算节点nova-node2.openstack 的State状态是down,但是Status状态还是enabled可用。
现在需要使它为不可用。
[root@nova-node1 src]# nova service-disable nova-node2.openstack nova-compute
+-----------------------+--------------+----------+
| Host | Binary | Status |
+-----------------------+--------------+----------+
| nova-node2.openstack | nova-compute | disabled |
+-----------------------+--------------+----------+
[root@nova-node1 src]# nova service-list
+----+------------------+-----------------------+----------+----------+-------+----------------------------+-----------------+
| Id | Binary | Host | Zone | Status | State | Updated_at | Disabled Reason |
+----+------------------+-----------------------+----------+----------+-------+----------------------------+-----------------+
| 1 | nova-conductor | nova-node1.openstack | internal | enabled | up | 2016-11-02T11:25:48.000000 | - |
| 4 | nova-cert | nova-node1.openstack | internal | enabled | up | 2016-11-02T11:25:47.000000 | - |
| 5 | nova-consoleauth | nova-node1.openstack | internal | enabled | up | 2016-11-02T11:25:47.000000 | - |
| 6 | nova-scheduler | nova-node1.openstack | internal | enabled | up | 2016-11-02T11:25:47.000000 | - |
| 7 | nova-compute | nova-node1.openstack | nova | enabled | up | 2016-11-02T11:25:49.000000 | - |
| 8 | nova-compute | nova-node2.openstack | nova | disabled | down | 2016-11-02T11:25:48.000000 | - |
+----+------------------+-----------------------+----------+----------+-------+----------------------------+-----------------+
在数据库里清理(nova库)
[root@nova-node1 ~]# mysql -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 230863
Server version: 5.5.50-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;
Database changed
MariaDB [nova]> delete from nova.services where host="nova-node2.openstack";
Query OK, 1 row affected (0.00 sec)
MariaDB [nova]> delete from compute_nodes where hypervisor_hostname="nova-node2.openstack";
Query OK, 1 row affected (0.00 sec)
MariaDB [nova]> select host from nova.services;
+-----------------------+
| host |
+-----------------------+
| nova-node1.openstack |
| nova-node1.openstack |
| nova-node1.openstack |
| nova-node1.openstack |
| nova-node1.openstack |
+-----------------------+
5 rows in set (0.00 sec)
MariaDB [nova]> select hypervisor_hostname from compute_nodes;
+-----------------------+
| hypervisor_hostname |
+-----------------------+
| nova-node1.openstack |
+-----------------------+
1 row in set (0.00 sec)
再次查看计算节点,就发现已经删除了nova-node2.openstack
[root@nova-node1 src]# openstack host list
+-----------------------+-------------+----------+
| Host Name | Service | Zone |
+-----------------------+-------------+----------+
| nova-node1.openstack | conductor | internal |
| nova-node1.openstack | cert | internal |
| nova-node1.openstack | consoleauth | internal |
| nova-node1.openstack | scheduler | internal |
| nova-node1.openstack | compute | nova |
+-----------------------+-------------+----------+
[root@nova-node1 src]# nova service-list
+----+------------------+-----------------------+----------+---------+-------+----------------------------+-----------------+
| Id | Binary | Host | Zone | Status | State | Updated_at | Disabled Reason |
+----+------------------+-----------------------+----------+---------+-------+----------------------------+-----------------+
| 1 | nova-conductor | nova-node1.openstack | internal | enabled | up | 2016-11-02T11:44:08.000000 | - |
| 4 | nova-cert | nova-node1.openstack | internal | enabled | up | 2016-11-02T11:44:08.000000 | - |
| 5 | nova-consoleauth | nova-node1.openstack | internal | enabled | up | 2016-11-02T11:44:07.000000 | - |
| 6 | nova-scheduler | nova-node1.openstack | internal | enabled | up | 2016-11-02T11:44:07.000000 | - |
| 7 | nova-compute | nova-node1.openstack | nova | enabled | up | 2016-11-02T11:44:09.000000 | - |
+----+------------------+-----------------------+----------+---------+-------+----------------------------+-----------------+