天天看點

Nova部署控制節點計算節點配置檔案

文章目錄

  • 控制節點
  • 計算節點
  • 配置檔案
    • 控制節點的/etc/nova/nova.conf檔案
    • 計算節點的/etc/nova/nova.conf檔案

Nova作為計算服務,需要由控制節點統一調配,由計算節點提供服務。是以部署Nova需要在控制節點和計算節點上分别進行操作。

控制節點

進入mariadb,建立Nova的資料庫和使用者

建立資料庫
	create database nova_api;
	create database nova;
	create database nova_cell0;
建立使用者nova并賦予其上述三個庫的所有權限
	grant all privileges on nova_api.* to 'nova'@'%' identified by 'nova';
	grant all privileges on nova.* to 'nova'@'%' identified by 'nova';
	grant all privileges on nova_cell0.* to 'nova'@'%' identified by 'nova';
           

建立nova和placement的user、service和endpoint

admin登入OpenStack
	source openrc
建立使用者nova
	openstack user create --domain default --password=nova nova
将nova添加為管理者
	openstack role add --project service --user nova admin
建立nova服務
	openstack service create --name nova --description "OpenStack Compute" compute
建立endpoint
	openstack endpoint create --region RegionOne compute public http://controller1:8774/v2.1
	openstack endpoint create --region RegionOne compute internal http://controller1:8774/v2.1
	openstack endpoint create --region RegionOne compute admin http://controller1:8774/v2.1
建立使用者placement
	openstack user create --domain default --password=placement placement
将placement添加為管理者
	openstack role add --project service --user placement admin
建立placement服務
	openstack service create --name placement --description "Placement API" placement
建立endpoint
	openstack endpoint create --region RegionOne placement public http://controller1:8778
	openstack endpoint create --region RegionOne placement internal http://controller1:8778
	openstack endpoint create --region RegionOne placement admin http://controller1:8778
檢查一下上述步驟是否成功:
檢視使用者
	openstack user list
	+----------------------------------+-----------+
	| ID                               | Name      |
	+----------------------------------+-----------+
	| 3f4350ab5acc4ac2bc915365279d8fd1 | nova      |
	| 6e1f6488725e4c5e85b23b3a089ef36c | placement |
檢視服務
	penstack service list
	| ID                               | Name      | Type      |
	+----------------------------------+-----------+-----------+
	| 463632a27b2b41af94dd857cfee2bb36 | placement | placement |
	| 8101c98d20a445eb89c6a0eae46ccf6e | nova      | compute   |
	+----------------------------------+-----------+-----------+
檢視endpoint
openstack endpoint list
| 44692e8cf1474235bb0331ea511ce545 | RegionOne | nova         | compute      | True    | admin     | http://controller1:8774/v2.1 |
| 57917f0d61c146899c5e339eb9a1a216 | RegionOne | nova         | compute      | True    | public    | http://controller1:8774/v2.1 |
| dc805226acdf4a4883b8487332a3f0e7 | RegionOne | nova         | compute      | True    | internal  | http://controller1:8774/v2.1 |
| 00a945a134b548c4aa04b64bdc86d09f | RegionOne | placement    | placement    | True    | admin     | http://controller1:8778      |
| 49ee058856654828a3df022698c69e10 | RegionOne | placement    | placement    | True    | internal  | http://controller1:8778      |
| 89f1f8e2a23849c18e501f052f9d7813 | RegionOne | placement    | placement    | True    | public    | http://controller1:8778      |
如以上均無問題,進入下一步
           

安裝配置Nova服務

安裝控制節點需要的nova軟體包
	yum -y install openstack-nova-api openstack-nova-conductor openstack-nova-console \
	openstack-nova-novncproxy openstack-nova-scheduler openstack-nova-placement-api
編輯配置檔案
	vim /etc/nova/nova.conf
	配置檔案的内容和其含義寫在下面了
修改/etc/httpd/conf.d/00-nova-placement-api.conf
	cat >> /etc/httpd/conf.d/00-nova-placement-api.conf <<EOF
	<Directory /usr/bin>
	   <IfVersion >= 2.4>
	      Require all granted
	   </IfVersion>
	   <IfVersion < 2.4>
	      Order allow,deny
	      Allow from all
	   </IfVersion>
	</Directory>
	EOF
重新開機httpd
	systemctl restart httpd
同步資料庫
	su -s /bin/sh -c "nova-manage api_db sync" nova
	su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
	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
檢視nova的cell
	nova-manage cell_v2 list_cells
	+-------+--------------------------------------+
	|  Name |                 UUID                 |
	+-------+--------------------------------------+
	| cell0 | 00000000-0000-0000-0000-000000000000 |
	| cell1 | 046be722-134f-431e-a36c-e27a6700ab69 |
	+-------+--------------------------------------+
啟動服務
	systemctl enable openstack-nova-api openstack-nova-consoleauth openstack-nova-scheduler \
	openstack-nova-conductor openstack-nova-novncproxy
	systemctl restart openstack-nova-api openstack-nova-consoleauth openstack-nova-scheduler \
	openstack-nova-conductor openstack-nova-novncproxy
檢視服務是否啟動
	openstack compute service list
	status欄表示服務是否啟動,state欄表示服務是否對外提供服務,兩者必須如下才算成功啟動
	+----+------------------+-------------+----------+---------+-------+----------------------------+
	| ID | Binary           | Host        | Zone     | Status  | State | Updated At                 |
	+----+------------------+-------------+----------+---------+-------+----------------------------+
	|  1 | nova-consoleauth | controller1 | internal | enabled | up    | 2019-10-14T11:38:52.000000 |
	|  2 | nova-conductor   | controller1 | internal | enabled | up    | 2019-10-14T11:38:56.000000 |
	|  3 | nova-scheduler   | controller1 | internal | enabled | up    | 2019-10-14T11:38:53.000000 |
	|  6 | nova-compute     | compute1    | nova     | enabled | up    | 2019-10-14T11:38:57.000000 |
	+----+------------------+-------------+----------+---------+-------+----------------------------+
           

計算節點

安裝計算節點需要的nova服務包
	yum -y install openstack-nova-compute
編輯配置檔案
	vim /etc/nova/nova.conf	
	
啟動服務
	systemctl enable libvirtd openstack-nova-compute
	systemctl restart libvirtd openstack-nova-compute
           

配置檔案

控制節點的/etc/nova/nova.conf檔案

[DEFAULT]
# 給出本主機的ip
my_ip = 192.168.88.111
# 支援網絡服務
use_neutron = True
# 使用提供的防火牆規則
# 預設情況下,Compute使用内部防火牆驅動程式。
# 由于網絡服務包含防火牆驅動程式,是以您必須使用此防火牆驅動程式禁用計算防火牆驅動程式。
firewall_driver = nova.virt.firewall.NoopFirewallDriver
# 規定預設啟用的API:僅啟用計算和中繼資料的API
enabled_apis = osapi_compute,metadata
# 給出消息隊列通路管道
transport_url = rabbit://openstack:[email protected]
 
[api]
# 身份認證服務使用keystone
auth_strategy = keystone
 
[api_database]
# 給出nova_api資料庫連接配接方式
connection = mysql+pymysql://nova:[email protected]/nova_api
 
[barbican]
 
[cache]
 
[cells]
 
[cinder]
 
[cloudpipe]
 
[conductor]
 
[console]
 
[consoleauth]
 
[cors]
 
[cors.subdomain]
 
[crypto]
 
[database]
# 給出nova資料庫連接配接方式
connection = mysql+pymysql://nova:[email protected]/nova

[ephemeral_storage_encryption]
 
[filter_scheduler]
 
[glance]
# 配置鏡像服務的API
api_servers = http://controller1:9292
 
[guestfs]
 
[healthcheck]
 
[hyperv]
 
[image_file_url]
 
[ironic]
 
[key_manager]
 
[keystone_authtoken]
# 使用者nova認證資訊
auth_uri = http://controller1:5000
auth_url = http://controller1:35357
memcached_servers = controller1:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = nova
 
[libvirt]
 
[matchmaker_redis]
 
[metrics]
 
[mks]
 
[neutron]
 
[notifications]
 
[osapi_v21]
 
[oslo_concurrency]
# 設定鎖定檔案的路徑
lock_path = /var/lib/nova/tmp
 
[oslo_messaging_amqp]
 
[oslo_messaging_kafka]
 
[oslo_messaging_notifications]
 
[oslo_messaging_rabbit]
 
[oslo_messaging_zmq]
 
[oslo_middleware]
 
[oslo_policy]
 
[pci]

[placement]
# 使用者placement認證資訊
os_region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://controller1:35357/v3
username = placement
password = placement
 
[quota]
 
[rdp]
 
[remote_debug]
 
[scheduler]
 
[serial_console]
 
[service_user]
 
[spice]
 
[ssl]
 
[trusted_computing]
 
[upgrade_levels]
 
[vendordata_dynamic_auth]
 
[vmware]
 
[vnc]
# 配置vnc代理以使用控制節點的叢集ip
enabled = true
vncserver_listen = $my_ip
vncserver_proxyclient_address = $my_ip
 
[workarounds]
 
[wsgi]
 
[xenserver]
 
[xvp]
           

計算節點的/etc/nova/nova.conf檔案

計算節點的配置檔案與控制節點基本一緻,這裡僅列出不同處。

[api_database]

[database]
 
[libvirt]
# 計算節點不支援硬體加速,此處必須設定為qemu,若支援硬體加速,則不需要添加此項
virt_type = qemu
 
[vnc]
enabled = True
vncserver_listen = $my_ip
vncserver_proxyclient_address = $my_ip
novncproxy_base_url = http://controller1:6080/vnc_auto.html
           
上一篇: Nova元件

繼續閱讀