centOS8 Openstack Nova 计算服务搭建(1)

一 配置控制节点

1.1 先决条件

安装SQL

1.2 创建数据库

CREATE DATABASE nova_api;
CREATE DATABASE nova;
CREATE DATABASE nova_cell0;

#grant
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY 'root';
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'root';

GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY 'root';
GRANT ALL PRIVILEGES ON nova_.* TO 'nova'@'%' IDENTIFIED BY 'root';

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

1.3 创建计算服务凭证

openstack user create --domain Openstack --password-prompt nova

#绑定
openstack role add --project service --user nova admin

#创建nova服务实体
openstack service create --name nova --description "Openstack Compute" compute

1.4 创建计算 API 服务端点

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

openstack endpoint create --region RegionOne compute internal http://controller:8874/v2.1

openstack endpoint create --region RegionOne compute admin http://controller:8874/v2.1

1.5 配置 Placement

mysql -u root -p

CREATE DATABASE placement;
GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'localhost' \
  IDENTIFIED BY 'PLACEMENT_DBPASS';
GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'%' \
  IDENTIFIED BY 'PLACEMENT_DBPASS';

. admin-openrc
openstack user create --domain Openstack --password-prompt placement
openstack role add --project service --user placement admin
openstack service create --name placement --description "Placement API" placement
openstack endpoint create --region RegionOne placement public http://controller:8778
openstack endpoint create --region RegionOne placement internal http://controller:8778
openstack endpoint create --region RegionOne placement admin http://controller:8778

yum install openstack-placement-api

vi /etc/placement/placement.conf
[placement_database]
# ...
connection = mysql+pymysql://placement:PLACEMENT_DBPASS@controller/placement
[api]
# ...
auth_strategy = keystone

[keystone_authtoken]
# ...
auth_url = http://controller:5000/v3
memcached_servers = controller:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = placement
password = PLACEMENT_PASS


su -s /bin/sh -c "placement-manage db sync" placement

systemctl restart httpd

2.1 安装和配置组件

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

#修改配置文件 /etc/nova/nova.conf
[DEFAULT]
# ...
enabled_apis = osapi_compute,metadata

[api_database]
# ...
connection = mysql+pymysql://nova:NOVA_DBPASS@controller/nova_api

[database]
# ...
connection = mysql+pymysql://nova:NOVA_DBPASS@controller/nova

[DEFAULT]
# ...
transport_url = rabbit://openstack:RABBIT_PASS@controller:5672/

[api]
# ...
auth_strategy = keystone

[keystone_authtoken]
# ...
www_authenticate_uri = http://controller:5000/
auth_url = http://controller:5000/
memcached_servers = controller:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = nova
password = NOVA_PASS

[DEFAULT]
# ...
my_ip = 10.0.0.11

[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]
# ...
region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://controller:5000/v3
username = placement
password = PLACEMENT_PASS

2.2 填充nova-api数据库

su -s /bin/sh -c "nova-manage api_db sync" nova

2.3 注册cell0数据库:

su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova

#创建cell1单元格
su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova

#填充新星数据库
su -s /bin/sh -c "nova-manage db sync" nova

#验证
su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova

2.4 完成

#设置开机启动
systemctl enable \
    openstack-nova-api.service \
    openstack-nova-scheduler.service \
    openstack-nova-conductor.service \
    openstack-nova-novncproxy.service
# systemctl start \
    openstack-nova-api.service \
    openstack-nova-scheduler.service \
    openstack-nova-conductor.service \
    openstack-nova-novncproxy.service

你可能感兴趣的:(openstack,centos,linux)