您好,登錄后才能下訂單哦!
用OpenStack計算來托管和管理云計算系統。OpenStack計算是基礎設施即服務(IaaS)系統的重要組成部分。主要模塊是用Python實現的。
OpenStack計算與OpenStack標識進行交互,用于身份驗證,用于資源目錄跟蹤和選擇的OpenStack放置,用于磁盤和服務器映像的OpenStack映像服務,以及用于用戶和管理界面的OpenStack儀表板。圖像訪問受到項目和用戶的限制;每個項目的配額是有限的(例如,實例的數量)。OpenStack計算可以在標準硬件上水平伸縮,并下載映像來啟動實例。
OpenStack計算包括以下組件:
理論上,OpenStack計算可以支持SQLAlchemy支持的任何數據庫。用于測試和開發工作的公共數據庫是SQLite3、MySQL、MariaDB和PostgreSQL。
安裝之前我們需要先建庫,帳號和api endpoint.
○ 使用root連接數據庫服務器:
$ mysql -u root -p root123
○ 建立nova_api、nova和nova_cell0數據庫:
MariaDB [(none)]> CREATE DATABASE nova_api;
MariaDB [(none)]> CREATE DATABASE nova;
MariaDB [(none)]> CREATE DATABASE nova_cell0;
○ 賦予帳號nova對庫的操作權限:
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
建立計算服務的憑據:
○ 建立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服務實體:
$ 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]區域, 充計compute和元數據API:
[DEFAULT]
# ...
enabled_apis = osapi_compute,metadata
○ 在[api_database] 和 [database] sections,配置數據庫的訪問:
[api_database]
# ...
connection = mysql+pymysql://nova:nova123@dbs.flex.net/nova_api
[database]
# ...
connection = mysql+pymysql://nova:nova123@dbs.flex.net/nova
○ 在[DEFAULT]區域, 配置RabbitMQ消息隊列訪問:
[DEFAULT]
# ...
transport_url = rabbit://openstack:openstack123@dbs.flex.net
○ 在[api]和[keystone_authtoken]區域, 配置訪問認證服務:
[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]區域中的其它的選項.
○ 在[DEFAULT]區域, 配置管理接口的IP:
[DEFAULT]
# ...
my_ip = 192.168.207.2 #此處為控制節點的管理IP地址
○ 在[DEFAULT]區域, 充許支持的網絡:
[DEFAULT]
# ...
use_neutron = true
firewall_driver = nova.virt.firewall.NoopFirewallDriver
缺省的,計算節點使用一內部的防火墻驅動,因為網絡服務包含了一個防火墻驅動,你必須禁用防火墻驅動并使用nova.virt.firewall.NoopFirewallDriver firewall driver
○ 在[vnc]區域, 使用管理接口的IP做為vnc代理使用:
[vnc]
enabled = true
# ...
server_listen = $my_ip
server_proxyclient_address = $my_ip
○ 在[glance]區域, 配置鏡像服務api的位置:
[glance]
# ...
api_servers=http://stack.flex.net:9292
○ 在[oslo_concurrency]區域, 配置鎖定的路徑:
[oslo_concurrency]
# ...
lock_path = /var/lib/nova/tmp
○ 在[placement]區域, 配置訪問placement服務:
[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]區域中的其它的選項
○ 由于一個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 |
+-------+--------------------------------------+
○ 允許系統引導時自動啟動服務并啟動服務:
# 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
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。