之(四) Nova安裝

手動安裝Openstack Mikita的第四部分: 計算服務Nova安裝. 這部分內容主要是對OpenStack Installation Guide for Red Hat Enterprise Linux and CentOS在Nova這部分內容的實踐總結.

首先, 我們在controller節點上部署Nova服務.

一. controller節點安裝前準備

1. 爲Nova創建數據庫

[root@controller ~]# mysql -u root -p

CREATE DATABASE nova_api;
CREATE DATABASE nova;

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';

其中, NOVA_DBPASS是Nova訪問數據庫時使用的密碼.

2. 創建Service和API Endpoint

(1) 獲取admin-only CLI指令的權限

[root@controller ~]# . admin-openrc

(2) 創建nova用戶

[root@controller ~]# openstack user create --domain default --password-prompt nova

User Password:
Repeat User Password:
+-----------+----------------------------------+
| Field     | Value                            |
+-----------+----------------------------------+
| domain_id | 23445595d52c44be995b0b393870b5ef |
| enabled   | True                             |
| id        | a98e05efe7c54f7d901e5ca61f8a27f7 |
| name      | nova                             |
+-----------+----------------------------------+

這裏nova用戶的密碼爲: zzr.

(3) 把nova用戶增加到admin角色和service租戶

[root@controller ~]# openstack role add --project service --user nova admin

(4) 創建compute服務

[root@controller ~]# openstack service create --name nova \
  --description "OpenStack Compute" compute

+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Compute                |
| enabled     | True                             |
| id          | 42730828ce28424ca64c1eed4260b824 |
| name        | nova                             |
| type        | compute                          |
+-------------+----------------------------------+

(5) 創建compute服務的Endpoints

  • public endpoint
[root@controller ~]# openstack endpoint create --region RegionOne \
  compute public http://controller:8774/v2.1/%\(tenant_id\)s

+--------------+-------------------------------------------+
| Field        | Value                                     |
+--------------+-------------------------------------------+
| enabled      | True                                      |
| id           | 1b90d3d65a16476dbe7a9e063a667132          |
| interface    | public                                    |
| region       | RegionOne                                 |
| region_id    | RegionOne                                 |
| service_id   | 42730828ce28424ca64c1eed4260b824          |
| service_name | nova                                      |
| service_type | compute                                   |
| url          | http://controller:8774/v2.1/%(tenant_id)s |
+--------------+-------------------------------------------+
  • internal endpoint
[root@controller ~]# openstack endpoint create --region RegionOne \
  compute internal http://controller:8774/v2.1/%\(tenant_id\)s

+--------------+-------------------------------------------+
| Field        | Value                                     |
+--------------+-------------------------------------------+
| enabled      | True                                      |
| id           | b48495ef28324beb9d68fda27a988300          |
| interface    | internal                                  |
| region       | RegionOne                                 |
| region_id    | RegionOne                                 |
| service_id   | 42730828ce28424ca64c1eed4260b824          |
| service_name | nova                                      |
| service_type | compute                                   |
| url          | http://controller:8774/v2.1/%(tenant_id)s |
+--------------+-------------------------------------------+
  • admin endpoint
[root@controller ~]# openstack endpoint create --region RegionOne \
  compute admin http://controller:8774/v2.1/%\(tenant_id\)s

+--------------+-------------------------------------------+
| Field        | Value                                     |
+--------------+-------------------------------------------+
| enabled      | True                                      |
| id           | 5481feea724849c9898889cfa6d90d94          |
| interface    | admin                                     |
| region       | RegionOne                                 |
| region_id    | RegionOne                                 |
| service_id   | 42730828ce28424ca64c1eed4260b824          |
| service_name | nova                                      |
| service_type | compute                                   |
| url          | http://controller:8774/v2.1/%(tenant_id)s |
+--------------+-------------------------------------------+

二. controller節點安裝nova組件

1. 安裝nova

[root@controller ~]# yum install openstack-nova-api openstack-nova-conductor \
  openstack-nova-console openstack-nova-novncproxy \
  openstack-nova-scheduler -y

2. 配置nova

編輯文件 /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
  • 配置RabbitMQ消息隊列的訪問權限:
[DEFAULT]
...
rpc_backend = rabbit

[oslo_messaging_rabbit]
...
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = RABBIT_PASS
  • 配置Identity service的訪問權限:
[DEFAULT]
...
auth_strategy = keystone

[keystone_authtoken]
...
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = zzr

其中, zzr爲上一步驟中爲nova用戶設置的密碼. 刪除[keystone_authtoken]裏的除了上述內容以外的東西.

  • configure the my_ip option to use the management interface IP address of the controller node:
[DEFAULT]
...
my_ip = 10.0.0.11
  • enable support for the Networking service:
[DEFAULT]
...
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
  • 其餘部分:
[vnc]
...
vncserver_listen = $my_ip
vncserver_proxyclient_address = $my_ip

[glance]
...
api_servers = http://controller:9292

[oslo_concurrency]
...
lock_path = /var/lib/nova/tmp

(3) 同步nove配置到數據庫

[root@controller ~]# su -s /bin/sh -c "nova-manage api_db sync" nova
[root@controller ~]# su -s /bin/sh -c "nova-manage db sync" nova

(4) 開啓Image服務

[root@controller ~]# systemctl enable openstack-nova-api.service \
  openstack-nova-consoleauth.service openstack-nova-scheduler.service \
  openstack-nova-conductor.service openstack-nova-novncproxy.service
[root@controller ~]# systemctl start openstack-nova-api.service \
  openstack-nova-consoleauth.service openstack-nova-scheduler.service \
  openstack-nova-conductor.service openstack-nova-novncproxy.service

配置完controller節點以後, 我們繼續在compute節點進行配置.

三. compute節點安裝nova

1. 安裝

[root@controller ~]# yum install openstack-nova-compute -y

2. 配置

編輯 /etc/nova/nova.conf 文件.

[DEFAULT]
...
rpc_backend = rabbit
auth_strategy = keystone
my_ip = 10.0.0.31
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver

[oslo_messaging_rabbit]
...
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = RABBIT_PASS

[keystone_authtoken]
...
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = zzr

[vnc]
...
enabled = True
vncserver_listen = 0.0.0.0
vncserver_proxyclient_address = $my_ip
novncproxy_base_url = http://controller:6080/vnc_auto.html

[glance]
...
api_servers = http://controller:9292

[oslo_concurrency]
...
lock_path = /var/lib/nova/tmp

判斷該虛擬機是否支持硬件加速:

[root@controller ~]# egrep -c '(vmx|svm)' /proc/cpuinfo

如果上述指令返回0, 說明該虛擬機不支持硬件加速, 則需進一步設置:

[libvirt]
...
virt_type = qemu

3. 啓動

[root@controller ~]# systemctl enable libvirtd.service openstack-nova-compute.service
[root@controller ~]# systemctl start libvirtd.service openstack-nova-compute.service

四. controller節點驗證

(1) 獲取admin-only CLI指令的權限

[root@controller ~]# . admin-openrc

(2) 查看可用的計算節點

[root@controller ~]# openstack compute service list

+----+------------------+------------+----------+---------+-------+----------------------------+
| Id | Binary           | Host       | Zone     | Status  | State | Updated At                 |
+----+------------------+------------+----------+---------+-------+----------------------------+
|  1 | nova-consoleauth | controller | internal | enabled | up    | 2016-08-01T12:42:06.000000 |
|  2 | nova-conductor   | controller | internal | enabled | up    | 2016-08-01T12:42:06.000000 |
|  3 | nova-scheduler   | controller | internal | enabled | up    | 2016-08-01T12:42:07.000000 |
|  6 | nova-compute     | compute1   | nova     | enabled | up    | 2016-08-01T12:42:04.000000 |
+----+------------------+------------+----------+---------+-------+----------------------------+

參考文獻

  1. OpenStack Installation Guide for Red Hat Enterprise Linux and CentOS
  2. OpenStack Mitaka 安裝 for CentOS — Kyle.Bai
  3. OpenStack Liberty
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章