OpenStack manual distributed deployment of Nova [Queens version]

Table of contents

Introduction to Nove:

1. Log in to the database configuration (executed in the controller)

  1.1 Login to the database

  1.2 Create nova-api in the database

  1.3 Database login authorization

  1.4 Create nova user

  1.5 Add admin user as nova user

  1.6 Create a nova service endpoint

  1.7 Create compute API service endpoint

  1.8 Create a placement service user 

  1.9 Add the placement user as the project service admin role 

  1.10 Create a Placement API service in the service directory 

  1.11 Create a Placement API service endpoint 

2. Install nova (executed in the controller)

  2.1 Install the software package

  2.2 Edit /etc/nova/nova.conf

  2.3 Restart the HTTP service and synchronize the database

  2.4 Start computing various services

  2.5 Make a restart script

3. Then configure on the computing node (executed in compute)

  3.1 Install nova on the computing node

  3.2 Modify /etc/nova/nova.conf configuration

  3.3 Start the service

4. Verify on the controller node

  4.1 Verify whether there is a computing node on the controller node

  4.2 Discover computing nodes

  4.3 Configuring automatic discovery nodes


Introduction to Nove:

The nova component is used to build virtual machines (function: responsible for responding to virtual machine creation requests, scheduling, and destroying cloud hosts)

The main components of nova:

  • (1). nova api service------Installed on the controller node: accept and send requests from corresponding clients, and nova-api is responsible for receiving and responding to end-user requests from managed virtual machines and cloud hard disks. That is to say, I want to create a virtual machine in openstack (the creation of the virtual machine is finally completed in nova), and the request I send is received by nova-api and sent to nova, and then the next step is specific operation, nova-api It is the entrance of the whole nova. It receives user requests, sends instructions to the message queue, and executes related instruction messages by corresponding services. It provides openstack API, Amazon EC2 API, and administrator control API.
  • (2) nova-api-metadata service: Accepts requests from instance metadata. This service is usually run in host-to-host mode on the nova-network service, which means it can only be used by multiple nova nodes.
  • (3) nova compute------installed on the compute node: it is the core service in the nova component, which realizes the function of managing virtual machines, and realizes the creation, startup, suspension, shutdown, and deletion on the computing node virtual machine.
  • (4) nova Scheduler: It mainly plays a scheduling role. If there are multiple nova computing nodes now, when the user initiates a request to create a virtual machine, nova Scheduler will decide to create the virtual machine on that computing node.
  • (5) nova conductor: It mainly provides data query function and provides interactive data between nova compute and Database, so why doesn't nova compute directly access the database? Just to prevent nova compute from being attacked, the database will be insecure, so nova conductor is needed to schedule

1. Log in to the database configuration (executed in the controller)

  1.1 Login to the database

[root@controller ~]# mysql -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 18
Server version: 10.3.20-MariaDB MariaDB Server
 
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
MariaDB [(none)]> 

  1.2 Create nova-api in the database

MariaDB [(none)]> CREATE DATABASE nova_api;
Query OK, 1 row affected (0.001 sec)

MariaDB [(none)]> CREATE DATABASE nova;
Query OK, 1 row affected (0.002 sec)

MariaDB [(none)]>  CREATE DATABASE nova_cell0;
Query OK, 1 row affected (0.001 sec)

  1.3 Database login authorization

GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY '000000';
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY '000000';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY '000000';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY '000000';
GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' IDENTIFIED BY '000000';
GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY '000000';

[Remember to exit the database]

MariaDB [(none)]> quit;
Bye

  1.4 Create nova user

openstack user create --domain default --password nova nova

  

  1.5 Add admin user as nova user

openstack role add --project service --user nova admin

  1.6 Create a nova service endpoint

openstack service create --name nova --description "OpenStack Compute" compute

  1.7 Create compute API service endpoint

openstack endpoint create --region RegionOne compute public http://controller:8774/v2.1

  

  1.8 Create a placement service user 

openstack user create --domain default --password-prompt placement

  

  1.9 Add the placement user as the project service admin role 

openstack role add --project service --user placement admin

  1.10 Create a Placement API service in the service directory 

openstack service create --name placement --description "Placement API" placement

  1.11 Create a Placement API service endpoint 

openstack endpoint create --region RegionOne placement public http://controller:8778

  

2. Install nova (executed in the controller)

  2.1 Install the software package

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

  2.2 Edit /etc/nova/nova.conf

[root@controller ~]# cp /etc/nova/nova.conf{,.bak}
[root@controller ~]# grep -Ev "^$|#" /etc/nova/nova.conf.bak > /etc/nova/nova.conf
[root@controller ~]# vi /etc/nova/nova.conf
[DEFAULT]
enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:123456@controller
my_ip = 172.16.21.37
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[api_database]
 
connection = mysql+pymysql://nova:000000@controller/nova_api
 
[database]
 
connection = mysql+pymysql://nova:000000@controller/nova
 
[api]
auth_strategy = keystone
 
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = 000000
 
[vnc]
enabled = true
server_listen = $my_ip
server_proxyclient_address = $my_ip
 
[glance]
api_servers = http://controller:9292
 
[oslo_concurrency]
lock_path = /var/lib/nova/tmp
 
[placement]
os_region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://controller:35357/v3
username = placement
password = 000000

##Add the following configuration to the /etc/httpd/conf.d/00-nova-placement-api.conf file due to a bug in the software package 

<Directory /usr/bin>
   <IfVersion >= 2.4>
      Require all granted
   </IfVersion>
   <IfVersion < 2.4>
      Order allow,deny
      Allow from all
   </IfVersion>
</Directory>

  2.3 Restart the HTTP service and synchronize the database

systemctl restart httpd
[root@controller ~]# su -s /bin/sh -c "nova-manage api_db sync" nova
[root@controller ~]# su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
[root@controller ~]# su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
2e46e668-cfaf-4034-b6a8-154dc925c12d
[root@controller ~]# 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)
[root@controller ~]# 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:****@controller/nova_cell0 |  False   |
| cell1 | 2e46e668-cfaf-4034-b6a8-154dc925c12d | rabbit://openstack:****@controller:5672/ |    mysql+pymysql://nova:****@controller/nova    |  False   |
+-------+--------------------------------------+------------------------------------------+-------------------------------------------------+----------+

  2.4 Start computing various services

[root@controller ~]# systemctl enable \
     openstack-nova-api.service \
     openstack-nova-scheduler.service \
     openstack-nova-conductor.service \
     openstack-nova-novncproxy.service
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-api.service to /usr/lib/systemd/system/openstack-nova-api.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-scheduler.service to /usr/lib/systemd/system/openstack-nova-scheduler.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-conductor.service to /usr/lib/systemd/system/openstack-nova-conductor.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-novncproxy.service to /usr/lib/systemd/system/openstack-nova-novncproxy.service.

  2.5 Make a restart script

[root@controller ~]# vi nova-restart.sh


#!/bin/bash
systemctl restart     openstack-nova-api.service     openstack-nova-scheduler.service     openstack-nova-conductor.service     openstack-nova-novncproxy.service


[root@controller ~]# bash nova-restart.sh 

3. Then configure on the computing node (executed in compute)

  3.1 Install nova on the computing node

[root@computer ~]# yum install openstack-nova-compute -y

  3.2 Modification/etc/nova/nova.conf配置

[root@computer ~]# yum install openstack-nova-compute -y^C
[root@computer ~]# cp /etc/nova/nova.conf{,.bak}
[root@computer ~]# grep -Ev "^$|#" /etc/nova/nova.conf.bak > /etc/nova/nova.conf
[root@computer ~]# vi /etc/nova/nova.conf

[DEFAULT]
 
enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:000000@controller
my_ip = 172.16.21.37
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
 
[api]
auth_strategy = keystone
 
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = 000000
 
[vnc]
enabled = True
server_listen = 0.0.0.0
server_proxyclient_address = $my_ip
novncproxy_base_url = http://controller:6080/vnc_auto.html
 
[glance]
api_servers = http://controller:9292
 
[oslo_concurrency]
lock_path = /var/lib/nova/tmp
 
[placement]
os_region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://controller:35357/v3
username = placement
password = 000000

  3.3 Start the service

[root@computer ~]# systemctl enable libvirtd.service openstack-nova-compute.service
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-compute.service to /usr/lib/systemd/system/openstack-nova-compute.service.
[root@computer ~]# systemctl start libvirtd
[root@computer ~]# systemctl start libvirtd.service openstack-nova-compute.service

4. Verify on the controller node

  4.1 Verify whether there is a computing node on the controller node

[root@controller ~]# openstack compute service list --service nova-compute
+----+--------------+----------+------+---------+-------+----------------------------+
| ID | Binary       | Host     | Zone | Status  | State | Updated At                 |
+----+--------------+----------+------+---------+-------+----------------------------+
|  9 | nova-compute | computer | nova | enabled | up    | 2023-02-10T15:15:29.000000 |
+----+--------------+----------+------+---------+-------+----------------------------+

  4.2 Discover computing nodes

[root@controller ~]# su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova
Found 2 cell mappings.
Skipping cell0 since it does not contain hosts.
Getting computes from cell 'cell1': 87c82cc2-68f4-41d2-8427-5c959215ef1d
Checking host mapping for compute host 'computer': 833f408b-d646-483e-80eb-6f67c390fd43
Creating host mapping for compute host 'computer': 833f408b-d646-483e-80eb-6f67c390fd43
Found 1 unmapped computes in cell: 87c82cc2-68f4-41d2-8427-5c959215ef1d

  4.3 Configuring automatic discovery nodes

[root@controller ~]# vi /etc/nova/nova.conf

[scheduler]
discover_hosts_in_cells_interval = 300

 Nova deployment complete


 

Introduction to OpenStack| Common basic components

OpenStack manual distributed deployment environment preparation [Queens version]

OpenStack manual distributed deployment of Keystone [Queens version]

OpenStack manual distributed deployment of Glance [Queens version]

Guess you like

Origin blog.csdn.net/weixin_43313333/article/details/129404674