安装、配置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:[email protected]
auth_strategy = keystone
my_ip = 192.168.1.101
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[api_database]
...
connection = mysql+pymysql://nova:[email protected]/nova_api
[database]
...
connection = mysql+pymysql://nova:[email protected]/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:[email protected]
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 节点