安裝、配置controller 節點
首先創建數據庫、服務認證、API endpoints
節點IP: 192.168.1.101
1、創建數據庫
mysql -uroot -p
mysql> create database nova_api;
mysql> create database nova;
mysql> grant all privileges on nova_api.* to 'nova'@'localhost' \
identified by '123456' with grant option;
mysql> grant all privileges on nova_api.* to 'nova'@'%' \
identified by '123456' with grant option;
mysql> grant all privileges on nova.* to 'nova'@'localhost' \
identified by '123456' with grant option;
mysql> grant all privileges on nova.* to 'nova'@'%' \
identified by '123456' with grant option;
mysql> quit;
2、切換到admin變量環境,以使用admin-only 命令:
source ~/admin-openrc
3、創建服務認證:
創建 nova
用戶
openstack user create --domain default --password 123456 nova
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | default |
| enabled | True |
| id | 8a7dbf5279404537b1c7b86c033620fe |
| name | nova |
| 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 | 0b35d94fc609405a86838d23adcac7a1 |
| name | nova |
| type | compute |
+-------------+----------------------------------+
創建compute
服務的API endpoints
:
openstack endpoint create --region RegionOne \
compute public http://192.168.1.101:8774/v2.1/%\(tenant_id\)s
+--------------+-----------------------------------------------+
| Field | Value |
+--------------+-----------------------------------------------+
| enabled | True |
| id | 8e76b9e79d7341688fb1e2a81afa9eb8 |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 0b35d94fc609405a86838d23adcac7a1 |
| service_name | nova |
| service_type | compute |
| url | http://192.168.1.101:8774/v2.1/%(tenant_id)s |
+--------------+-----------------------------------------------+
openstack endpoint create --region RegionOne \
compute internal http://192.168.1.101:8774/v2.1/%\(tenant_id\)s
+--------------+-----------------------------------------------+
| Field | Value |
+--------------+-----------------------------------------------+
| enabled | True |
| id | e2c85cc372b3486d967750e0d30a2533 |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 0b35d94fc609405a86838d23adcac7a1 |
| service_name | nova |
| service_type | compute |
| url | http://192.168.1.101:8774/v2.1/%(tenant_id)s |
+--------------+-----------------------------------------------+
openstack endpoint create --region RegionOne \
compute admin http://192.168.1.101:8774/v2.1/%\(tenant_id\)s
+--------------+-----------------------------------------------+
| Field | Value |
+--------------+-----------------------------------------------+
| enabled | True |
| id | e0503e43cf5e47b0bd39d3d22ee2c0ca |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 0b35d94fc609405a86838d23adcac7a1 |
| service_name | nova |
| service_type | compute |
| url | http://192.168.1.101:8774/v2.1/%(tenant_id)s |
+--------------+-----------------------------------------------+
安裝和配置 nova組件
1、安裝組件:
yum install openstack-nova-api openstack-nova-conductor \
openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler
2、編輯 /etc/nova/nova.conf
[DEFAULT]
...
enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:123456@127.0.0.1
auth_strategy = keystone
my_ip = 192.168.1.101
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[api_database]
...
connection = mysql+pymysql://nova:123456@127.0.0.1/nova_api
[database]
...
connection = mysql+pymysql://nova:123456@127.0.0.1/nova
[keystone_authtoken]
...
auth_uri = http://127.0.0.1:5000
auth_url = http://127.0.0.1:35357
memcached_servers = 127.0.0.1:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = nova
password = 123456
[vnc]
...
vncserver_listen = $my_ip
vncserver_proxyclient_address = $my_ip
[glance]
...
api_servers = http:/192.168.1.101:9292
[oslo_concurrency]
...
lock_path = /var/lib/nova/tmp
3、生成compute
數據庫:
su -s /bin/sh -c "nova-manage api_db sync" nova
su -s /bin/sh -c "nova-manage db sync" nova
# 此處可忽略輸出的deprecation messages
完成安裝
systemctl enable openstack-nova-api.service \
openstack-nova-consoleauth.service openstack-nova-scheduler.service \
openstack-nova-conductor.service openstack-nova-novncproxy.service
systemctl start openstack-nova-api.service \
openstack-nova-consoleauth.service openstack-nova-scheduler.service \
openstack-nova-conductor.service openstack-nova-novncproxy.service
安裝、配置 compute 節點
節點IP: 192.168.1.103
1、安裝
yum install centos-release-openstack-newton
yum update
yum install openstack-nova-compute
2、編輯配置文件 /etc/nova/nova.conf
[DEFAULT]
...
enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:123456@192.168.58.110
auth_strategy = keystone
my_ip = 192.168.58.110
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[keystone_authtoken]
...
auth_uri = http://192.168.1.101:5000
auth_url = http://192.168.1.101:35357
memcached_servers = 127.0.0.1:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = nova
password = 123456
[vnc]
...
enabled = True
vncserver_listen = 0.0.0.0
vncserver_proxyclient_address = $my_ip
novncproxy_base_url = http://192.168.1.101:6080/vnc_auto.html
[glance]
...
api_servers = http://192.168.1.101:9292
[oslo_concurrency]
...
lock_path = /var/lib/nova/tmp
完成安裝
1、確定你的compute節點是否支持硬件加速
egrep -c '(vmx|svm)' /proc/cpuinfo
如果返回值>=1,說明支持硬件加速,不需其他額外配置
-
如果返回值=0,說明不支持硬件加速,需要如下配置
libvirt
使用QEMU
代替KVM
編輯
/etc/nova/nova.conf
[libvirt]
...
virt_type = qemu
2、啟動compute service
,并設置開機運行
systemctl enable libvirtd.service openstack-nova-compute.service
systemctl start libvirtd.service openstack-nova-compute.service
如果服務啟動失敗,可查看
/var/log/nova/nova-compute.log
錯誤顯示AMQP server on controller:5672 is unreachable
可能意味著controller 節點
上防火墻禁用了5672端口
驗證 Compute service
回到 controller 節點
操作
1、切換到 admin
用戶環境
source ~/admin-openrc
2、查看各服務組件是否注冊及啟動狀態
openstack compute service list
+----+--------------------+------------+----------+---------+-------+----------------------------+
| Id | Binary | Host | Zone | Status | State | Updated At |
+----+--------------------+------------+----------+---------+-------+----------------------------+
| 1 | nova-consoleauth | controller | internal | enabled | up | 2016-10-09T23:11:15.000000 |
| 2 | nova-scheduler | controller | internal | enabled | up | 2016-10-09T23:11:15.000000 |
| 3 | nova-conductor | controller | internal | enabled | up | 2016-10-09T23:11:16.000000 |
| 4 | nova-compute | compute1 | nova | enabled | up | 2016-10-09T23:11:20.000000 |
+----+--------------------+------------+----------+---------+-------+----------------------------+
# 正常狀態下會有3個服務組件運行在controller節點,1個服務組件運行在compute 節點