본문 바로가기
서버/Cloud

오픈스택 클라우드 서버 구축(Stein)(5)-컴퓨트 서비스(Nova) 설치 및 설정

by WYYOON 2023. 2. 2.
728x90
반응형
SMALL

#Controller Node 설정

1) Add users and others for Nova in Keystone.

더보기

[root@Controller ~(keystone)]# openstack user create --domain default --project service --password servicepassword nova
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| default_project_id  | c5e87c9b460e4f16801b4102019c97e6 |
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 779446a053a5485badeb0332572e877c |
| name                | nova                             |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+

# add nova user in admin role
[root@Controller ~(keystone)]# openstack role add --project service --user nova admin
# add placement user (set in service project)
[root@Controller ~(keystone)]# openstack user create --domain default --project service --password servicepassword placement
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| default_project_id  | c5e87c9b460e4f16801b4102019c97e6 |
| domain_id           | default                          |
| enabled             | True                             |
| id                  | c484baf8cfe74ef5bae7884267f89e3e |
| name                | placement                        |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+

# add placement user in admin role
[root@Controller ~(keystone)]# openstack role add --project service --user placement admin
# add service entry for nova
[root@Controller ~(keystone)]# openstack service create --name nova --description "OpenStack Compute service" compute
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Compute service        |
| enabled     | True                             |
| id          | 143ed5c017284c59ac8f2cbfe94e8819 |
| name        | nova                             |
| type        | compute                          |
+-------------+----------------------------------+

# add service entry for placement
[root@Controller ~(keystone)]# openstack service create --name placement --description "OpenStack Compute Placement service" placement
+-------------+-------------------------------------+
| Field       | Value                               |
+-------------+-------------------------------------+
| description | OpenStack Compute Placement service |
| enabled     | True                                |
| id          | a477998d278c416d89f7bd85233b0650    |
| name        | placement                           |
| type        | placement                           |
+-------------+-------------------------------------+

# define keystone host
[root@Controller ~(keystone)]# export controller=10.0.0.30
# add endpoint for nova (public)
[root@Controller ~(keystone)]# openstack endpoint create --region RegionOne compute public http://$controller:8774/v2.1/%\(tenant_id\)s
+--------------+------------------------------------------+
| Field        | Value                                    |
+--------------+------------------------------------------+
| enabled      | True                                     |
| id           | ec769820e018438689df6b74f2ba95c4         |
| interface    | public                                   |
| region       | RegionOne                                |
| region_id    | RegionOne                                |
| service_id   | 143ed5c017284c59ac8f2cbfe94e8819         |
| service_name | nova                                     |
| service_type | compute                                  |
| url          | http://10.0.0.30:8774/v2.1/%(tenant_id)s |
+--------------+------------------------------------------+

# add endpoint for nova (internal)
[root@Controller ~(keystone)]# openstack endpoint create --region RegionOne compute internal http://$controller:8774/v2.1/%\(tenant_id\)s
+--------------+------------------------------------------+
| Field        | Value                                    |
+--------------+------------------------------------------+
| enabled      | True                                     |
| id           | f324331dc1a34055a87465f47a7507a2         |
| interface    | internal                                 |
| region       | RegionOne                                |
| region_id    | RegionOne                                |
| service_id   | 143ed5c017284c59ac8f2cbfe94e8819         |
| service_name | nova                                     |
| service_type | compute                                  |
| url          | http://10.0.0.30:8774/v2.1/%(tenant_id)s |
+--------------+------------------------------------------+

# add endpoint for nova (admin)
[root@Controller ~(keystone)]# openstack endpoint create --region RegionOne compute admin http://$controller:8774/v2.1/%\(tenant_id\)s
+--------------+------------------------------------------+
| Field        | Value                                    |
+--------------+------------------------------------------+
| enabled      | True                                     |
| id           | 083f799685784c71b5f49b76106c0b3d         |
| interface    | admin                                    |
| region       | RegionOne                                |
| region_id    | RegionOne                                |
| service_id   | 143ed5c017284c59ac8f2cbfe94e8819         |
| service_name | nova                                     |
| service_type | compute                                  |
| url          | http://10.0.0.30:8774/v2.1/%(tenant_id)s |
+--------------+------------------------------------------+

# add endpoint for placement (public)
[root@Controller ~(keystone)]# openstack endpoint create --region RegionOne placement public http://$controller:8778
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | c260b9db1c9745cc8deef69aadeaba0d |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | a477998d278c416d89f7bd85233b0650 |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://10.0.0.30:8778            |
+--------------+----------------------------------+

# add endpoint for placement (internal)
[root@Controller ~(keystone)]# openstack endpoint create --region RegionOne placement internal http://$controller:8778
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 6804a607c3864709a9fa1e926cbe87d3 |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | a477998d278c416d89f7bd85233b0650 |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://10.0.0.30:8778            |
+--------------+----------------------------------+

# add endpoint for placement (admin)
[root@Controller ~(keystone)]# openstack endpoint create --region RegionOne placement admin http://$controller:8778
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 0e5ea8d62ddd479390b93ca6906c092d |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | a477998d278c416d89f7bd85233b0650 |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://10.0.0.30:8778            |
+--------------+----------------------------------+

2) Add a User and Database on MariaDB for Nova.

더보기

[root@Controller ~(keystone)]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 13
Server version: 10.3.10-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)]> create database nova;
Query OK, 1 row affected (0.00 sec)


MariaDB [(none)]> grant all privileges on nova.* to nova@'localhost' identified by 'password';
Query OK, 0 rows affected (0.00 sec)


MariaDB [(none)]> grant all privileges on nova.* to nova@'%' identified by 'password';
Query OK, 0 rows affected (0.00 sec)


MariaDB [(none)]> create database nova_api;
Query OK, 1 row affected (0.00 sec)


MariaDB [(none)]> grant all privileges on nova_api.* to nova@'localhost' identified by 'password';
Query OK, 0 rows affected (0.00 sec)


MariaDB [(none)]> grant all privileges on nova_api.* to nova@'%' identified by 'password';
Query OK, 0 rows affected (0.00 sec)


MariaDB [(none)]> create database nova_placement;
Query OK, 1 row affected (0.00 sec)


MariaDB [(none)]> grant all privileges on nova_placement.* to nova@'localhost' identified by 'password';
Query OK, 0 rows affected (0.00 sec)


MariaDB [(none)]> grant all privileges on nova_placement.* to nova@'%' identified by 'password';
Query OK, 0 rows affected (0.00 sec)


MariaDB [(none)]> create database nova_cell0;
Query OK, 1 row affected (0.00 sec)


MariaDB [(none)]> grant all privileges on nova_cell0.* to nova@'localhost' identified by 'password';
Query OK, 0 rows affected (0.00 sec)


MariaDB [(none)]> grant all privileges on nova_cell0.* to nova@'%' identified by 'password';
Query OK, 0 rows affected (0.00 sec)


MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)


MariaDB [(none)]> exit
Bye

3) Install Nova services.

더보기

[root@Controller ~(keystone)]# yum --enablerepo=centos-openstack-stein,epel -y install openstack-nova

4) Configure Nova.

더보기

[root@Controller ~(keystone)]# mv /etc/nova/nova.conf /etc/nova/nova.conf.org
[root@Controller ~(keystone)]# vi /etc/nova/nova.conf
[DEFAULT]
# define own IP
my_ip = 10.0.0.30
state_path = /var/lib/nova
enabled_apis = osapi_compute,metadata
log_dir = /var/log/nova
# RabbitMQ connection info
transport_url = rabbit://openstack:password@10.0.0.30

[api]
auth_strategy = keystone

# Glance connection info
[glance]
api_servers = http://10.0.0.30:9292

[oslo_concurrency]
lock_path = $state_path/tmp

# MariaDB connection info
[api_database]
connection = mysql+pymysql://nova:password@10.0.0.30/nova_api

[database]
connection = mysql+pymysql://nova:password@10.0.0.30/nova

# Keystone auth info
[keystone_authtoken]
www_authenticate_uri = http://10.0.0.30:5000
auth_url = http://10.0.0.30:5000
memcached_servers = 10.0.0.30:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = servicepassword

[placement]
auth_url = http://10.0.0.30:5000
os_region_name = RegionOne
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = placement
password = servicepassword

[placement_database]
connection = mysql+pymysql://nova:password@10.0.0.30/nova_placement

[wsgi]
api_paste_config = /etc/nova/api-paste.ini

[root@Controller ~(keystone)]# chmod 640 /etc/nova/nova.conf
[root@Controller ~(keystone)]# chgrp nova /etc/nova/nova.conf
[root@Controller ~(keystone)]# vi /etc/httpd/conf.d/00-nova-placement-api.conf
# 15줄 추가
  <Directory /usr/bin>
    Require all granted
  </Directory>
</VirtualHost>

5) If SELinux is enabled, change policy settings.

더보기

[root@Controller ~(keystone)]# yum --enablerepo=centos-openstack-stein -y install openstack-selinux
[root@Controller ~(keystone)]# semanage port -a -t http_port_t -p tcp 8778

6) firewall port 허용 설정

더보기

[root@Controller ~(keystone)]# firewall-cmd --add-port={6080/tcp,6081/tcp,6082/tcp,8774/tcp,8775/tcp,8778/tcp} --permanent
success
[root@Controller ~(keystone)]# firewall-cmd --reload
success

7) Add Data into Database and start Nova services.

더보기

[root@Controller ~(keystone)]# su -s /bin/bash nova -c "nova-manage api_db sync"
[root@Controller ~(keystone)]# su -s /bin/bash nova -c "nova-manage cell_v2 map_cell0"
[root@Controller ~(keystone)]# su -s /bin/bash nova -c "nova-manage db sync"
[root@Controller ~(keystone)]# su -s /bin/bash nova -c "nova-manage cell_v2 create_cell --name cell1"
[root@Controller ~(keystone)]# systemctl restart httpd
[root@Controller ~(keystone)]# chown nova. /var/log/nova/nova-placement-api.log
[root@Controller ~(keystone)]# for service in api consoleauth conductor scheduler novncproxy; do
systemctl start openstack-nova-$service
systemctl enable openstack-nova-$service
done


[root@Controller ~(keystone)]# openstack compute service list
+----+------------------+------------+----------+---------+-------+----------------------------+
| ID | Binary           | Host       | Zone     | Status  | State | Updated At                 |
+----+------------------+------------+----------+---------+-------+----------------------------+
|  4 | nova-consoleauth | Controller | internal | enabled | up    | 2022-08-24T06:41:23.000000 |
|  5 | nova-conductor   | Controller | internal | enabled | up    | 2022-08-24T06:41:20.000000 |
|  6 | nova-scheduler   | Controller | internal | enabled | up    | 2022-08-24T06:41:14.000000 |
+----+------------------+------------+----------+---------+-------+----------------------------+

 

 

 

#Compute Node 설정

1) Install KVM.

더보기

[root@Compute ~]# yum -y install qemu-kvm libvirt virt-install bridge-utils

[root@Compute ~]# lsmod | grep kvm
kvm_intel       138567  0
kvm             441119  1 kvm_intel

[root@Compute ~]# systemctl start libvirtd
[root@Compute ~]# systemctl enable libvirtd

2) 1) Add the repository of Openstack Stein.

더보기

[root@Compute ~]# yum -y install centos-release-openstack-stein
[root@Compute ~]# sed -i -e "s/enabled=1/enabled=0/g" /etc/yum.repos.d/CentOS-OpenStack-stein.repo

3) Install Nova Compute.

더보기

[root@Compute ~]# yum --enablerepo=centos-openstack-stein,epel -y install openstack-nova-compute

4) Configure Nova.

더보기

[root@computer ~]# mv /etc/nova/nova.conf /etc/nova/nova.conf.org
[root@computer ~]# vi /etc/nova/nova.conf
[DEFAULT]
# define own IP address
my_ip = 10.0.0.51
state_path = /var/lib/nova
enabled_apis = osapi_compute,metadata
log_dir = /var/log/nova
# RabbitMQ connection info
transport_url = rabbit://openstack:password@10.0.0.30

[api]
auth_strategy = keystone

# enable VNC
[vnc]
enabled = True
server_listen = 0.0.0.0
server_proxyclient_address = $my_ip
novncproxy_base_url = http://10.0.0.30:6080/vnc_auto.html 

# Glance connection info
[glance]
api_servers = http://10.0.0.30:9292

[oslo_concurrency]
lock_path = $state_path/tmp

# Keystone auth info
[keystone_authtoken]
www_authenticate_uri = http://10.0.0.30:5000
auth_url = http://10.0.0.30:5000
memcached_servers = 10.0.0.30:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = servicepassword

[placement]
auth_url = http://10.0.0.30:5000
os_region_name = RegionOne
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = placement
password = servicepassword

[wsgi]
api_paste_config = /etc/nova/api-paste.ini

[root@computer ~]# chmod 640 /etc/nova/nova.conf
[root@computer ~]# chgrp nova /etc/nova/nova.conf

5) If SELinux is enabled, change policy settings.

더보기

[root@Controller ~(keystone)]# yum --enablerepo=centos-openstack-stein -y install openstack-selinux

6) firewall 서비스 포트 허용

더보기

[root@Controller ~(keystone)]# firewall-cmd --add-port=5900-5999/tcp --permanent
success
[root@Controller ~(keystone)]# firewall-cmd --reload
success

7) Start Nova Compute.

더보기

[root@Controller ~(keystone)]# systemctl start openstack-nova-compute
[root@Controller ~(keystone)]# systemctl enable openstack-nova-compute


# discover Compute Node
[root@Controller ~(keystone)]# su -s /bin/bash nova -c "nova-manage cell_v2 discover_hosts"
# show status
[root@Controller ~(keystone)]# openstack compute service list
+----+------------------+------------+----------+---------+-------+----------------------------+
| ID | Binary           | Host       | Zone     | Status  | State | Updated At                 |
+----+------------------+------------+----------+---------+-------+----------------------------+
|  4 | nova-consoleauth | Controller | internal | enabled | up    | 2022-08-24T06:41:23.000000 |
|  5 | nova-conductor   | Controller | internal | enabled | up    | 2022-08-24T06:41:20.000000 |
|  6 | nova-scheduler   | Controller | internal | enabled | up    | 2022-08-24T06:41:14.000000 |
|  9 | nova-compute     | Compute    | nova     | enabled | up    | 2022-08-24T08:44:22.000000 |
+----+------------------+------------+----------+---------+-------+----------------------------+

728x90
반응형
SMALL