二:创建Nova数据库
[email protected]:~(keystone)# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 43
Server version: 10.6.7-MariaDB-2ubuntu1.1 Ubuntu 22.04
Copyright (c) 2000, 2016, 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.001 sec)
MariaDB [(none)]> grant all privileges on nova.* to [email protected]'localhost' identified by 'password';
Query OK, 0 rows affected (0.023 sec)
MariaDB [(none)]> grant all privileges on nova.* to [email protected]'%' identified by 'password';
Query OK, 0 rows affected (0.015 sec)
MariaDB [(none)]> create database nova_api;
Query OK, 1 row affected (0.001 sec)
MariaDB [(none)]> grant all privileges on nova_api.* to [email protected]'localhost' identified by 'password';
Query OK, 0 rows affected (0.023 sec)
MariaDB [(none)]> grant all privileges on nova_api.* to [email protected]'%' identified by 'password';
Query OK, 0 rows affected (0.021 sec)
MariaDB [(none)]> create database nova_cell0;
Query OK, 1 row affected (0.000 sec)
MariaDB [(none)]> grant all privileges on nova_cell0.* to [email protected]'localhost' identified by 'password';
Query OK, 0 rows affected (0.019 sec)
MariaDB [(none)]> grant all privileges on nova_cell0.* to [email protected]'%' identified by 'password';
Query OK, 0 rows affected (0.019 sec)
MariaDB [(none)]> create database placement;
Query OK, 1 row affected (0.001 sec)
MariaDB [(none)]> grant all privileges on placement.* to [email protected]'localhost' identified by 'password';
Query OK, 0 rows affected (0.015 sec)
MariaDB [(none)]> grant all privileges on placement.* to [email protected]'%' identified by 'password';
Query OK, 0 rows affected (0.021 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.002 sec)
MariaDB [(none)]> exit
Bye
[email protected]:~(keystone)#
三:安装及配置Nova
1) 安装Nova
[email protected]:~(keystone)# apt install nova-api nova-conductor nova-scheduler nova-novncproxy placement-api python3-novaclient -y
2) 配置Nova
[email protected]:~(keystone)# mv /etc/nova/nova.conf /etc/nova/nova.conf.bak
[email protected]:~(keystone)# vim /etc/nova/nova.conf
[DEFAULT]
osapi_compute_listen = 127.0.0.1
osapi_compute_listen_port = 8774
metadata_listen = 127.0.0.1
metadata_listen_port = 8775
state_path = /var/lib/nova
enabled_apis = osapi_compute,metadata
log_dir = /var/log/nova
# 设定RabbitMQ
transport_url = rabbit://openstack:[email protected]
[api]
auth_strategy = keystone
[vnc]
enabled = True
novncproxy_host = 127.0.0.1
novncproxy_port = 6080
novncproxy_base_url = https://srv1.1000y.cloud:6080/vnc_auto.html
# 配置Glance信息
[glance]
api_servers = https://srv1.1000y.cloud:9292
# 自签名证书值为true,其他为false
insecure = true
[oslo_concurrency]
lock_path = $state_path/tmp
# 配置链接数据库的信息
[api_database]
connection = mysql+pymysql://nova:[email protected]/nova_api
[database]
connection = mysql+pymysql://nova:[email protected]/nova
# 配置Keystone验证信息
[keystone_authtoken]
www_authenticate_uri = https://srv1.1000y.cloud:5000
auth_url = https://srv1.1000y.cloud:5000
memcached_servers = srv1.1000y.cloud:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = servicepassword
# 如果为自签名证书,值为True
insecure = true
[placement]
auth_url = https://srv1.1000y.cloud:5000
os_region_name = RegionOne
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = placement
password = servicepassword
# 如果为自签名证书,值为True
insecure = true
[wsgi]
api_paste_config = /etc/nova/api-paste.ini
[email protected]:~(keystone)# chmod 640 /etc/nova/nova.conf
[email protected]:~(keystone)# chgrp nova /etc/nova/nova.conf
3) 配置placement
[email protected]:~(keystone)# mv /etc/placement/placement.conf /etc/placement/placement.conf.bak
[email protected]:~(keystone)# vim /etc/placement/placement.conf
[DEFAULT]
debug = false
[api]
auth_strategy = keystone
[keystone_authtoken]
www_authenticate_uri = https://srv1.1000y.cloud:5000
auth_url = https://srv1.1000y.cloud:5000
memcached_servers = srv1.1000y.cloud:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = placement
password = servicepassword
# 自签名证书值为true,其他为false
insecure = true
[placement_database]
connection = mysql+pymysql://placement:[email protected]/placement
[email protected]:~(keystone)# vim /etc/apache2/sites-enabled/placement-api.conf
# 修改第1行
Listen 127.0.0.1:8778
......
......
......
......
......
......
[email protected]:~(keystone)# chmod 640 /etc/placement/placement.conf
[email protected]:~(keystone)# chgrp placement /etc/placement/placement.conf
4) 配置Nginx Proxy
[email protected]:~(keystone)# vim /etc/nginx/nginx.conf
......
......
......
......
......
......
stream {
upstream glance-api {
server 127.0.0.1:9292;
}
server {
listen srv1.1000y.cloud:9292 ssl;
proxy_pass glance-api;
}
upstream nova-api {
server 127.0.0.1:8774;
}
server {
listen srv1.1000y.cloud:8774 ssl;
proxy_pass nova-api;
}
upstream nova-metadata-api {
server 127.0.0.1:8775;
}
server {
listen srv1.1000y.cloud:8775 ssl;
proxy_pass nova-metadata-api;
}
upstream placement-api {
server 127.0.0.1:8778;
}
server {
listen srv1.1000y.cloud:8778 ssl;
proxy_pass placement-api;
}
upstream novncproxy {
server 127.0.0.1:6080;
}
server {
listen srv1.1000y.cloud:6080 ssl;
proxy_pass novncproxy;
}
ssl_certificate "/etc/ssl/private/zed.crt";
ssl_certificate_key "/etc/ssl/private/zed.key";
}