一、Nova介绍
Nova是openstack最早的两块模块之一,另一个是对象存储swift
。在openstack体系中一个叫做计算节点
,一个叫做控制节点
。这个主要和nova相关,我们把安装为计算节点nova-compute
,把除了nova-compute叫做控制节点。nova-compute是创建虚拟机的,只是创建虚拟机,所有的控制都在另一台上。
1.1 功能和特点:
-
实例生命周期的管理
-
管理计算资源
-
网络和认证管理
-
REST风格的API
-
异步的一致性通信
-
Hypervisor透明:支持Xen,XenServer/XCP,KVM,UML,VMware vSphere and Hyper-V
1.2 Nova 云架构包括以下主要组件:
-
API Server(nova-api)
-
Message Queue(rabbitmq server)
-
Compute Worker(nova-compute)
-
Network Controller(nova-network)
-
Volume Worker (Nova-volume)
-
Scheduler(nova-scheduler)
1.2.1 组件介绍
-
API:实现了RESTful API功能,是外部访问Nova的唯一途径。
接收外部的请求并通过Message Queue将请求发送给其他的服务组件,同时也兼容EC2 API,所以也可以用EC2的管理工具对nova进行日常管理。
-
Scheduler:模块在OpenStack中负责决策虚拟机创建在那台主机(计算节点)上。
决策一个虚拟机应该调度到某物理节点,需要分两个步骤:
1.过滤(Fliter) 首先获取过未过滤的主机列表,根据过滤属性,选择服务条件的计算节点主机。
2.计算权值(Weight) 经过主机过滤,需要对主机进行权值的计算,根据策略选择相应的某一台主机。
-
Cert:负责身份认证
-
Conductor:计算节点访问数据库的中间件
-
Consoleauth:用于控制台的授权验证
-
Novncproxy:VNC代理
二、安装配置Nova服务
2.1 修改配置文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
[root@linux-node1 ~]
# grep -n '^[a-z]' /etc/nova/nova.conf
14:auth_strategy=keystone
#keystone连接
2062:use_neutron=
true
#启用neutron网络
3052:enabled_apis=osapi_compute,metadata
#启用计算和元数据
3265:firewall_driver=nova.virt.firewall.NoopFirewallDriver
3601:transport_url=rabbit:
//openstack
:openstack@192.168.56.11
3662:connection=mysql:
//nova
:nova@192.168.56.11
/nova
4679:connection=mysql+pymysql:
//nova
:nova@192.168.56.11
/nova
4814:api_servers=
5429 [keystone_authtoken]下面添加
5431:auth_uri = http:
//192
.168.56.11:5000
5432:auth_url = http:
//192
.168.56.11:35357
5433:memcached_servers = 192.168.56.11:11211
5434:auth_type = password
5435:project_domain_name = default
5436:user_domain_name = default
5437:project_name = service
5438:username = nova
5439:password = nova
6706:lock_path=
/var/lib/nova/tmp
8385:vncserver_listen=0.0.0.0
8397:vncserver_proxyclient_address=192.168.56.11
|
2.2 同步数据库
1
2
|
[root@linux-node1 ~]
# su -s /bin/sh -c "nova-manageapi_db sync" nova
[root@linux-node1 ~]
# su -s /bin/sh -c "nova-managedb sync" nova
|
2.3 数据库验证
1
|
mysql -h192.168.56.11 -unova-pnova -e
"use nova;show tables;"
#如果存在表就证明成功了
|
2.4 启动nova
1
2
3
4
5
6
|
[root@linux-node1 ~]
# systemctl enableopenstack-nova-api.service \
openstack-nova-consoleauth.serviceopenstack-nova-scheduler.service \
openstack-nova-conductor.service openstack-nova-novncproxy.service
[root@linux-node1 ~]
# systemctlstart openstack-nova-api.service \
openstack-nova-consoleauth.serviceopenstack-nova-scheduler.service \
openstack-nova-conductor.serviceopenstack-nova-novncproxy.service
|
2.5 项目及端点配置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
root@linux-node1 ~]
# openstack service create --name nova \
> --description
"OpenStack Compute"
compute
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Compute |
| enabled | True |
|
id
| 200e9f78a4654e0394eec200c4dab31d |
| name | nova |
|
type
| compute |
+-------------+----------------------------------+
[root@linux-node1 ~]
# openstack endpoint create --region RegionOne \
> compute public http:
//192
.168.56.11:8774
/v2
.1/%\(tenant_id\)s
+--------------+----------------------------------------------+
| Field | Value |
+--------------+----------------------------------------------+
| enabled | True |
|
id
| dfb98d75fe7e44da898280d48e331a63 |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 200e9f78a4654e0394eec200c4dab31d |
| service_name | nova |
| service_type | compute |
| url | http:
//192
.168.56.11:8774
/v2
.1/%(tenant_id)s |
+--------------+----------------------------------------------+
[root@linux-node1 ~]
# openstack endpoint create --region RegionOne \
> compute public http:
//192
.168.56.11:8774
/v2
.1/%\(tenant_id\)s
+--------------+----------------------------------------------+
| Field | Value |
+--------------+----------------------------------------------+
| enabled | True |
|
id
| a656fdf0dce34db39fdce5c3fd3d3e40 |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 200e9f78a4654e0394eec200c4dab31d |
| service_name | nova |
| service_type | compute |
| url | http:
//192
.168.56.11:8774
/v2
.1/%(tenant_id)s |
+--------------+----------------------------------------------+
[root@linux-node1 ~]
# openstack endpoint create --region RegionOne \
> compute admin http:
//192
.168.56.11:8774
/v2
.1/%\(tenant_id\)s
+--------------+----------------------------------------------+
| Field | Value |
+--------------+----------------------------------------------+
| enabled | True |
|
id
| 85a0a9b5d4db449cab48b7c033aabac3 |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 200e9f78a4654e0394eec200c4dab31d |
| service_name | nova |
| service_type | compute |
| url | http:
//192
.168.56.11:8774
/v2
.1/%(tenant_id)s |
+--------------+----------------------------------------------+
|
2.6 验证nova镜像
1
2
3
4
5
6
7
8
|
[root@linux-node1 ~]
# openstack host list
+-------------+-------------+----------+
| Host Name | Service | Zone |
+-------------+-------------+----------+
| linux-node1 | consoleauth | internal |
| linux-node1 | conductor | internal |
| linux-node1 | scheduler | internal |
+-------------+-------------+----------+
|
本文转自 kesungang 51CTO博客,原文链接:http://blog.51cto.com/sgk2011/1887333,如需转载请自行联系原作者