部署 Openstack-计算节点

安装、配置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 节点
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 211,948评论 6 492
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 90,371评论 3 385
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 157,490评论 0 348
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 56,521评论 1 284
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 65,627评论 6 386
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 49,842评论 1 290
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,997评论 3 408
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 37,741评论 0 268
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 44,203评论 1 303
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 36,534评论 2 327
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,673评论 1 341
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 34,339评论 4 330
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,955评论 3 313
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,770评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,000评论 1 266
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 46,394评论 2 360
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 43,562评论 2 349

推荐阅读更多精彩内容