openstack搭建之-nova配置(18)
一、 base節點設置數據庫
mysql -u root -proot
CREATE DATABASE nova_api;
CREATE DATABASE nova;
CREATE DATABASE nova_cell0;
GRANT ALL PRIVILEGES ON nova_api.* TO ‘nova‘@‘localhost‘ IDENTIFIED BY ‘NOVA_DBPASS‘;
GRANT ALL PRIVILEGES ON nova_api.* TO ‘nova‘@‘%‘ IDENTIFIED BY ‘NOVA_DBPASS‘;
GRANT ALL PRIVILEGES ON nova.* TO ‘nova‘@‘localhost‘ IDENTIFIED BY ‘NOVA_DBPASS‘;
GRANT ALL PRIVILEGES ON nova.* TO ‘nova‘@‘%‘ IDENTIFIED BY ‘NOVA_DBPASS‘;
GRANT ALL PRIVILEGES ON nova_cell0.* TO ‘nova‘@‘localhost‘ IDENTIFIED BY ‘NOVA_DBPASS‘;
GRANT ALL PRIVILEGES ON nova_cell0.* TO ‘nova‘@‘%‘ IDENTIFIED BY ‘NOVA_DBPASS‘;
二、 ctrl節點設置配置
#控制節點運行環境變量
. admin-openrc
#創建nova用戶並添加角色為admin
openstack user create --domain default --password NOVA_PASS nova
openstack role add --project service --user nova admin
#創建nova服務項目並設置endpoint
openstack service create --name nova --description "OpenStack Compute" compute
openstack endpoint create --region RegionOne compute public http://ctrl.test.com:8774/v2.1
openstack endpoint create --region RegionOne compute internal http://ctrl.test.com:8774/v2.1
openstack endpoint create --region RegionOne compute admin http://ctrl.test.com:8774/v2.1
#創建placement用戶並加入角色為admin
openstack user create --domain default --password PLACEMENT_PASS placement
openstack role add --project service --user placement admin
#創建placement服務並設置endpoint
openstack service create --name placement --description "Placement API" placement
openstack endpoint create --region RegionOne placement public http://ctrl.test.com:8778
openstack endpoint create --region RegionOne placement internal http://ctrl.test.com:8778
openstack endpoint create --region RegionOne placement admin http://ctrl.test.com:8778
#安裝軟件
yum install openstack-nova-api \
openstack-nova-conductor \
openstack-nova-console \
openstack-nova-novncproxy \
openstack-nova-scheduler \
openstack-nova-placement-api -y
#編輯Nova配置文件
vim /etc/nova/nova.conf
[DEFAULT]
enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:[email protected]
my_ip = 172.16.2.52
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[api_database]
connection = mysql+pymysql://nova:[email protected]/nova_api
[database]
connection = mysql+pymysql://nova:[email protected]/nova
[api]
auth_strategy = keystone
[keystone_authtoken]
auth_uri = http://ctrl.test.com:5000
auth_url = http://ctrl.test.com:35357
memcached_servers = base.test.com:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = NOVA_PASS
[vnc]
enabled = true
vncserver_listen = $my_ip
vncserver_proxyclient_address = $my_ip
[glance]
api_servers = http://ctrl.test.com: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://ctrl.test.com:35357/v3
username = placement
password = PLACEMENT_PASS
#編輯Nova-placement-api配置文件
vim /etc/httpd/conf.d/00-nova-placement-api.conf
<Directory /usr/bin>
<IfVersion >= 2.4>
Require all granted
</IfVersion>
<IfVersion < 2.4>
Order allow,deny
Allow from all
</IfVersion>
</Directory>
systemctl restart httpd
#初始化nova-api數據庫
su -s /bin/sh -c "nova-manage api_db sync" nova
#填充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
#初始化Nova數據庫
su -s /bin/sh -c "nova-manage db sync" nova
#驗證cell0和cell2是否註冊正確
nova-manage cell_v2 list_cells
#開啟Nova服務
systemctl restart \
openstack-nova-api.service \
openstack-nova-consoleauth.service \
openstack-nova-scheduler.service \
openstack-nova-conductor.service \
openstack-nova-novncproxy.service
systemctl status \
openstack-nova-api.service \
openstack-nova-consoleauth.service \
openstack-nova-scheduler.service \
openstack-nova-conductor.service \
openstack-nova-novncproxy.service
systemctl enable \
openstack-nova-api.service \
openstack-nova-consoleauth.service \
openstack-nova-scheduler.service \
openstack-nova-conductor.service \
openstack-nova-novncproxy.service
三、 Nova-computer計算節點配置
#配置網卡1(eth0)
IP=172.16.2.53
DNS=172.16.2.53
網關=172.16.0.1
#安裝KVM軟件
yum install qemu-kvm* virt-* libvirt* spice* -y
lsmod | grep kvm
systemctl start libvirtd
systemctl status libvirtd
systemctl enable libvirtd
#配置網卡2(eth1)
vim /etc/sysconfig/network-scripts/ifcfg-eth1
TYPE=Ethernet
BOOTPROTO=none
NAME=eth1
DEVICE=eth1
ONBOOT=yes
UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
#安裝Nova軟件,並編輯配置文件
yum install openstack-nova-compute -y
vim /etc/nova/nova.conf
[DEFAULT]
enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:[email protected]
my_ip = 172.16.2.53
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[api]
auth_strategy = keystone
[keystone_authtoken]
auth_uri = http://ctrl.test.com:5000/v3
auth_url = http://ctrl.test.com:35357/v3
memcached_servers = base.test.com:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = NOVA_PASS
[vnc]
enabled = True
vncserver_listen = 0.0.0.0
vncserver_proxyclient_address = $my_ip
novncproxy_base_url = http://ctrl.test.com:6080/vnc_auto.html
[glance]
api_servers = http://ctrl.test.com: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://ctrl.test.com:5000/v3
username = placement
password = PLACEMENT_PASS
#開啟服務
systemctl restart libvirtd.service openstack-nova-compute.service
systemctl status libvirtd.service openstack-nova-compute.service
systemctl enable libvirtd.service openstack-nova-compute.service
四、ctrl控制節點查看
#ctrl節點運行環境變量
. admin-openrc
#查看相關信息
openstack hypervisor list
su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova
openstack compute service list
openstack catalog list
openstack image list
openstack搭建之-nova配置(18)