openstack部署nova
controller
一、创建nova数据库,并设置权限及远程登录
mysql -u root -p
CREATE DATABASE nova_api;
CREATE DATABASE nova;
CREATE DATABASE nova_cell0;
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' \ IDENTIFIED BY 'NOVA_DBPASS';
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' \ IDENTIFIED BY 'NOVA_DBPASS';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' \ IDENTIFIED BY 'NOVA_DBPASS';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' \ IDENTIFIED BY 'NOVA_DBPASS';
GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' \ IDENTIFIED BY 'NOVA_DBPASS';
GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' \ IDENTIFIED BY 'NOVA_DBPASS';
二、创建nova用户
①创建nova用户
source openrc
openstack user create --domain default --password=nova nova
②将default项目中的nova用户设置成admin角色
openstack role add --project service --user nova admin
③创建nova服务
openstack service create --name nova \ --description "OpenStack Compute" compute
④创建nova服务端点
openstack endpoint create --region RegionOne compute public http://controller:8774/v2.1
openstack endpoint create --region RegionOne compute internal http://controller:8774/v2.1
openstack endpoint create --region RegionOne compute admin http://controller:8774/v2.1
三、创建placement用户(起到统计资源使用的功能)
①创建placement用户
openstack user create --domain default --password=placement placement
②将service项目中的placement用户设置成admin角色
openstack role add --project service --user placement admin
③创建服务
openstack service create --name placement --description "Placement API" placement
④创建服务端点
openstack endpoint create --region RegionOne placement public http://controller:8778
openstack endpoint create --region RegionOne placement internal http://controller:8778
openstack endpoint create --region RegionOne placement admin http://controller:8778
四、安装nova
①安装nova服务包
yum install openstack-nova-api openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler openstack-nova-placement-api
②修改nova配置文件
cp /etc/nova/nova.conf
/etc/nova/nova.conf
.bak
[DEFAULT]
my_ip=192.168.42.120 #控制节点ip
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver #防火墙驱动
enabled_apis=osapi_compute,metadata
transport_url = rabbit://openstack:admin@controller #rabbitmq的连接方式 [api]
auth_strategy = keystone [api_database]
connection = mysql+pymysql://nova:NOVA_DBPASS@controller/nova_api [barbican] [cache] [cells] [cinder]
#os_region_name = RegionOne [cloudpipe] [conductor] [console] [consoleauth] [cors] [cors.subdomain] [crypto] [database]
connection = mysql+pymysql://nova:NOVA_DBPASS@controller/nova [ephemeral_storage_encryption] [filter_scheduler] [glance]
api_servers = http://controller:9292 [guestfs] [healthcheck] [hyperv] [image_file_url] [ironic] [key_manager] [keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = nova [libvirt]
#virt_type=qemu [matchmaker_redis] [metrics] [mks] [neutron]
#url = http://controller:9696
#auth_url = http://controller:35357
#auth_type = password
#project_domain_name = default
#user_domain_name = default
#region_name = RegionOne
#project_name = service
#username = neutron
#password = neutron
#service_metadata_proxy = true
#metadata_proxy_shared_secret = METADATA_SECRET [notifications] [osapi_v21] [oslo_concurrency]
lock_path=/var/lib/nova/tmp #临时文件保存位置 [oslo_messaging_amqp] [oslo_messaging_kafka] [oslo_messaging_notifications] [oslo_messaging_rabbit] [oslo_messaging_zmq] [oslo_middleware] [oslo_policy] [pci]
[placement]
os_region_name = RegionOne
auth_type = password
auth_url = http://controller:35357/v3 #认证的地址
project_name = service
project_domain_name = Default
username = placement
password = placement
user_domain_name = Default [quota] [rdp] [remote_debug] [scheduler] [serial_console] [service_user] [spice] [ssl] [trusted_computing] [upgrade_levels] [vendordata_dynamic_auth] [vmware] [vnc] #可以连接虚拟机
enabled=true
vncserver_listen=$my_ip #监听ip地址
vncserver_proxyclient_address=$my_ip #vnc代理服务监听地址
#novncproxy_base_url = http://172.16.254.63:6080/vnc_auto.html [workarounds] [wsgi] [xenserver] [xvp]
vim /etc/noa/nova.conf
③创建一个服务追踪的配置文件(补充到文件的末尾)
vim/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>
④重启httpd服务
systemctl restart httpd
⑤同步api、cell0数据库
su -s /bin/sh -c "nova-manage api_db sync" nova
su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
⑥创建cell证书的id
su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
⑦同步nova数据库
su -s /bin/sh -c "nova-manage db sync" nova
⑧列示cell证书列表
nova-manage cell_v2 list_cells
⑨重启并设置开机自启
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
openstack的库都建立在控制节点上,其他节点不需要建库
①安装nova包(先解决依赖)yum安装
qemu-img-ev-2.9.0-16.el7_4.8.1.x86_64.rpm qemu-kvm-ev-2.9.0-16.el7_4.8.1.x86_64.rpm qemu-kvm-common-ev-2.9.0-16.el7_4.8.1.x86_64.rpm
yum install openstack-nova-compute
②编辑nova配置文件
cp /etc/nova/nova.conf
/etc/nova/nova.conf
.bak
[DEFAULT]
my_ip=192.168.42.121 #管理网卡的ip地址
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
enabled_apis=osapi_compute,metadata
transport_url = rabbit://openstack:admin@controller [api]
#auth_strategy = keystone [api_database]
#connection = mysql+pymysql://nova:NOVA_DBPASS@controller/nova_api [barbican] [cache] [cells] [cinder]
#os_region_name = RegionOne [cloudpipe] [conductor] [console] [consoleauth] [cors] [cors.subdomain] [crypto] [database]
#connection = mysql+pymysql://nova:NOVA_DBPASS@controller/nova [ephemeral_storage_encryption] [filter_scheduler] [glance]
api_servers = http://controller:9292 [guestfs] [healthcheck] [hyperv] [image_file_url] [ironic] [key_manager] [keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = nova [libvirt]
virt_type=qemu #调用后台虚拟化 [matchmaker_redis] [metrics] [mks] [neutron]
#url = http://controller:9696
#auth_url = http://controller:35357
#auth_type = password
#project_domain_name = default
#user_domain_name = default
#region_name = RegionOne
#project_name = service
#username = neutron
#password = neutron
#service_metadata_proxy = true
#metadata_proxy_shared_secret = METADATA_SECRET [notifications] [osapi_v21] [oslo_concurrency]
lock_path=/var/lib/nova/tmp [oslo_messaging_amqp] [oslo_messaging_kafka] [oslo_messaging_notifications] [oslo_messaging_rabbit] [oslo_messaging_zmq] [oslo_middleware] [oslo_policy] [pci]
[placement]
os_region_name = RegionOne
auth_type = password
auth_url = http://controller:35357/v3
project_name = service
project_domain_name = Default
username = placement
password = placement
user_domain_name = Default [quota] [rdp] [remote_debug] [scheduler] [serial_console] [service_user] [spice] [ssl] [trusted_computing] [upgrade_levels] [vendordata_dynamic_auth] [vmware] [vnc]
enabled=true
vncserver_listen=0.0.0.0
vncserver_proxyclient_address=$my_ip
novncproxy_base_url = http://controller:6080/vnc_auto.html #控制节点地址 [workarounds] [wsgi] [xenserver] [xvp]
vim /etc/nova/nova.conf
③过滤计算节点是否开启虚拟化
egrep -c '(vmx|svm)' /proc/cpuinfo
④重启并设置开启自启
systemctl enable libvirtd.service openstack-nova-compute.service
· systemctl start libvirtd.service openstack-nova-compute.service #启不来查看日志,具体错误具体解决
⑤列示openstack管理虚拟化类型
openstack hypervisor list
⑥数据库同步计算节点(在controller节点执行)
su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova
⑦在控制节点查看计算服务的工作状态
openstack compute service list(enable表示开启,up运行)
openstack catalog list (查看服务列表)
openstack image list (查看镜像列表)
nova-status upgrade check (nova状态服务检测)
显示都成功即可
【如何删除一个计算节点】
注意:删除之前要将虚拟机停掉,对其进行备份。
查看openstack的compute服务列表
[root@controller ~]# openstack compute service list
+----+------------------+------------+----------+---------+-------+----------------------------+
| ID | Binary | Host | Zone | Status | State | Updated At |
+----+------------------+------------+----------+---------+-------+----------------------------+
| | nova-conductor | controller | internal | enabled | up | --05T07::14.000000 |
| | nova-consoleauth | controller | internal | enabled | up | --05T07::14.000000 |
| | nova-scheduler | controller | internal | enabled | up | --05T07::15.000000 |
| | nova-compute | compute | nova | enabled | up | --05T07::10.000000 |
| | nova-compute | controller | nova | enabled | up | --05T07::14.000000 |
| | nova-compute | storage | nova | enabled | up | --05T07::09.000000 |
+----+------------------+------------+----------+---------+-------+----------------------------+
查看openstack主机列表
[root@controller ~]# openstack host list
+------------+-------------+----------+
| Host Name | Service | Zone |
+------------+-------------+----------+
| controller | conductor | internal |
| controller | consoleauth | internal |
| controller | scheduler | internal |
| compute | compute | nova |
| controller | compute | nova |
| storage | compute | nova |
+------------+-------------+----------+
现在想要删除stroage这个主机的nova,只要把status和state分别变成disabe和down即可
首先关闭storage节点的nova和libvirt
[root@storage network-scripts]# systemctl stop libvirtd.service openstack-nova-compute.service
在controller节点查看服务列表
[root@controller ~]# openstack compute service list
+----+------------------+------------+----------+----------+-------+----------------------------+
| ID | Binary | Host | Zone | Status | State | Updated At |
+----+------------------+------------+----------+----------+-------+----------------------------+
| 1 | nova-conductor | controller | internal | enabled | up | 2019-06-05T07:40:54.000000 |
| 2 | nova-consoleauth | controller | internal | enabled | up | 2019-06-05T07:40:54.000000 |
| 3 | nova-scheduler | controller | internal | enabled | up | 2019-06-05T07:40:55.000000 |
| 6 | nova-compute | compute | nova | enabled | up | 2019-06-05T07:41:00.000000 |
| 7 | nova-compute | controller | nova | enabled | up | 2019-06-05T07:40:54.000000 |
| 8 | nova-compute | storage | nova | disabled | down | 2019-06-05T07:39:30.000000 |
+----+------------------+------------+----------+----------+-------+----------------------------+
如果执行上述命令没有down掉,则可以执行以下命令
[root@controller ~]# nova service-disable storage nova-compute
+---------+--------------+----------+
| Host | Binary | Status |
+---------+--------------+----------+
| storage | nova-compute | disabled |
+---------+--------------+----------+
[root@controller ~]# nova service-list
+----+------------------+------------+----------+----------+-------+----------------------------+-----------------+
| Id | Binary | Host | Zone | Status | State | Updated_at | Disabled Reason |
+----+------------------+------------+----------+----------+-------+----------------------------+-----------------+
| 1 | nova-conductor | controller | internal | enabled | up | 2019-06-05T07:45:24.000000 | - |
| 2 | nova-consoleauth | controller | internal | enabled | up | 2019-06-05T07:45:25.000000 | - |
| 3 | nova-scheduler | controller | internal | enabled | up | 2019-06-05T07:45:25.000000 | - |
| 6 | nova-compute | compute | nova | enabled | up | 2019-06-05T07:45:20.000000 | - |
| 7 | nova-compute | controller | nova | enabled | up | 2019-06-05T07:45:24.000000 | - |
| 8 | nova-compute | storage | nova | disabled | down | 2019-06-05T07:44:04.000000 | - |
+----+------------------+------------+----------+----------+-------+----------------------------+-----------------+
删除数据库中nova.servies表中的storage信息
MariaDB [nova]> delete from nova.services where host="storage";
Query OK, 1 row affected (0.00 sec) MariaDB [nova]> select host from nova.services;
+------------+
| host |
+------------+
| 0.0.0.0 |
| 0.0.0.0 |
| compute |
| controller |
| controller |
| controller |
| controller |
+------------+
7 rows in set (0.00 sec)
在计算节点(compute_nodes)删除storage信息
MariaDB [nova]> delete from compute_nodes where host="storage";
Query OK, 1 row affected (0.00 sec) MariaDB [nova]> select host from compute_nodes;
+------------+
| host |
+------------+
| compute |
| controller |
+------------+
2 rows in set (0.00 sec) 查看compute_nodes表中是否有hypervisor_hostname
MariaDB [nova]> select hypervisor_hostname from compute_nodes;
+---------------------+
| hypervisor_hostname |
+---------------------+
| compute |
| controller |
+---------------------+
2 rows in set (0.01 sec) 查看host已经删掉storage
[root@controller ~]# openstack host list
+------------+-------------+----------+
| Host Name | Service | Zone |
+------------+-------------+----------+
| controller | conductor | internal |
| controller | consoleauth | internal |
| controller | scheduler | internal |
| compute | compute | nova |
| controller | compute | nova |
+------------+-------------+----------+ 查看compute service 列表已经删除storage
[root@controller ~]# openstack compute service list
+----+------------------+------------+----------+---------+-------+----------------------------+
| ID | Binary | Host | Zone | Status | State | Updated At |
+----+------------------+------------+----------+---------+-------+----------------------------+
| 1 | nova-conductor | controller | internal | enabled | up | 2019-06-05T08:00:44.000000 |
| 2 | nova-consoleauth | controller | internal | enabled | up | 2019-06-05T08:00:45.000000 |
| 3 | nova-scheduler | controller | internal | enabled | up | 2019-06-05T08:00:45.000000 |
| 6 | nova-compute | compute | nova | enabled | up | 2019-06-05T08:00:50.000000 |
| 7 | nova-compute | controller | nova | enabled | up | 2019-06-05T08:00:44.000000 |
+----+------------------+------------+----------+---------+-------+----------------------------+ 以上就删除干净了
openstack部署nova的更多相关文章
- 超详细Openstack核心组件——nova部署
目录 OpenStack-nova组件部署 nova组件部署位置 计算节点Nova服务配置(CT配置) 计算节点配置Nova服务-c1节点配置 计算节点-c2(与c1相同)(除了IP地址) contr ...
- Openstack部署工具
Openstack发展很猛,很多朋友都很认同,2013年,会很好的解决OpenStack部署的问题,让安装,配置变得更加简单易用. 很多公司都投入人力去做这个,新浪也计划做一个Openstack的is ...
- Docker(十三):OpenStack部署Docker集群
1.介绍 本教程使用Compose.Machine.Swarm工具把WordPress部署在OpenStack上. 本节采用Consul作为Swarm的Discovery Service模块,要利用C ...
- 《OpenStack部署实践》
<OpenStack部署实践> 基本信息 作者: 张子凡 丛书名: 图灵原创 出版社:人民邮电出版社 ISBN:9787115346797 上架时间:2014-2-27 出版日期:2014 ...
- OpenStack之Nova模块
Nova简介 nova和swift是openstack最早的两个组件,nova分为控制节点和计算节点,计算节点通过nova computer进行虚拟机创建,通过libvirt调用kvm创建虚拟机,no ...
- 云计算与OpenStack(虚拟机Nova篇)
<云计算与OpenStack(虚拟机Nova篇)> 基本信息 作者: 伯龙 程志鹏 张杰 出版社:电子工业出版社 ISBN:9787121201202 上架时间:2013-8-5 出版日期 ...
- 网易OpenStack部署运维实战
OpenStack自2010年项目成立以来,已经有超过200个公司加入了 OpenStack 项目,目前参与 OpenStack 项目的开发人员有 17,000+,而且这些数字还在增加,作为一个开源的 ...
- OpenStack部署到Hadoop的四种方案
随着企业開始同一时候利用云计算和大数据技术.如今应当考虑怎样将这些工具结合使用.在这样的情况下,企业将实现最佳的分析处理能力.同一时候利用私有云的高速弹性 (rapid elasticity) 和单一 ...
- openstack部署工具简介
个人使用方面DevStack无疑,在可预见的未来时间内,DevStack仍将是众多开发者们的首选安装方式或工具.该方式主要是通过配置参数,执行shell脚本来安装一个OpenStack的开发环境.Gi ...
随机推荐
- PEP8规范 Python
前言 从很多地方搬运+总结,以后根据这个标准再将python的一些奇技淫巧结合起来,写出更pythonic的代码~ PEP8 编码规范 英文原版请点击这里 以下是@bobo的整理,原文请见PEP8 P ...
- Mysql导入Excel数据 日期问题 (Excel 与 MySQL 时间戳格式和日期 互转)
https://blog.csdn.net/ghw455954461/article/details/7247738 今天项目表中需要导入好几w条数据 ,但日期由两个一个是标准时间一个为时间戳,程序中 ...
- Elasticsearch:search template
我们发现一些用户经常编写了一些非常冗长和复杂的查询 - 在很多情况下,相同的查询会一遍又一遍地执行,但是会有一些不同的值作为参数来查询.在这种情况下,我们觉得使用一个search template(搜 ...
- 简单的理解 equals和==的区别
直接上代码: //== 比较的是地址 String test = new String("测试"); String test1 = new String("测试" ...
- Qt5 使用lambda
c11新特性中加入了lambda表达式,所以Qt 也支持 需在.pro文件中加入 CONFIG += c++11 m_timer = new QTimer(); m_timer->start() ...
- Codeforces Round #587 (Div. 3) C. White Sheet
链接: https://codeforces.com/contest/1216/problem/C 题意: There is a white sheet of paper lying on a rec ...
- [ERROR ] The Salt Master has cached the public key for this node, this salt minion will wait for 10 seconds before attempting to re-authenticate
2.salt master已缓存此节点的公钥,此salt minion将等待10秒,然后再尝试重新验证. [ERROR ] The Salt Master has cached the public ...
- Bootstrap Popover(弹出框)弹出自定义格式代码
HEAD 标签之间引入CSS:<link href="../../../public/css/bootstrap.min.css" rel="stylesheet& ...
- 【Wince-禁止重复启动程序】Wince 不重复启动程序
创建类Mutex.cs: using System; using System.Linq; using System.Collections.Generic; using System.Text; u ...
- FtpHelper.cs
网上找了好多,感觉还是自己这个使用起来方便点,记录一下! using System; using System.Collections; using System.IO; using System.L ...