openstack计算服务nova
2016-11-02 09:00
423 查看
一、环境准备
1、虚拟机准备
IP地址 主机名 操作系统 192.168.56.11 linux-node1 CentOS7 192.168.56.12 linux-node2 CentOS7其中,linux-node1当作控制节点linux-node2当作计算节点
二、nova服务
我们把除了nova-compute组件之外的节点都安装在一台主机上,称为控制节点;把nava-compute安装在另外一台主机上,称为计算节点;计算节点是用来创建虚拟机的nova有很多服务- API:负责接收和响应外部请求,支持OpenStack API,EC2 API - Cert:负责身份认证EC2 - Schedule:用于云主机调度 - Conductor:计算节点访问数据的中间件 - Consoleauth:用于控制台的授权验证 - Novncproxy:VNC代理scheduler模块在openstack中的作用就是决策虚拟机创建在哪个主机(计算节点)上。
决策一个虚拟机应该调度到某物理节点,需要分两个步骤: - 过滤(Filter) - 计算权值(Weight)
1、nova安装
在控制节点上[root@linux-node1 ~]# yum install -y openstack-nova-api openstack-nova-cert \ openstack-nova-conductor openstack-nova-console \ openstack-nova-novncproxy openstack-nova-scheduler
2、配置
先决条件(1)创建nova和nova-api数据库
已在安装mariadb后创建完成(2)获得 admin 凭证来获取只有管理员能执行的命令的访问权限
创建用户(3)修改nova.conf
配置数据库连接vim /etc/nova/nova.conf [api_database] connection=mysql+pymysql://nova:nova@192.168.56.11/nova_api [database] connection=mysql+pymysql://nova:nova@192.168.56.11/nova
3、同步数据库
[root@linux-node1 ~]# su -s /bin/sh -c "nova-manage api_db sync" nova [root@linux-node1 ~]# su -s /bin/sh -c "nova-manage db sync" nova验证是否同步成功
mysql -h 192.168.56.11 -unova -pnova -e "use nova;show tables;" mysql -h 192.168.56.11 -unova -pnova -e "use nova_api;show tables;"
4、配置keystone
vim /etc/nova/nova.conf #打开注释,认证方式选择keystone auth_strategy=keystone #在[keystone_authtoken]下添加 auth_uri = http://192.168.56.11:5000 auth_url = http://192.168.56.11:35357 memcached_servers = 192.168.56.11:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = nova password = nova
5、配置rabbitmq
[root@linux-node1 ~]# grep '^r' /etc/nova/nova.conf rabbit_host=192.168.56.11 rabbit_port=5672 rabbit_userid=openstack rabbit_password=openstack rpc_backend=rabbit
6、修改nova自身的配置
vim /etc/nova/nova.conf #在[DEFAULT]部分,只使用计算和元数据API enabled_apis=osapi_compute,metadata #和网络相关,使用neutron use_neutron=true #使用nova的防火墙,并且关闭 firewall_driver=nova.virt.firewall.NoopFirewallDriver #在[vnc]部分,配置VNC代理使用控制节点的管理接口IP地址 vncserver_listen=192.168.56.11 vncserver_proxyclient_address=192.168.56.11 #在 [glance] 区域,配置镜像服务 API 的位置: api_servers=http://192.168.56.11:9292 #在 [oslo_concurrency] 部分,配置锁路径: lock_path=/var/lib/nova/tmp
7、启动nova
[root@linux-node1 ~]# systemctl enable openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-api.service to /usr/lib/systemd/system/openstack-nova-api.service. Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-consoleauth.service to /usr/lib/systemd/system/openstack-nova-consoleauth.service. Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-scheduler.service to /usr/lib/systemd/system/openstack-nova-scheduler.service. Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-conductor.service to /usr/lib/systemd/system/openstack-nova-conductor.service. Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-novncproxy.service to /usr/lib/systemd/system/openstack-nova-novncproxy.service. [root@linux-node1 ~]# systemctl start openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
8、在keystone上做服务注册
在创建之前,要先执行环境变量脚本 [root@linux-node1 ~]# source admin-openstack.sh再创建nova服务实体
[root@linux-node1 ~]# openstack service create --name nova --description "OpenStack Compute" compute +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | OpenStack Compute | | enabled | True | | id | 4d3ec9545a5549598a0b7e458b8f7bcd | | name | nova | | type | compute | +-------------+----------------------------------+创建镜像服务的API endpoint
[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 | b3e8878ea8964039897bb56367364484 | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | 4d3ec9545a5549598a0b7e458b8f7bcd | | 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 | 59b33390ae474bc5bd04fb8bc3affa90 | | interface | admin | | region | RegionOne | | region_id | RegionOne | | service_id | 4d3ec9545a5549598a0b7e458b8f7bcd | | 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 internal http://192.168.56.11:8774/v2.1/%\(tenant_id\)s +--------------+----------------------------------------------+ | Field | Value | +--------------+----------------------------------------------+ | enabled | True | | id | 0d8ed49cdded436bb2faadc133017049 | | interface | internal | | region | RegionOne | | region_id | RegionOne | | service_id | 4d3ec9545a5549598a0b7e458b8f7bcd | | service_name | nova | | service_type | compute | | url | http://192.168.56.11:8774/v2.1/%(tenant_id)s | +--------------+----------------------------------------------+验证控制节点是否部署成功
[root@linux-node1 ~]# openstack host list +-------------+-------------+----------+ | Host Name | Service | Zone | +-------------+-------------+----------+ | linux-node1 | consoleauth | internal | | linux-node1 | conductor | internal | | linux-node1 | scheduler | internal | +-------------+-------------+----------+
三、nova-compute
1、基础软件包安装
(1)安装EPEL源
rpm -ivh http://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm
(2)安装OpenStack仓库
yum install -y centos-release-openstack-mitaka
(3)安装OpenStack客户端
yum install -y python-openstackclient
(4)安装OpenStack SELinux管理包
yum install -y openstack-selinux
2、nova-compute配置
[root@linux-node2 ~]# grep '^[a-Z]' /etc/nova/nova.conf enabled_apis=osapi_compute,metadata auth_strategy=keystone firewall_driver=nova.virt.firewall.NoopFirewallDriver use_neutron=true rpc_backend=rabbit api_servers=http://192.168.56.11:9292 auth_uri = http://192.168.56.11:5000 auth_url = http://192.168.56.11:35357 memcached_servers = 192.168.56.11:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = nova password = nova virt_type=kvm lock_path=/var/lib/nova/tmp rabbit_host=192.168.56.11 rabbit_port=5672 rabbit_userid=openstack rabbit_password=openstack enabled=true #启用并配置远程控制台访问 vncserver_listen=0.0.0.0 vncserver_proxyclient_address=192.168.56.12 novncproxy_base_url=http://192.168.56.11:6080/vnc_auto.html
3、启动计算服务及其依赖,并设置开机启动
systemctl enable libvirtd.service openstack-nova-compute.service systemctl start libvirtd.service openstack-nova-compute.service
4、验证计算服务是否配置成功
在控制节点上执行 [root@linux-node1 ~]# source admin-openstack.sh [root@linux-node1 ~]# openstack host list +-------------+-------------+----------+ | Host Name | Service | Zone | +-------------+-------------+----------+ | linux-node1 | consoleauth | internal | | linux-node1 | conductor | internal | | linux-node1 | scheduler | internal | | linux-node2 | compute | nova | +-------------+-------------+----------+ 可以看到在计算节点上有compute服务,则说明配置成功 [root@linux-node1 ~]# nova service-list +----+------------------+-------------+----------+---------+-------+----------------------------+-----------------+ | Id | Binary | Host | Zone | Status | State | Updated_at | Disabled Reason | +----+------------------+-------------+----------+---------+-------+----------------------------+-----------------+ | 1 | nova-consoleauth | linux-node1 | internal | enabled | up | 2016-10-28T13:22:42.000000 | - | | 2 | nova-conductor | linux-node1 | internal | enabled | up | 2016-10-28T13:22:49.000000 | - | | 3 | nova-scheduler | linux-node1 | internal | enabled | up | 2016-10-28T13:22:42.000000 | - | | 6 | nova-compute | linux-node2 | nova | enabled | up | 2016-10-28T13:22:44.000000 | - | +----+------------------+-------------+----------+---------+-------+----------------------------+-----------------+
如果能列出我们已经上传的镜像,则证明nova与glance之间配置成功 [root@linux-node1 ~]# nova image-list +--------------------------------------+--------+--------+--------+ | ID | Name | Status | Server | +--------------------------------------+--------+--------+--------+ | 29d99654-ba91-4d04-8808-e1b8d16861fb | cirros | ACTIVE | | +--------------------------------------+--------+--------+--------+
相关文章推荐
- OpenStack —— 计算服务Nova(四)
- OpenStack实践系列④计算服务Nova
- OpenStack入门修炼之nova服务(计算节点)的部署与测试(11)
- openstack的安装(二) 安装nova服务同时建立计算节点
- 浓墨重彩之OpenStack-06-nova计算服务
- OpenStack 计算服务Nova [四]
- OpenStack 计算服务 Nova计算节点部署(八)
- OpenStack(kilo版本)计算服务Nova的安装部署
- [ Openstack ] Openstack-Mitaka 高可用之 计算服务(Nova)
- OpenStack Newton版本部署----计算服务(nova)
- Openstack-Nova计算服务
- OpenStack-liberty版Nova计算节点部署服务部署(四)
- Centos7手动部署Openstack Mitaka版安装配置--(五)安装nova计算服务
- 云计算之openstack(N版)Nova计算服务最佳实践
- OpenStack 计算服务Nova [四]
- openstack-8:安装Nova计算服务
- OpenStack-M版(Mitaka)搭建- – -计算服务(Nova)篇
- OpenStack-M版(Mitaka)搭建基于(Centos7.2)+++五、Openstack计算服务(nova)下
- OpenStack实践系列④计算服务Nova
- OpenStack 计算服务 Nova介绍和控制节点部署(七)