Openstack新增节点

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Openstack新增节点相关的知识,希望对你有一定的参考价值。

1、新增步骤

确认机器信息,包括主机名,ip,mac地址,远控地址信息.
登录远控查看机器确认raid和磁盘状态,如果都是统一的大盘做1个raid6,如果有小盘又有大盘,小盘做raid1用作系统盘,把大盘做一个raid6用作数据盘.
配置cobbler,重装系统,确认机器状态.
通过salt并推配置,查看是否有错误日志,确认nova和neutron服务状态.
在新开的机器上配置虚拟机迁移配置,(1)usermod -s /bin/bash nova(2)在已开好的openstack机器上同步/var/lib/nova下的.ssh秘钥文件.
控制节点查看信息,并添加计算节点,在管理节点执行命令 su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova .
开虚拟机测试是否正常.

2、备注

扩容节点时nova启动异常,注意升级python2的pstuil版本
# 主节点执行
. admin-openrc

# 检查nova-compute服务是否正常
openstack compute service list

# 数据库增加计算节点记录
su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova

# 验证所有API是否正常
nova-status upgrade check

openstack中彻底删除计算节点的操作记录

 


在使用openstack的过程中,我们经常会添加好几台计算节点来部署虚拟机,在后续使用中由于某些原因,一些计算节点出现了问题,需要将这些出了问题的计算节点从openstack的控制节点中踢出去!但是很多时候,在删除计算节点的时候由于删除不彻底而导致了后面使用openstack出现了诸多问题。

下面记录了在openstack中彻底删除计算节点linux-node2.openstack的操作:

 

在控制节点上操作

查看计算节点

[[email protected] src]# openstack host list
+-----------------------+-------------+----------+
| Host Name             | Service     | Zone     |
+-----------------------+-------------+----------+
| linux-node1.openstack | conductor   | internal |
| linux-node1.openstack | cert        | internal |
| linux-node1.openstack | consoleauth | internal |
| linux-node1.openstack | scheduler   | internal |
| linux-node1.openstack | compute     | nova     |
| linux-node2.openstack | compute     | nova     |
+-----------------------+-------------+----------+

[[email protected] src]# nova service-list  
+----+------------------+-----------------------+----------+---------+-------+----------------------------+-----------------+
| Id | Binary           | Host                  | Zone     | Status  | State | Updated_at                 | Disabled Reason |
+----+------------------+-----------------------+----------+---------+-------+----------------------------+-----------------+
| 1  | nova-conductor   | linux-node1.openstack | internal | enabled | up    | 2016-11-02T11:25:08.000000 | -               |
| 4  | nova-cert        | linux-node1.openstack | internal | enabled | up    | 2016-11-02T11:25:07.000000 | -               |
| 5  | nova-consoleauth | linux-node1.openstack | internal | enabled | up    | 2016-11-02T11:25:07.000000 | -               |
| 6  | nova-scheduler   | linux-node1.openstack | internal | enabled | up    | 2016-11-02T11:25:07.000000 | -               |
| 7  | nova-compute     | linux-node1.openstack | nova     | enabled | up    | 2016-11-02T11:24:59.000000 | -               |
| 8  | nova-compute     | linux-node2.openstack | nova     | enabled | down  | 2016-10-31T05:55:24.000000 | -               |
+----+------------------+-----------------------+----------+---------+-------+----------------------------+-----------------+

虽然上面显示的一个计算节点linux-node2.openstack 的State状态是down,但是Status状态还是enabled可用。
现在需要使它为不可用。

[[email protected] src]# nova service-disable linux-node2.openstack nova-compute  
+-----------------------+--------------+----------+
| Host                  | Binary       | Status   |
+-----------------------+--------------+----------+
| linux-node2.openstack | nova-compute | disabled |
+-----------------------+--------------+----------+
[[email protected] src]# nova service-list  
+----+------------------+-----------------------+----------+----------+-------+----------------------------+-----------------+
| Id | Binary           | Host                  | Zone     | Status   | State | Updated_at                 | Disabled Reason |
+----+------------------+-----------------------+----------+----------+-------+----------------------------+-----------------+
| 1  | nova-conductor   | linux-node1.openstack | internal | enabled  | up    | 2016-11-02T11:25:48.000000 | -               |
| 4  | nova-cert        | linux-node1.openstack | internal | enabled  | up    | 2016-11-02T11:25:47.000000 | -               |
| 5  | nova-consoleauth | linux-node1.openstack | internal | enabled  | up    | 2016-11-02T11:25:47.000000 | -               |
| 6  | nova-scheduler   | linux-node1.openstack | internal | enabled  | up    | 2016-11-02T11:25:47.000000 | -               |
| 7  | nova-compute     | linux-node1.openstack | nova     | enabled  | up    | 2016-11-02T11:25:49.000000 | -               |
| 8  | nova-compute     | linux-node2.openstack | nova     | disabled | down  | 2016-11-02T11:25:48.000000 | -               |
+----+------------------+-----------------------+----------+----------+-------+----------------------------+-----------------+

在数据库里清理(nova库)

[[email protected] ~]# 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="linux-node2.openstack"; 
Query OK, 1 row affected (0.00 sec)
MariaDB [nova]> delete from compute_nodes where hypervisor_hostname="linux-node2.openstack";
Query OK, 1 row affected (0.00 sec)
MariaDB [nova]> select host from nova.services;
+-----------------------+
| host                  |
+-----------------------+
| linux-node1.openstack |
| linux-node1.openstack |
| linux-node1.openstack |
| linux-node1.openstack |
| linux-node1.openstack |
+-----------------------+
5 rows in set (0.00 sec)

MariaDB [nova]> select hypervisor_hostname from compute_nodes;
+-----------------------+
| hypervisor_hostname   |
+-----------------------+
| linux-node1.openstack |
+-----------------------+
1 row in set (0.00 sec)

再次查看计算节点,就发现已经删除了linux-node2.openstack

[[email protected] src]# openstack host list
+-----------------------+-------------+----------+
| Host Name             | Service     | Zone     |
+-----------------------+-------------+----------+
| linux-node1.openstack | conductor   | internal |
| linux-node1.openstack | cert        | internal |
| linux-node1.openstack | consoleauth | internal |
| linux-node1.openstack | scheduler   | internal |
| linux-node1.openstack | compute     | nova     |
+-----------------------+-------------+----------+
[[email protected] src]# nova service-list
+----+------------------+-----------------------+----------+---------+-------+----------------------------+-----------------+
| Id | Binary           | Host                  | Zone     | Status  | State | Updated_at                 | Disabled Reason |
+----+------------------+-----------------------+----------+---------+-------+----------------------------+-----------------+
| 1  | nova-conductor   | linux-node1.openstack | internal | enabled | up    | 2016-11-02T11:44:08.000000 | -               |
| 4  | nova-cert        | linux-node1.openstack | internal | enabled | up    | 2016-11-02T11:44:08.000000 | -               |
| 5  | nova-consoleauth | linux-node1.openstack | internal | enabled | up    | 2016-11-02T11:44:07.000000 | -               |
| 6  | nova-scheduler   | linux-node1.openstack | internal | enabled | up    | 2016-11-02T11:44:07.000000 | -               |
| 7  | nova-compute     | linux-node1.openstack | nova     | enabled | up    | 2016-11-02T11:44:09.000000 | -               |
+----+------------------+-----------------------+----------+---------+-------+----------------------------+-----------------+

  

 

 

 

 

以上是关于Openstack新增节点的主要内容,如果未能解决你的问题,请参考以下文章

二八轮动策略:基础与改进

dfs--汉诺塔

[CentOS 7系列]磁盘分区

ybt1205汉诺塔问题

时间还早

linux格式化大硬盘