0/100保存草稿发布文章 博文管理我的博客退出加粗 斜体 标题 删除线 无序 有序 待办 引用 代码块 BashCC++C#CLikeCSSGoHandlebarsJavaJavaScriptKotlinMarkupObjective-CPerlPHPShellPythonRubySQLSwiftVB.NetYAML图片 上传图片实验版,新增正版图库功能 视频 表格 超链接 摘要 导入 导出 保存 填写标题才可自动保存 撤销 重做 目录 帮助
OPENSTACK的计算服务——NOVA
【控制节点】
1、 相关数据库的安装
1.1 创建数据库
(1) 创建nova_api数据库(mysql -u root -p)
CREATE DATABASE nova_api;
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY 'nova';
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'nova';
(2)创建nova_cell0数据库
CREATE DATABASE nova_cell0;
GRANT ALL PRIVILEGES ON nova_cell0.* TO
'nova'@'localhost' IDENTIFIED BY 'nova';
GRANT ALL PRIVILEGES ON nova_cell0.* TO
'nova'@'%' IDENTIFIED BY 'nova';
1.2 创建compute API service
(1)创建nova service
[root@controller
~]# source admin-openrc.sh
[root@controller
~]# openstack service create --name nova
--description "OpenStack Compute" compute
(2)创建nova service endpoint
public url
#openstack endpoint create --region RegionOne compute public http://192.168.56.103:8774/v2.1
internal url
openstack endpoint create --region RegionOne compute internal http://192.168.56.103:8774/v2.1
admin url
openstack endpoint create --region RegionOne compute admin http://192.168.56.103:8774/v2.1
1.3 创建Create a Placement service user
(1)创建placement user
openstack user create --domain default --password-prompt placement
Password:placement
添加用户角色admin
openstack role add --project service --user placement admin
(2)创建Placement API service
openstack service create --name placement
--description "Placement API" placement
(3)创建Placement API service的endpoint
Public url
openstack endpoint create --region RegionOne placement public http://192.168.56.103:8778
internal url
openstack endpoint create --region RegionOne placement internal http://192.168.56.103:8778
admin url
openstack endpoint create --region RegionOne placement admin http://192.168.56.103:8778
2、 安装和配置组件(Controller node)
2.1 安装nova的组件
[root@controller ~]# yum install openstack-nova-api
openstack-nova-conductor
openstack-nova-console openstack-nova-novncproxy
openstack-nova-scheduler openstack-nova-placement-api -y
2.2 组件的配置
编辑/etc/nova/nova.conf,完成如下配置
(1)基础配置[DEFAULT]2737
2628 enabled_apis =
osapi_compute,metadata
(2)mysql的配置
[api_database]347134833379 connection = mysql+pymysql://nova:nova@192.168.56.103/nova_api
[database]455445724395 connection = mysql+pymysql://nova:nova@192.168.56.103/nova
(3)rabbit mq的配置
3130
3020
transport_url=rabbit://openstack:openstack@192.168.56.103
(4)keystone的配置
[api]317831953084 auth_strategy = keystone [keystone_authtoken]6055
从5596行开始粘贴auth_uri = http://192.168.56.103:5000auth_url = http://192.168.56.103:35357memcached_servers = 192.168.56.103:11211auth_type = passwordproject_domain_name = defaultuser_domain_name = defaultproject_name = serviceusername = novapassword = nova
(5)neutron配置
【default】
1243
1480 my_ip=192.168.56.103
1707
2305
use_neutron=true
2369
2465 firewall_driver = nova.virt.firewall.NoopFirewallDriver
(6)vnc的配置
[vnc]10686
9674
enabled=true
9690 keymap=en-us9697 server_listen = $my_ip9709 server_proxyclient_address = $my_ip
(7)glance的配置
【glance】5234
4953
api_servers=http://192.168.56.103:9292
(8) [oslo_concurrency]7991
7247
lock_path=/var/lib/nova/tmp
(9)placement组件的配置
[placement]8810
#..
8093开始粘贴如下代码
8954os_region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://192.168.56.103:35357/v3
username = placementpassword = placement
2.3 placement组件bug修复
bug修复
编辑/etc/httpd/conf.d/00-nova-placement-api.conf
添加如下代码:
<Directory /usr/bin>
<IfVersion >= 2.4>
Require all granted
</IfVersion>
<IfVersion < 2.4>
Order allow,deny
Allow from all
</IfVersion>
</Directory>
2.4 同步数据库
(1)重启httpd服务
、 # systemctl restart httpd
(2)同步nova_api数据库
、 # su -s /bin/sh -c "nova-manage api_db sync" nova#mysql -h 192.168.56.103 -unova -pnova -e"use nova_api;show tables;"
(3)注册cell0数据库
[root@controller ~]# su -s /bin/sh -c "nova-manage
cell_v2 map_cell0" nova
(4)创建cell1 cell
[root@controller ~]# su -s /bin/sh -c "nova-manage
cell_v2 create_cell --name=cell1 --verbose" nova
371f625d-bf8d-47ef-a65b-fa6de849db61
返回结果:b28f6502-b3ba-4da2-a34c-8a2a653a7191
(5)同步nova数据库
su -s /bin/sh -c "nova-manage db sync" nova
mysql -h 192.168.56.103 -unova -pnova -e"use
nova;show tables;"
(6)验证novacell0 and cell1注册是否正确
[root@controller ~]# nova-manage cell_v2 list_cells
2.5 完成安装
[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
2.6验证安装
[root@controller ~]# ps aux |grep nova
[root@controller nova]# pwd
/var/log/nova
[root@controller nova]# ll
total 92
-rw-r--r-- 1 nova nova
6498 Oct 15 13:36 nova-api.log
-rw-r--r-- 1 nova nova
1243 Oct 15 13:36 nova-conductor.log
-rw-r--r-- 1 nova nova
824 Oct 15 13:36 nova-consoleauth.log
-rw-r--r-- 1 nova nova 67965 Oct 15 13:28 nova-manage.log
-rw-r--r-- 1 nova nova
899 Oct 15 13:36 nova-novncproxy.log
-rw-r--r-- 1 root root
0 Oct 15 12:23 nova-placement-api.log
-rw-r--r-- 1 nova nova 968 Oct
15 13:36 nova-scheduler.log
【计算节点】
基础环境的安装
yum install -y centos-release-openstack-ocata
yum install -y python-openstackclient
yum install -y openstack-selinux
yum install update -y
3 、安装和配置组件(compute node)
3.1 安装包
yum install openstack-nova-compute -y
3.2、 配置组件
编辑/etc/nova/nova.conf
(1)基础配置
[DEFAULT]
2737
2629 enabled_apis = osapi_compute,metadata
(2)rabbitMQ
[DEFAULT]31303021 transport_url = rabbit://openstack:openstack@192.168.56.103
(3)keystone的配置
[api]3178
3085 auth_strategy = keystone
[keystone_authtoken]6055
5610粘贴下面代码
auth_uri = http:// 192.168.56.103:5000
auth_url = http:// 192.168.56.103:35357
memcached_servers = 192.168.56.103:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = nova
(4)配置my_ip
1243
1481 my_ip = 192.168.56.113
(5) neutron的配置
[DEFAULT]1707
2306 use_neutron = True
2369
2466 firewall_driver =
nova.virt.firewall.NoopFirewallDriver
(6)vnc的配置
[vnc]10686
9674 enabled=true
9690 keymap=en-us
9697 vncserver_listen = 0.0.0.0
9709 vncserver_proxyclient_address = $my_ip
9729 novncproxy_base_url = http://192.168.56.103:6080/vnc_auto.html
(7)glance的配置
【glance】5234
4953 api_servers=http:// 192.168.56.103:9292
(8) [oslo_concurrency]7991
7247 lock_path=/var/lib/nova/tmp
(9)placement的配置
[placement]8810
8093行开始粘贴下面的代码
os_region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://192.168.56.103:35357/v3
username = placement
password = placement
本节配置***********
my_ip=192.168.56.21
use_neutron=true
firewall_driver = nova.virt.firewall.NoopFirewallDriver
enabled_apis=osapi_compute,metadata
transport_url=rabbit://openstack:openstack@192.168.56.103
auth_strategy=keystone
api_servers=http://192.168.56.103:9292
auth_uri = http://192.168.56.103:5000
auth_url = http://192.168.56.103:35357
memcached_servers = 192.168.56.103:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = nova
lock_path=/var/lib/nova/tmp
os_region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://192.168.56.103:35357/v3
username = placement
password = placement
enabled=true
keymap=en-us
vncserver_listen=0.0.0.0
vncserver_proxyclient_address=$my_ip
novncproxy_base_url=http://192.168.56.103:6080/vnc_auto.html
******************************END************************
3.3 、完成安装
(1) 确认你的机器是否支持CPU的虚拟加速
[root@compute1 nova]# egrep -c '(vmx|svm)' /proc/cpuinfo
4
If
this command returns a value of one or greater, your compute node
supports hardware acceleration which typically requires no additional
configuration.
If
this command returns a value of zero, your compute node
does not support hardware acceleration and you must configure libvirt
to use QEMU instead of KVM.
Edit the [libvirt] section in the /etc/nova/nova.conf
file as follows:
[libvirt]6257
…
6360
virt_type = qemu
(2) 启动计算节点的nova服务
systemctl enable libvirtd.service openstack-nova-compute.service
systemctl start libvirtd.service openstack-nova-compute.service
3.4 验证安装
[root@controller ~]# openstack compute service list
4 、Add the compute node to the cell database
(1)Source the admin
credentials to enable admin-only CLI commands, then confirm there are compute
hosts in the database:
[root@controller ~]# openstack hypervisor list
(2)Discover compute
hosts:
[root@controller ~]# su -s /bin/sh -c "nova-manage cell_v2
discover_hosts --verbose" nova
Found 2 cell mappings.
Skipping cell0 since it does not contain hosts.
Getting compute nodes from cell ‘cell1’: 76f8f580-ee0d-405d-9bcb-9c0b9f5e6986
Found 1 computes in cell: 76f8f580-ee0d-405d-9bcb-9c0b9f5e6986
Checking host mapping for compute host ‘compute1’:
56967041-ff65-4dda-a39f-2421f0b0b078
Creating host mapping for compute host ‘compute1’:
56967041-ff65-4dda-a39f-2421f0b0b078
NOVA正确安装完成!~
注意,要是添加其他的计算节点,参考下面的note