您好,登錄后才能下訂單哦!
用OpenStack計算來托管和管理云計算系統(tǒng)。OpenStack計算是基礎(chǔ)設(shè)施即服務(wù)(IaaS)系統(tǒng)的重要組成部分。主要模塊是用Python實現(xiàn)的。
OpenStack計算與OpenStack標(biāo)識進行交互,用于身份驗證,用于資源目錄跟蹤和選擇的OpenStack放置,用于磁盤和服務(wù)器映像的OpenStack映像服務(wù),以及用于用戶和管理界面的OpenStack儀表板。圖像訪問受到項目和用戶的限制;每個項目的配額是有限的(例如,實例的數(shù)量)。OpenStack計算可以在標(biāo)準硬件上水平伸縮,并下載映像來啟動實例。
OpenStack計算包括以下組件:
理論上,OpenStack計算可以支持SQLAlchemy支持的任何數(shù)據(jù)庫。用于測試和開發(fā)工作的公共數(shù)據(jù)庫是SQLite3、MySQL、MariaDB和PostgreSQL。
安裝之前我們需要先建庫,帳號和api endpoint.
○ 使用root連接數(shù)據(jù)庫服務(wù)器:
$ mysql -u root -p root123
○ 建立nova_api、nova和nova_cell0數(shù)據(jù)庫:
MariaDB [(none)]> CREATE DATABASE nova_api;
MariaDB [(none)]> CREATE DATABASE nova;
MariaDB [(none)]> CREATE DATABASE nova_cell0;
○ 賦予帳號nova對庫的操作權(quán)限:
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'nova123';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'nova123';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY 'nova123'
$ . admin-openrc
建立計算服務(wù)的憑據(jù):
○ 建立nova用戶:
$ openstack user create --domain default --password-prompt nova
User Password:nova123
Repeat User Password:nova123
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | default |
| enabled | True |
| id | 8a7dbf5279404537b1c7b86c033620fe |
| name | nova |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+
○ 給用戶nova添加admin角色:
$ openstack role add --project service --user nova admin
?
注意:這個命令沒有輸出
○ 建立nova服務(wù)實體:
$ openstack service create --name nova --description "OpenStack Compute" compute
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Compute |
| enabled | True |
| id | 060d59eac51b4594815603d75a00aba2 |
| name | nova |
| type | compute |
+-------------+----------------------------------+
Create the Compute API service endpoints:
$ openstack endpoint create --region RegionOne compute public http://stack.flex.net:8774/v2.1
+--------------+-------------------------------------------+
| Field | Value |
+--------------+-------------------------------------------+
| enabled | True |
| id | 3c1caa473bfe4390a11e7177894bcc7b |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 060d59eac51b4594815603d75a00aba2 |
| service_name | nova |
| service_type | compute |
| url | http://stack.flex.net:8774/v2.1 |
+--------------+-------------------------------------------+
$openstack endpoint create --region RegionOne compute internal http://stack.flex.net:8774/v2.1
+--------------+-------------------------------------------+
| Field | Value |
+--------------+-------------------------------------------+
| enabled | True |
| id | e3c918de680746a586eac1f2d9bc10ab |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 060d59eac51b4594815603d75a00aba2 |
| service_name | nova |
| service_type | compute |
| url | http://stack.flex.net:8774/v2.1 |
+--------------+-------------------------------------------+
$ openstack endpoint create --region RegionOne compute admin http://stack.flex.net:8774/v2.1
+--------------+-------------------------------------------+
| Field | Value |
+--------------+-------------------------------------------+
| enabled | True |
| id | 38f7af91666a47cfb97b4dc790b94424 |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 060d59eac51b4594815603d75a00aba2 |
| service_name | nova |
| service_type | compute |
| url | http://stack.flex.net:8774/v2.1 |
+--------------+-------------------------------------------+
# yum install openstack-nova-api openstack-nova-conductor \
openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler
編輯/etc/nova/nova.conf文件完成下列需求:
○ 在[DEFAULT]區(qū)域, 充計compute和元數(shù)據(jù)API:
[DEFAULT]
# ...
enabled_apis = osapi_compute,metadata
○ 在[api_database] 和 [database] sections,配置數(shù)據(jù)庫的訪問:
[api_database]
# ...
connection = mysql+pymysql://nova:nova123@dbs.flex.net/nova_api
[database]
# ...
connection = mysql+pymysql://nova:nova123@dbs.flex.net/nova
○ 在[DEFAULT]區(qū)域, 配置RabbitMQ消息隊列訪問:
[DEFAULT]
# ...
transport_url = rabbit://openstack:openstack123@dbs.flex.net
○ 在[api]和[keystone_authtoken]區(qū)域, 配置訪問認證服務(wù):
[api]
# ...
auth_strategy = keystone
[keystone_authtoken]
# ...
auth_url = http://stack.flex.net:5000/v3
memcached_servers = dbs.flext.net:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = nova
password = nova123
?
注意: 注釋或移除在掉在[keystone_authtoken]區(qū)域中的其它的選項.
○ 在[DEFAULT]區(qū)域, 配置管理接口的IP:
[DEFAULT]
# ...
my_ip = 192.168.207.2 #此處為控制節(jié)點的管理IP地址
○ 在[DEFAULT]區(qū)域, 充許支持的網(wǎng)絡(luò):
[DEFAULT]
# ...
use_neutron = true
firewall_driver = nova.virt.firewall.NoopFirewallDriver
缺省的,計算節(jié)點使用一內(nèi)部的防火墻驅(qū)動,因為網(wǎng)絡(luò)服務(wù)包含了一個防火墻驅(qū)動,你必須禁用防火墻驅(qū)動并使用nova.virt.firewall.NoopFirewallDriver firewall driver
○ 在[vnc]區(qū)域, 使用管理接口的IP做為vnc代理使用:
[vnc]
enabled = true
# ...
server_listen = $my_ip
server_proxyclient_address = $my_ip
○ 在[glance]區(qū)域, 配置鏡像服務(wù)api的位置:
[glance]
# ...
api_servers=http://stack.flex.net:9292
○ 在[oslo_concurrency]區(qū)域, 配置鎖定的路徑:
[oslo_concurrency]
# ...
lock_path = /var/lib/nova/tmp
○ 在[placement]區(qū)域, 配置訪問placement服務(wù):
[placement]
# ...
region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://stack.flex.net:5000/v3
username = placement
password = placement123
注意: 注釋或移除在掉在[placement]區(qū)域中的其它的選項
○ 由于一個bug, 你必須充許訪問placement API, 添加下列的配置到/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>
○ Restart the httpd service:
# 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
109e1d4b-536a-40d0-83c6-5f121b82b650
# su -s /bin/sh -c "nova-manage db sync" nova
# su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova
+-------+--------------------------------------+
| Name | UUID |
+-------+--------------------------------------+
| cell1 | 109e1d4b-536a-40d0-83c6-5f121b82b650 |
| cell0 | 00000000-0000-0000-0000-000000000000 |
+-------+--------------------------------------+
○ 允許系統(tǒng)引導(dǎo)時自動啟動服務(wù)并啟動服務(wù):
# 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
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。