Openstack+Ceph 安装及配置-05.1-Openstack-Yoga Nova-Compute安装-控制节点

配置数据库

[root@node-1 ~]# mysql -u root -p
MariaDB [(none)]> CREATE DATABASE nova_api;
MariaDB [(none)]> CREATE DATABASE nova;
MariaDB [(none)]> CREATE DATABASE nova_cell0;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY 'NovaComputesq123';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%'  IDENTIFIED BY 'NovaComputesq123';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY 'NovaComputesq123';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%'  IDENTIFIED BY 'NovaComputesq123';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' IDENTIFIED BY 'NovaComputesq123';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY 'NovaComputesq123';

创建nova用户

[root@node-1 ~]# openstack user create --domain default --password-prompt nova
User Password:
Repeat User Password:NovaComputes123
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 2b035d06aafc4298953b5d3a2b45cd1b |
| name                | nova                             |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+
#修改密码如下
# openstack user set --password NovaComputesq123 nova

将nova用户加入admin角色

[root@node-1 ~]# openstack role add --project service --user nova admin

[root@node-1 ~]# openstack role add --project service --user nova admin

创建compute服务

[root@node-1 ~]# openstack service create --name nova --description "OpenStack Compute" compute
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Compute                |
| enabled     | True                             |
| id          | 709ad910f073468690eb91ea30a2944e |
| name        | nova                             |
| type        | compute                          |
+-------------+----------------------------------+

注册服务

[root@node-1 ~]# openstack endpoint create --region RegionOne compute public http://node-1:8774/v2.1
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 89997490d95e4678b80fd656d35374cd |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 709ad910f073468690eb91ea30a2944e |
| service_name | nova                             |
| service_type | compute                          |
| url          | http://node-1:8774/v2.1     |
+--------------+----------------------------------+
[root@node-1 ~]# openstack endpoint create --region RegionOne compute internal http://node-1:8774/v2.1
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | bd117c638da24c3ea491f4932c9dfb39 |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 709ad910f073468690eb91ea30a2944e |
| service_name | nova                             |
| service_type | compute                          |
| url          | http://node-1:8774/v2.1     |
+--------------+----------------------------------+
[root@node-1 ~]# openstack endpoint create --region RegionOne compute admin http://node-1:8774/v2.1
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 141eef06e333424ebf999111aa3832d3 |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 709ad910f073468690eb91ea30a2944e |
| service_name | nova                             |
| service_type | compute                          |
| url          | http://node-1:8774/v2.1     |
+--------------+----------------------------------+

安装

yum install openstack-nova-api openstack-nova-conductor openstack-nova-novncproxy openstack-nova-scheduler -y


配置Nova-compute

[root@node-1 ~]# vim /etc/nova/nova.conf
[root@node-1 ~]# grep -v -E "#|^$" /etc/nova/nova.conf 
[DEFAULT]
enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:RabbitMQ123@node-1:5672/
my_ip=172.16.1.81
[api]
auth_strategy = keystone
[api_database]
connection = mysql+pymysql://nova:NovaComputesq123@node-1/nova_api
[barbican]
[cache]
[cinder]
[compute]
[conductor]
[console]
[consoleauth]
[cors]
[cyborg]
[database]
connection = mysql+pymysql://nova:NovaComputesq123@node-1@node-1/nova
[devices]
[ephemeral_storage_encryption]
[filter_scheduler]
[glance]
api_servers = http://node-1:9292
[guestfs]
[healthcheck]
[hyperv]
[image_cache]
[ironic]
[key_manager]
[keystone]
[keystone_authtoken]
www_authenticate_uri = http://node-1:5000/
auth_url = http://node-1:5000/
memcached_servers = node-1:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = nova
password = NovaComputes123
[libvirt]
[metrics]
[mks]
[neutron]
[notifications]
[oslo_concurrency]
lock_path = /var/lib/nova/tmp
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_middleware]
[oslo_policy]
[pci]
[placement]
region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://node-1:5000/v3
username = placement
password = Placement123
[powervm]
[privsep]
[profiler]
[quota]
[rdp]
[remote_debug]
[scheduler]
[serial_console]
[service_user]
[spice]
[upgrade_levels]
[vault]
[vendordata_dynamic_auth]
[vmware]
[vnc]
enabled = true
server_listen = $my_ip
server_proxyclient_address = $my_ip
[workarounds]
[wsgi]
[zvm]

初始化服务

[root@node-1 ~]# su -s /bin/sh -c "nova-manage api_db sync" nova    #初始化api数据库
[root@node-1 ~]# su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova     #注册cell0数据库
[root@node-1 ~]# su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova         #创建cell1
--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
7414a0dc-048f-40d2-981a-74d894df3c51
[root@node-1 ~]# su -s /bin/sh -c "nova-manage db sync" nova   #初始化db数据库
[root@node-1 ~]# su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova   验证cell0和cell1是否正确
+-------+--------------------------------------+-------------------------------------------+--------------------------------------------------+----------+
|  名称 |                 UUID                 |               Transport URL               |                    数据库连接                    | Disabled |
+-------+--------------------------------------+-------------------------------------------+--------------------------------------------------+----------+
| cell0 | 00000000-0000-0000-0000-000000000000 |                   none:/                  | mysql+pymysql://nova:****@node-1/nova_cell0 |  False   |
| cell1 | 7414a0dc-048f-40d2-981a-74d894df3c51 | rabbit://openstack:****@node-1:5672/ |    mysql+pymysql://nova:****@node-1/nova    |  False   |
+-------+--------------------------------------+-------------------------------------------+--------------------------------------------------+----------+

启动服务

[root@node-1 ~]# systemctl enable openstack-nova-api.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
Created symlink /etc/systemd/system/multi-user.target.wants/openstack-nova-api.service → /usr/lib/systemd/system/openstack-nova-api.service.
Created symlink /etc/systemd/system/multi-user.target.wants/openstack-nova-scheduler.service → /usr/lib/systemd/system/openstack-nova-scheduler.service.
Created symlink /etc/systemd/system/multi-user.target.wants/openstack-nova-conductor.service → /usr/lib/systemd/system/openstack-nova-conductor.service.
Created symlink /etc/systemd/system/multi-user.target.wants/openstack-nova-novncproxy.service → /usr/lib/systemd/system/openstack-nova-novncproxy.service.
[root@node-1 ~]# systemctl start openstack-nova-api.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service

 

posted @ 2023-02-20 17:13  苦逼挨踢男  阅读(86)  评论(0编辑  收藏  举报