How to delete duplicate service on Nova

20 Oct

remove duplicate service on nova

I found duplicate services in OpenStack after changing the hostname. Although it does not cause a serious problem but it makes me uncomfortable and I wanted to remove it. As we know, nova keeps these parameters in the nova database (I used MariaDB).

How to delete the duplicate services in the Nova service list?

Login into nova database, we can use root or nova database account, there is no different steps.

# mysql -u root -p

Then change the database access to nova:

MariaDB [nova]> use nova;

Show the existing services

MariaDB [nova]> select * from services;

And the result:

MariaDB [nova]> select * from services;
+———————+———————+————+—-+———————–+——————+————-+————–+———-+———+—————–+
| created_at | updated_at | deleted_at | id | host | binary | topic | report_count | disabled | deleted | disabled_reason |
+———————+———————+————+—-+———————–+——————+————-+————–+———-+———+—————–+
| 2015-10-14 20:15:29 | 2015-10-19 14:16:49 | NULL | 1 | dashboard.zeromail.us | nova-consoleauth | consoleauth | 3065 | 0 | 0 | NULL |
| 2015-10-14 20:15:30 | 2015-10-19 14:16:49 | NULL | 2 | dashboard.zeromail.us | nova-scheduler | scheduler | 3065 | 0 | 0 | NULL |
| 2015-10-14 20:15:30 | 2015-10-19 14:16:49 | NULL | 3 | dashboard.zeromail.us | nova-conductor | conductor | 2767 | 0 | 0 | NULL |
| 2015-10-14 20:15:30 | 2015-10-19 14:16:49 | NULL | 4 | dashboard.zeromail.us | nova-cert | cert | 3065 | 0 | 0 | NULL |
| 2015-10-14 20:35:42 | 2015-10-20 01:02:11 | NULL | 5 | compute.zeromail.us | nova-compute | compute | 6146 | 0 | 0 | NULL |
| 2015-10-19 14:17:54 | 2015-10-20 01:02:13 | NULL | 6 | controller | nova-cert | cert | 3706 | 0 | 0 | NULL |
| 2015-10-19 14:17:56 | 2015-10-20 01:02:14 | NULL | 7 | controller | nova-scheduler | scheduler | 3706 | 0 | 0 | NULL |
| 2015-10-19 14:17:56 | 2015-10-20 01:02:12 | NULL | 8 | controller | nova-conductor | conductor | 3706 | 0 | 0 | NULL |
| 2015-10-19 14:17:57 | 2015-10-20 01:02:14 | NULL | 9 | controller | nova-consoleauth | consoleauth | 3706 | 0 | 0 | NULL |
+———————+———————+————+—-+———————–+——————+————-+————–+———-+———+—————–+
9 rows in set (0.00 sec)

And here is to remove unused service in the nova database:

MariaDB [nova]> delete from services where host=’dashboard.zeromail.us’;

The next step is to check the service record inside the nova database:

MariaDB [nova]> select * from services;
+———————+———————+————+—-+———————+——————+————-+————–+———-+———+—————–+
| created_at | updated_at | deleted_at | id | host | binary | topic | report_count | disabled | deleted | disabled_reason |
+———————+———————+————+—-+———————+——————+————-+————–+———-+———+—————–+
| 2015-10-14 20:35:42 | 2015-10-20 01:03:01 | NULL | 5 | compute.zeromail.us | nova-compute | compute | 6151 | 0 | 0 | NULL |
| 2015-10-19 14:17:54 | 2015-10-20 01:03:03 | NULL | 6 | controller | nova-cert | cert | 3711 | 0 | 0 | NULL |
| 2015-10-19 14:17:56 | 2015-10-20 01:03:04 | NULL | 7 | controller | nova-scheduler | scheduler | 3711 | 0 | 0 | NULL |
| 2015-10-19 14:17:56 | 2015-10-20 01:03:02 | NULL | 8 | controller | nova-conductor | conductor | 3711 | 0 | 0 | NULL |
| 2015-10-19 14:17:57 | 2015-10-20 01:03:04 | NULL | 9 | controller | nova-consoleauth | consoleauth | 3711 | 0 | 0 | NULL |
+———————+———————+————+—-+———————+——————+————-+————–+———-+———+—————–+

And the final check, we need to verify the modification from nova command line interface:

#nova service-list

Here is the output:

+—-+——————+———————+———-+———+——-+—————————-+—————–+
| Id | Binary | Host | Zone | Status | State | Updated_at | Disabled Reason |
+—-+——————+———————+———-+———+——-+—————————-+—————–+
| 5 | nova-compute | compute.zeromail.us | nova | enabled | up | 2015-10-20T01:09:41.000000 | – |
| 6 | nova-cert | controller | internal | enabled | up | 2015-10-20T01:09:33.000000 | – |
| 7 | nova-scheduler | controller | internal | enabled | up | 2015-10-20T01:09:34.000000 | – |
| 8 | nova-conductor | controller | internal | enabled | up | 2015-10-20T01:09:32.000000 | – |
| 9 | nova-consoleauth | controller | internal | enabled | up | 2015-10-20T01:09:34.000000 | – |
+—-+——————+———————+———-+———+——-+—————————-+—————–+

Hope this help.

Leave a Reply

Your email address will not be published. Required fields are marked *

*