OpenStack手动分布式部署Nova【Queens版】

news/2024/11/26 4:49:40/

目录

Nove简介:

1、登录数据库配置(在controller执行)

  1.1登录数据库

  1.2数据库里创建nova-api

  1.3数据库登录授权

  1.4创建nova用户

  1.5添加admin用户为nova用户

  1.6创建nova服务端点

  1.7创建compute API 服务端点

  1.8创建一个placement服务用户 

  1.9添加placement用户为项目服务admin角色 

  1.10创建在服务目录创建Placement API服务 

  1.11创建Placement API服务端点 

2、安装nova(在controller执行)

  2.1安装软件包

  2.2编辑 /etc/nova/nova.conf

  2.3重启HTTP服务、同步数据库

  2.4开启计算各种服务

  2.5做一个重启脚本

3、然后再计算节点上配置(在compute执行)

  3.1计算节点上安装nova

  3.2修改/etc/nova/nova.conf配置

  3.3启动服务

4、在controller节点上验证

  4.1在controller节点上验证有没有计算节点

  4.2发现计算节点

  4.3配置自动发现节点


Nove简介:

nova组件是用来建虚拟机的(功能:负责响应虚拟机创建请求、调度、销毁云主机)

nova主要组成:

  • (1).nova api service------安装在controller节点:接受和相应客户端发送的请求,nova-api负责接收和响应终端用户由管虚拟机和云硬盘的请求。就是说我想在openstack中创建个虚拟机(创建虚拟机最终在nova中完成),我发出的请求就被nova-api接收并发送到nova中去,然后在进行下一步具体操作,nova-api是整个nova的入口。它接收用户请求,将指令发送到消息队列,由相应的服务执行相关的指令消息,他提供了openstack API,亚马逊EC2 API,以及管理员控制API。
  • (2)nova-api-metadata service:接受从实例元数据发来的请求,该服务通常于nova-network服务在对主机模式下运行,也就说由多个nova节点才会用得到
  • (3)nova compute------安装在compute节点:是nova组件中最核心的服务,它实现了管理虚拟机的功能,实现了在计算节点上创建,启动,暂停,关闭,和删除虚拟机。
  • (4)nova Scheduler:主要起到调度作用,假如现在又多台nova计算节点,当用户发起创建虚拟机的请求时,nova Scheduler会决定把虚拟机创建放在那个计算节点上。
  • (5)nova conductor:主要提供数据查询功能,提供nova compute和Database之间的交互数据,那为啥nova compute不直接去访问数据库呢?只是为防止nova compute被攻击后,数据库就会不安全,所以需要有nova conductor去调度

1、登录数据库配置(在controller执行)

  1.1登录数据库

[root@controller ~]# mysql -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 18
Server version: 10.3.20-MariaDB MariaDB ServerCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MariaDB [(none)]> 

  1.2数据库里创建nova-api

MariaDB [(none)]> CREATE DATABASE nova_api;
Query OK, 1 row affected (0.001 sec)MariaDB [(none)]> CREATE DATABASE nova;
Query OK, 1 row affected (0.002 sec)MariaDB [(none)]>  CREATE DATABASE nova_cell0;
Query OK, 1 row affected (0.001 sec)

  1.3数据库登录授权

GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY '000000';
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY '000000';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY '000000';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY '000000';
GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' IDENTIFIED BY '000000';
GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY '000000';

【记得退出数据库】

MariaDB [(none)]> quit;
Bye

  1.4创建nova用户

openstack user create --domain default --password nova nova

  

  1.5添加admin用户为nova用户

openstack role add --project service --user nova admin

  1.6创建nova服务端点

openstack service create --name nova --description "OpenStack Compute" compute

  1.7创建compute API 服务端点

openstack endpoint create --region RegionOne compute public http://controller:8774/v2.1

  

  1.8创建一个placement服务用户 

openstack user create --domain default --password-prompt placement

  

  1.9添加placement用户为项目服务admin角色 

openstack role add --project service --user placement admin

  1.10创建在服务目录创建Placement API服务 

openstack service create --name placement --description "Placement API" placement

  1.11创建Placement API服务端点 

openstack endpoint create --region RegionOne placement public http://controller:8778

  

2、安装nova(在controller执行)

  2.1安装软件包

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

[root@controller ~]# cp /etc/nova/nova.conf{,.bak}
[root@controller ~]# grep -Ev "^$|#" /etc/nova/nova.conf.bak > /etc/nova/nova.conf
[root@controller ~]# vi /etc/nova/nova.conf
[DEFAULT]
enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:123456@controller
my_ip = 172.16.21.37
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[api_database]connection = mysql+pymysql://nova:000000@controller/nova_api[database]connection = mysql+pymysql://nova:000000@controller/nova[api]
auth_strategy = keystone[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = 000000[vnc]
enabled = true
server_listen = $my_ip
server_proxyclient_address = $my_ip[glance]
api_servers = http://controller:9292[oslo_concurrency]
lock_path = /var/lib/nova/tmp[placement]
os_region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://controller:35357/v3
username = placement
password = 000000

##由于软件包的一个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,denyAllow from all</IfVersion>
</Directory>

  2.3重启HTTP服务、同步数据库

systemctl restart httpd
[root@controller ~]# su -s /bin/sh -c "nova-manage api_db sync" nova
[root@controller ~]# su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
[root@controller ~]# su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
2e46e668-cfaf-4034-b6a8-154dc925c12d
[root@controller ~]# su -s /bin/sh -c "nova-manage db sync" nova
/usr/lib/python2.7/site-packages/pymysql/cursors.py:170: Warning: (1831, u'Duplicate index `block_device_mapping_instance_uuid_virtual_name_device_name_idx`. This is deprecated and will be disallowed in a future release')result = self._query(query)
/usr/lib/python2.7/site-packages/pymysql/cursors.py:170: Warning: (1831, u'Duplicate index `uniq_instances0uuid`. This is deprecated and will be disallowed in a future release')result = self._query(query)
[root@controller ~]# su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova
+-------+--------------------------------------+------------------------------------------+-------------------------------------------------+----------+
|  Name |                 UUID                 |              Transport URL               |               Database Connection               | Disabled |
+-------+--------------------------------------+------------------------------------------+-------------------------------------------------+----------+
| cell0 | 00000000-0000-0000-0000-000000000000 |                  none:/                  | mysql+pymysql://nova:****@controller/nova_cell0 |  False   |
| cell1 | 2e46e668-cfaf-4034-b6a8-154dc925c12d | rabbit://openstack:****@controller:5672/ |    mysql+pymysql://nova:****@controller/nova    |  False   |
+-------+--------------------------------------+------------------------------------------+-------------------------------------------------+----------+

  2.4开启计算各种服务

[root@controller ~]# systemctl enable \openstack-nova-api.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-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.

  2.5做一个重启脚本

[root@controller ~]# vi nova-restart.sh#!/bin/bash
systemctl restart     openstack-nova-api.service     openstack-nova-scheduler.service     openstack-nova-conductor.service     openstack-nova-novncproxy.service
[root@controller ~]# bash nova-restart.sh 

3、然后再计算节点上配置(在compute执行)

  3.1计算节点上安装nova

[root@computer ~]# yum install openstack-nova-compute -y

  3.2修改/etc/nova/nova.conf配置

[root@computer ~]# yum install openstack-nova-compute -y^C
[root@computer ~]# cp /etc/nova/nova.conf{,.bak}
[root@computer ~]# grep -Ev "^$|#" /etc/nova/nova.conf.bak > /etc/nova/nova.conf
[root@computer ~]# vi /etc/nova/nova.conf

[DEFAULT]enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:000000@controller
my_ip = 172.16.21.37
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver[api]
auth_strategy = keystone[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = 000000[vnc]
enabled = True
server_listen = 0.0.0.0
server_proxyclient_address = $my_ip
novncproxy_base_url = http://controller:6080/vnc_auto.html[glance]
api_servers = http://controller:9292[oslo_concurrency]
lock_path = /var/lib/nova/tmp[placement]
os_region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://controller:35357/v3
username = placement
password = 000000

  3.3启动服务

[root@computer ~]# systemctl enable libvirtd.service openstack-nova-compute.service
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-compute.service to /usr/lib/systemd/system/openstack-nova-compute.service.
[root@computer ~]# systemctl start libvirtd
[root@computer ~]# systemctl start libvirtd.service openstack-nova-compute.service

4、在controller节点上验证

  4.1在controller节点上验证有没有计算节点

[root@controller ~]# openstack compute service list --service nova-compute
+----+--------------+----------+------+---------+-------+----------------------------+
| ID | Binary       | Host     | Zone | Status  | State | Updated At                 |
+----+--------------+----------+------+---------+-------+----------------------------+
|  9 | nova-compute | computer | nova | enabled | up    | 2023-02-10T15:15:29.000000 |
+----+--------------+----------+------+---------+-------+----------------------------+

  4.2发现计算节点

[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 computes from cell 'cell1': 87c82cc2-68f4-41d2-8427-5c959215ef1d
Checking host mapping for compute host 'computer': 833f408b-d646-483e-80eb-6f67c390fd43
Creating host mapping for compute host 'computer': 833f408b-d646-483e-80eb-6f67c390fd43
Found 1 unmapped computes in cell: 87c82cc2-68f4-41d2-8427-5c959215ef1d

  4.3配置自动发现节点

[root@controller ~]# vi /etc/nova/nova.conf[scheduler]
discover_hosts_in_cells_interval = 300

 nova部署完成


 

OpenStack简介 | 常见的基础组件

OpenStack手动分布式部署环境准备【Queens版】

OpenStack手动分布式部署Keystone【Queens版】

OpenStack手动分布式部署Glance【Queens版】


http://www.ppmy.cn/news/31184.html

相关文章

【JavaScript速成之路】JavaScript函数

&#x1f4c3;个人主页&#xff1a;「小杨」的csdn博客 &#x1f525;系列专栏&#xff1a;【JavaScript速成之路】 &#x1f433;希望大家多多支持&#x1f970;一起进步呀&#xff01; 文章目录前言1&#xff0c;函数基础1.1&#xff0c;函数概念1.2&#xff0c;函数使用1.3&…

【JavaEE】前后端分离实现博客系统(页面构建)

文章目录1 效果展示1.1 博客登录页面1.2 博客列表页面1.3 博客详情页面1.4 博客编辑页面2 页面具体实现2.1 博客列表页的实现2.2 博客详情页的实现2.3 博客登录页面的实现2.4 博客编辑页面的实现写在最后1 效果展示 1.1 博客登录页面 用于实现用户的登录功能&#xff0c;并展…

用Python帮老叔选出好基金,大赚一笔,老叔专门提着茅台登门道谢

我有个老叔很喜欢买基金&#xff0c;因为不想被割韭菜&#xff0c;所以啥群都没进&#xff0c;全部自己精挑细选。 看着他的一个本子密密麻麻地写了一大堆东西&#xff0c;全是基金的数据分析&#xff0c;一大把年纪了挺不容易的&#xff0c;于是就决定帮他一把。 在跟他详谈…

「Vue面试题」动态给vue的data添加一个新的属性时会发生什么?怎样去解决的?

一、直接添加属性的问题 我们从一个例子开始 定义一个p标签&#xff0c;通过v-for指令进行遍历 然后给botton标签绑定点击事件&#xff0c;我们预期点击按钮时&#xff0c;数据新增一个属性&#xff0c;界面也 新增一行 <p v-for"(value,key) in item" :key&q…

matlab在管理学中的应用简matlab基础【三】

规划论及MATLAB计算 1、线性规划 问题的提出 例1. 某工厂在计划期内要安排甲、乙两种产品的生产&#xff0c;已知生产单位产品所需的资源A、B、C的消耗以及资源的计划期供给量&#xff0c;如下表&#xff1a; 问题&#xff1a;工厂应分别生产多少单位甲、乙产品才能使工厂获…

软测面试了一个00后,绝对能称为是内卷届的天花板

前言 公司前段缺人&#xff0c;也面了不少测试&#xff0c;结果竟然没有一个合适的。一开始瞄准的就是中级的水准&#xff0c;也没指望来大牛&#xff0c;提供的薪资也不低&#xff0c;面试的人很多&#xff0c;但平均水平很让人失望。令我印象最深的是一个00后测试员&#xf…

ERP系统哪家比较好?

ERP系统哪家好&#xff1f;在选择ERP系统时&#xff0c;我们可以按照这三个维度&#xff0c;然后再按照需求去选择ERP系统。 市面上ERP软件大概可以分为三大类&#xff1a; ① 标准ERP应用&#xff1a;功能比较固定&#xff0c;难以满足个性化需求&#xff0c;二次开发难度很高…

nginx常用命令与简单转发配置

一、Nginx常用基本命令 1、启动Nginx服务器命令&#xff1a; 去到sbin路径&#xff1a;cd /usr/local/nginx/sbin 启动Nginx服务器: ./nginx2、查看Nginx 版本号命令&#xff1a; ./nginx -v 或 ./nginx -V3、查看Nginx进程命令&#xff1a; ps aux|grep nginx4、检查Nginx…