6 Openstack-Ussuri-Nova控制节点部署-ubuntu1804
Nova具体功能如下:1 实例生命周期管理2 管理计算资源3 网络和认证管理4 REST风格的API5 异步的一致性通信6 Hypervisor透明:支持Xen,XenServer/XCP, KVM, UML, VMware vSphere and Hyper-V6.1 配置Nova数据库#使用root登陆数据库:mysql -u root -p#创建nova数据库:CREATE DATABASE
Nova具体功能如下:
1 实例生命周期管理
2 管理计算资源
3 网络和认证管理
4 REST风格的API
5 异步的一致性通信
6 Hypervisor透明:支持Xen,XenServer/XCP, KVM, UML, VMware vSphere and Hyper-V
6.1 配置Nova数据库
#使用root登陆数据库:
mysql -u root -p
#创建nova数据库:
CREATE DATABASE nova_api;
CREATE DATABASE nova;
CREATE DATABASE nova_cell0;
#授予对nova数据库的访问权限,刷新退出数据库:
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' \
IDENTIFIED BY 'nova.123';
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' \
IDENTIFIED BY 'nova.123';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' \
IDENTIFIED BY 'nova.123';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' \
IDENTIFIED BY 'nova.123';
GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' \
IDENTIFIED BY 'nova.123';
GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' \
IDENTIFIED BY 'nova.123';
flush privileges;
exit
6.2 加载管理凭证
source adminrc.sh
6.3 创建nova相关服务凭证
#创建nova服务用户,并设置密码为nova.123
openstack user create --domain default --password-prompt nova
#输出
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | default |
| enabled | True |
| id | 2d59698e65e548f698515ffdda60a8bd |
| name | nova |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+
#赋予nova服务用户服务管理员权限及角色,无输出
openstack role add --project service --user nova admin
#创建nova服务
openstack service create --name nova --description "OpenStack Compute" compute
#输出
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Compute |
| enabled | True |
| id | fc0fb7e04b4443cd95be23d91bd0fc51 |
| name | nova |
| type | compute |
+-------------+----------------------------------+
6.4 创建compute API endpoints
#public
openstack endpoint create --region RegionOne compute public http://controller160:8774/v2.1
#输出
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 150302175a7e4c1a972fe47ce020aca7 |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | fc0fb7e04b4443cd95be23d91bd0fc51 |
| service_name | nova |
| service_type | compute |
| url | http://controller160:8774/v2.1 |
+--------------+----------------------------------+
#internal
openstack endpoint create --region RegionOne compute internal http://controller160:8774/v2.1
#输出
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | d2f28b8140d9494e941c29128282b7e0 |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | fc0fb7e04b4443cd95be23d91bd0fc51 |
| service_name | nova |
| service_type | compute |
| url | http://controller160:8774/v2.1 |
+--------------+----------------------------------+
#admin
openstack endpoint create --region RegionOne compute admin http://controller160:8774/v2.1
#输出
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 8bafe5ce2058461bae0afa04014348fb |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | fc0fb7e04b4443cd95be23d91bd0fc51 |
| service_name | nova |
| service_type | compute |
| url | http://controller160:8774/v2.1 |
+--------------+----------------------------------+
6.5 部署与配置nova
#安装包
apt install nova-api nova-conductor nova-novncproxy nova-scheduler -y
#备份nova配置
cp /etc/nova/nova.conf /etc/nova/nova.conf.bak
egrep -v "^$|^#" /etc/nova/nova.conf.bak >/etc/nova/nova.conf
#配置nova配置文件,在对应项底下增加以下字段
#vim /etc/nova/nova.conf
[DEFAULT]
# ...
my_ip = 172.16.1.160
transport_url = rabbit://rabbitmq:rabbitmq.123@controller160:5672/
[api_database]
# ...
connection = mysql+pymysql://nova:nova.123@controller160/nova_api
[database]
# ...
connection = mysql+pymysql://nova:nova.123@controller160/nova
[api]
# ...
auth_strategy = keystone
[keystone_authtoken]
# ...
www_authenticate_uri = http://controller160:5000
auth_url = http://controller160:5000
memcached_servers = controller160:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = nova
password = nova.123
[vnc]
enabled = true
# ...
server_listen = $my_ip
server_proxyclient_address = $my_ip
[glance]
# ...
api_servers = http://controller160:9292
[oslo_concurrency]
# ...
lock_path = /var/lib/nova/tmp
[placement]
# ...
region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://controller160:5000/v3
username = placement
password = placement.123
#填充nova-api数据库,无输出
su -s /bin/sh -c "nova-manage api_db sync" nova
#填充cell0数据库,无输出
su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
#创建cell1表
su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
#输出,可忽略warning
--transport-url not provided in the command line, using the value [DEFAULT]/transport_url from the configuration file
--database_connection not provided in the command line, using the value [database]/connection from the configuration file
ec2bd311-33de-4c9f-ae88-6d351c8abbb2
#填充nova数据库
su -s /bin/sh -c "nova-manage db sync" nova
#输出,可忽略
/usr/lib/python3/dist-packages/pymysql/cursors.py:165: Warning: (1831, 'Duplicate index `block_device_mapping_instance_uuid_virtual_name_device_name_idx`. This is deprecated and will be disallowed in a future release.')
result = self._query(query)
/usr/lib/python3/dist-packages/pymysql/cursors.py:165: Warning: (1831, 'Duplicate index `uniq_instances0uuid`. This is deprecated and will be disallowed in a future release.')
result = self._query(query)
#验证nova的cell0及cell1是否已成功创建
su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova
#输出
+-------+--------------------------------------+---------------------------------------------+----------------------------------------------------+----------+
| Name | UUID | Transport URL | Database Connection | Disabled |
+-------+--------------------------------------+---------------------------------------------+----------------------------------------------------+----------+
| cell0 | 00000000-0000-0000-0000-000000000000 | none:/ | mysql+pymysql://nova:****@controller160/nova_cell0 | False |
| cell1 | ec2bd311-33de-4c9f-ae88-6d351c8abbb2 | rabbit://openstack:****@controller160:5672/ | mysql+pymysql://nova:****@controller160/nova | False |
+-------+--------------------------------------+---------------------------------------------+----------------------------------------------------+----------+
#验证nova数据库是否正常写入:
mysql -h controller160 -unova -pnova.123 -e "use nova;show tables;"
#重启nova服务,并配置开机启动:
systemctl enable nova-api nova-scheduler nova-conductor nova-novncproxy
systemctl restart nova-api nova-scheduler nova-conductor nova-novncproxy
systemctl status nova-api nova-scheduler nova-conductor nova-novncproxy
6.6 nova服务验证
#加载管理凭证
source adminrc.sh
#执行状态检查,都为success为正常
nova-status upgrade check
#输出
+--------------------------------------------------------------------+
| Upgrade Check Results |
+--------------------------------------------------------------------+
| Check: Cells v2 |
| Result: Success |
| Details: No host mappings or compute nodes were found. Remember to |
| run command 'nova-manage cell_v2 discover_hosts' when new |
| compute hosts are deployed. |
+--------------------------------------------------------------------+
| Check: Placement API |
| Result: Success |
| Details: None |
+--------------------------------------------------------------------+
| Check: Ironic Flavor Migration |
| Result: Success |
| Details: None |
+--------------------------------------------------------------------+
| Check: Cinder API |
| Result: Success |
| Details: None |
+--------------------------------------------------------------------+
至此,nova服务已部署完毕,如有问题请联系我改正,感激不尽!
6.x 部署过程遇到的问题汇总
eg1.root@controller160:~# apt install nova-api nova-conductor nova-novncproxy nova-scheduler
The following packages have unmet dependencies:
nova-api : Depends: python3-nova (= 2:21.0.0~b3~git2020041013.57ff308d6d-0ubuntu2~cloud0) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
解决方案:
1 查看apt源是否设置正确
2 apt-get update
3 apt-get dist-upgrade
4 apt-get -f 命令(修复受损软件包)
eg2.ERROR oslo_service.service amqp.exceptions.AccessRefused: (0, 0): (403) ACCESS_REFUSED - Login was refused using authentication mechanism AMQPLAIN. For details see the broker logfile.
解决方案:
1 查看nova配置里的rabbitmq配置是否正常
2 查看rabbitmq是否有创建对应的用户及权限
3 如果是账号错误需要操作如下:
root@controller160:/etc/apt# su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova
+-------+--------------------------------------+---------------------------------------------+----------------------------------------------------+----------+
| Name | UUID | Transport URL | Database Connection | Disabled |
+-------+--------------------------------------+---------------------------------------------+----------------------------------------------------+----------+
| cell0 | 00000000-0000-0000-0000-000000000000 | none:/ | mysql+pymysql://nova:****@controller160/nova_cell0 | False |
| cell1 | a3527e1f-85dc-46a6-bd17-af5f19b3a725 | rabbit://openstack:****@controller160:5672/ | mysql+pymysql://nova:****@controller160/nova | False |
+-------+--------------------------------------+---------------------------------------------+----------------------------------------------------+----------+
#停止服务
root@controller160:/etc/apt# systemctl stop nova-api nova-scheduler nova-conductor nova-novncproxy
#修改nova.conf配置里的rabbitmq_url为正确的账号
#删除使用错误账户的cell
root@controller160:/etc/apt# su -s /bin/sh -c "nova-manage cell_v2 delete_cell --cell_uuid a3527e1f-85dc-46a6-bd17-af5f19b3a725" nova
#重新创建cell1
root@controller160:/etc/apt# su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
--transport-url not provided in the command line, using the value [DEFAULT]/transport_url from the configuration file
--database_connection not provided in the command line, using the value [database]/connection from the configuration file
74d4b65d-4d9c-4699-885e-4a773e295ef8
#验证是否正解
root@controller160:/etc/apt# su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova
+-------+--------------------------------------+--------------------------------------------+----------------------------------------------------+----------+
| Name | UUID | Transport URL | Database Connection | Disabled |
+-------+--------------------------------------+--------------------------------------------+----------------------------------------------------+----------+
| cell0 | 00000000-0000-0000-0000-000000000000 | none:/ | mysql+pymysql://nova:****@controller160/nova_cell0 | False |
| cell1 | 74d4b65d-4d9c-4699-885e-4a773e295ef8 | rabbit://rabbitmq:****@controller160:5672/ | mysql+pymysql://nova:****@controller160/nova | False |
+-------+--------------------------------------+--------------------------------------------+----------------------------------------------------+----------+
#重新启动服务
systemctl start nova-api nova-scheduler nova-conductor nova-novncproxy
#查看对应日志是否还有报错
更多推荐
所有评论(0)