[root@controller1 ~]# vim /etc/haproxy/haproxy.cfg
listen mysql
bind 192.168.200.101:3306
mode tcp
server mysql1 192.168.200.105:3306 check inter 3s fall 3 rise 3
listen memcached
bind 192.168.200.101:11211
mode tcp
server memcached 192.168.200.105:11211 check inter 3s fall 3 rise 3
listen rabbitmq
bind 192.168.200.101:5672
mode tcp
server rabbitmq 192.168.200.105:5672 check inter 3s fall 3 rise 3
[root@controller1 ~]# systemctl restart haproxy
参考安装网站
https://docs.openstack.org/nova/stein/install/controller-install-rdo.html
本节介绍如何在控制器节点上安装和配置代号为nova的Compute服务。
在安装和配置Compute服务之前,必须创建数据库,服务凭证和API端点。
创建nova_api,nova和nova_cell0数据库:
MariaDB [(none)]> CREATE DATABASE nova_api;
MariaDB [(none)]> CREATE DATABASE nova;
MariaDB [(none)]> CREATE DATABASE nova_cell0;
创建授权
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'nova123';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'nova123';
GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY 'nova123';
创建nova用户
[root@controller1 ~]# openstack user create --domain default --password-prompt nova
User Password: nova
Repeat User Password: nova
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | c12058276278430fbf36271c39c4e356 |
| enabled | True |
| id | 18f5d41e54344a84a85f2ce6dcbc2cd6 |
| name | nova |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+
admin向nova用户添加角色:
[root@controller1 ~]# openstack role add --project service --user nova admin
创建nova服务实体:
[root@controller1 ~]# openstack service create --name nova --description "OpenStack Compute" compute
创建Compute API服务端点:
[root@controller1 ~]#openstack endpoint create --region RegionOne compute public http://openstack-vip.wyh.net:8774/v2.1
[root@controller1 ~]#openstack endpoint create --region RegionOne compute internal http://openstack-vip.wyh.net:8774/v2.1
[root@controller1 ~]#openstack endpoint create --region RegionOne compute admin http://openstack-vip.wyh.net:8774/v2.1
安装和配置的部件
[root@controller1 ~]# yum install openstack-nova-console
[root@controller1 ~]# yum install openstack-nova-api openstack-nova-conductor openstack-nova-novncproxy openstack-nova-scheduler
编辑/etc/nova/nova.conf文件并完成以下操作:
在此[DEFAULT]部分中,仅启用计算和元数据API:
[DEFAULT]
enabled_apis = osapi_compute,metadata
在[api_database]和[database]部分中,配置数据库访问权限:
[api_database]
connection = mysql+pymysql://nova:nova123@openstack-vip.wyh.net/nova_api
[database]
connection = mysql+pymysql://nova:nova123@openstack-vip.wyh.net/nova
在该[DEFAULT]部分中,配置RabbitMQ消息队列访问:
[DEFAULT]
transport_url = rabbit://openstack:openstack123@openstack-vip.wyh.net
在[api]和[keystone_authtoken]部分中,配置身份服务访问:
[api]
# ...
auth_strategy = keystone
[keystone_authtoken]
auth_url = http://openstack-vip.wyh.net:5000/v3
memcached_servers = openstack-vip.wyh.net:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = nova
password = nova
在该[DEFAULT]部分中,配置my_ip选项以使用控制器节点的管理接口IP地址:
[DEFAULT]
my_ip = 192.168.200.101
在本[DEFAULT]节中,启用对网络服务的支持:
use_neutron = true
firewall_driver = nova.virt.firewall.NoopFirewallDriver
在该[vnc]部分中,将VNC代理配置为使用控制器节点的管理接口IP地址:
[vnc]
enabled = true
server_listen = 192.168.200.101
server_proxyclient_address = 192.168.200.101
在该[glance]部分中,配置图像服务API的位置:
[glance]
api_servers = http://openstack-vip.wyh.net:9292
在该[oslo_concurrency]部分中,配置锁定路径:
[oslo_concurrency]
lock_path = /var/lib/nova/tmp
在该[placement]部分中,配置对展示位置服务的访问权限:
[placement]
region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://openstack-vip.wyh.net:5000/v3
username = placement
password = placement
填充nova-api数据库:
[root@controller1 ~]# su -s /bin/sh -c "nova-manage api_db sync" nova
注册cell0数据库:
[root@controller1 ~]# su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
创建cell1单元格:
[root@controller1 ~]# su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
1d44ff8f-3490-4d9b-a713-cdf90a8b470f
填充nova数据库:
[root@controller1 ~]# su -s /bin/sh -c "nova-manage db sync" nova
注意出现这个没有影响
/usr/lib/python2.7/site-packages/pymysql/cursors.py:170: Warning: (1831, u'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/python2.7/site-packages/pymysql/cursors.py:170: Warning: (1831, u'Duplicate index `uniq_instances0uuid`. This is deprecated and will be disallowed in a future release')
result = self._query(query)
验证nova cell0和cell1是否正确注册:
[root@controller1 ~]# 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:****@openstack-vip.wyh.net/nova_cell0 | False |
| cell1 | 1d44ff8f-3490-4d9b-a713-cdf90a8b470f | rabbit://openstack:****@openstack-vip.wyh.net | mysql+pymysql://nova:****@openstack-vip.wyh.net/nova | False |
+-------+--------------------------------------+-----------------------------------------------+------------------------------------------------------------+----------+
启动Compute服务并将其配置为在系统启动时启动:
`nova-consoleauth`自18.0.0(Rocky)起不推荐使用,并将在以后的版本中删除。每个单元应部署控制台代理。如果执行全新安装(而非升级),则可能不需要安装`nova-consoleauth` 服务。有关[`workarounds.enable_consoleauth`](https://docs.openstack.org/nova/stein/configuration/config.html#workarounds.enable_consoleauth "enable_consoleauth")详细信息,请参见 。
# systemctl enable openstack-nova-api.service \
openstack-nova-consoleauth openstack-nova-scheduler.service \
openstack-nova-conductor.service openstack-nova-novncproxy.service
# systemctl start openstack-nova-api.service \
openstack-nova-consoleauth openstack-nova-scheduler.service \
openstack-nova-conductor.service openstack-nova-novncproxy.service
查看注册信息
[root@controller1 ~]# openstack host list
+---------------------+-------------+----------+
| Host Name | Service | Zone |
+---------------------+-------------+----------+
| controller1.wyh.net | scheduler | internal |
| controller1.wyh.net | consoleauth | internal |
| controller1.wyh.net | conductor | internal |
+---------------------+-------------+----------+
查看nova服务
[root@controller1 ~]# nova service-list
+--------------------------------------+------------------+---------------------+----------+---------+-------+----------------------------+-----------------+-------------+
| Id | Binary | Host | Zone | Status | State | Updated_at | Disabled Reason | Forced down |
+--------------------------------------+------------------+---------------------+----------+---------+-------+----------------------------+-----------------+-------------+
| 690cfdc8-8c32-431a-b64b-4587b137b6df | nova-scheduler | controller1.wyh.net | internal | enabled | up | 2019-12-17T14:37:48.000000 | - | False |
| 59ddd32e-fea4-4496-9266-28bb6d430a89 | nova-consoleauth | controller1.wyh.net | internal | enabled | up | 2019-12-17T14:37:48.000000 | - | False |
| bea85a78-b167-428e-90fb-ed42ffafe95e | nova-conductor | controller1.wyh.net | internal | enabled | up | 2019-12-17T14:37:48.000000 | - | False |
+--------------------------------------+------------------+---------------------+----------+---------+-------+----------------------------+-----------------+-------------+
网友评论