云计算|OpenStack|社区版OpenStack安装部署文档(二---OpenStack运行环境搭建)

news2024/9/20 21:29:45

前言:

一个良好的运行环境对于任何一个部署工作来说都是必须的,俗话说 万事开头难,其实很多部署工作失败的原因在于初始环境没有正确的配置,因此,按照官网的部署文档并结合自己的实际情况,配置一个合理的OpenStack运行环境是十分有必要的。

OpenStack的运行环境配置文档:Environment — Installation Guide documentation

 可以看到内容是比较多得,其中需要注意的是,SQL数据库也就是MySQL或者mariadb,或者postgresql。以及消息队列服务rabbitmq,消息中间件memcached和etcd都是划归为运行环境的,etcd计划使用集群而不是官方文档内的单实例etcd。

下面的环境配置根据自己的实际情况做得,并没有完全遵照官方文档。

一,

security 安全方面

三个服务器都关闭防火墙和selinux

systemctl disable firewalld && systemctl stop firewalld
vim /etc/selinux/config
编辑文件,关闭selinux
修改SELINUX=disabled

当然,OpenStack有一个工具名称为openstack-selinux,但为了部署更顺畅,还是将防火墙和selinux彻底关闭比较好。

二,

设置主机名称和域名解析hosts

192.168.123.130 

[root@openstack1 ~]# cat /etc/hostname
openstack1

192.168.123.131

[root@openstack2 ~]# cat /etc/hostname 
openstack2

192.168.123.131

[root@openstack3 ~]# cat /etc/hostname 
openstack3

三个服务器都一样的hosts:

[root@openstack1 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.123.130 openstack1 manager.node
192.168.123.131 openstack2 work.node1
192.168.123.132 openstack3 work.node2
[root@openstack1 ~]# scp /etc/hosts openstack1:/etc/
hosts                                                                                                               100%  274   283.5KB/s   00:00    
[root@openstack1 ~]# scp /etc/hosts openstack2:/etc/
hosts                                                                                                               100%  274    65.9KB/s   00:00    
[root@openstack1 ~]# scp /etc/hosts openstack3:/etc/
hosts                                

三,

服务器之间的免密

以192.168.123.130为例:

ssh-keygen -t rsa

一路回车到底,生成私钥

拷贝私钥,按提示输入yes和对应主机的密码

ssh-copy-id 192.168.123.130
ssh-copy-id 192.168.123.131
ssh-copy-id 192.168.123.132

四,

ntp时间服务器的搭建

以130服务器作为时间服务器,其它两个节点同步130服务器的时间

192.168.123.130服务器:

yum install ntp -y

编辑配置文件 /etc/ntp.conf,增加这么两行:

server 127.127.1.0
fudge  127.127.1.0 stratum 10

重启服务:

systemctl restart ntpd

192.168.123.131服务器和132服务器:

yum install ntp -y

编辑配置文件 /etc/ntp.conf,增加这一行:

server 192.168.123.130 prefer

 重启服务:

systemctl restart ntpd

在131和132上,查看ntp状态是这样的表示时间服务器搭建完毕(需要等待10来分钟,才会这个状态):

[root@openstack2 ~]# ntpstat 
synchronised to NTP server (192.168.123.130) at stratum 12
   time correct to within 45 ms
   polling server every 64 s

 五,

yum仓库的配置

基础仓库1:

cat >/etc/yum.repos.d/centos7.repo <<EOF 
[aliyun]
name=aliyun
baseurl=https://mirrors.aliyun.com/centos-vault/7.4.1708/os/x86_64/
enable=1
gpgcheck=0
[update]
name=aliyun-update
baseurl=https://mirrors.aliyun.com/centos-vault/7.4.1708/updates/x86_64/
enable=1
gpgcheck=0
EOF

基础仓库2: 

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

EPEL仓库: 

cat >/etc/yum.repos.d/epel.repo <<EOF
[epel]
name=epel
baseurl=https://mirrors.aliyun.com/epel-archive/7.8/x86_64/
enable=1
gpgcheck=0
EOF

 OpenStack仓库:

cat  >/etc/yum.repos.d/openstack.repo <<EOF
[openstack]
name=openstack
baseurl=https://mirrors.aliyun.com/centos-vault/7.6.1810/cloud/x86_64/openstack-rocky/
enable=1
gpgcheck=0
EOF
yum upgrade -y
yum install centos-release-openstack-rocky -y
yum install python-openstackclient -y
yum install openstack-selinux  -y

六,

SQL database 

官方文档:SQL database for RHEL and CentOS — Installation Guide documentation

根据文档,选用mariadb,安装步骤如下:

1,

在192.168.123.130控制节点安装

yum install mariadb mariadb-server python2-PyMySQL -y

2,

启动数据库服务 

systemctl enable mariadb && systemctl start mariadb

3,

新建mariadb的配置文件:

因为是安装在controller节点192.168.123.130,因此,绑定IP为130

cat >/etc/my.cnf.d/openstack.cnf <<EOF
[mysqld]
bind-address = 192.168.123.130

default-storage-engine = innodb
innodb_file_per_table = on
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8
EOF

4,

初始化数据库

mysql_secure_installation

输出如下:

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a

5,

数据库远程连接配置

登陆数据库,给root用户远程登陆权限

[root@openstack1 ~]# mysql -uroot -p 
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 10.1.20-MariaDB MariaDB Server

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [mysql]> grant all privileges on *.* to 'root'@'%' identified by '123456';
Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql]> grant all privileges on *.* to 'root'@'localhost' identified by '123456';
Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

6,

使用Navicat测试

 七,

Message queue for RHEL and CentOS

消息队列服务器--rabbitmq

官方文档:

Message queue for RHEL and CentOS — Installation Guide documentation

使用的rabbitmq,依然是安装在130服务器上,安装步骤:

1,Install the package:

yum install rabbitmq-server -y

2,Start the message queue service and configure it to start when the system boots:

启动服务并加入自启动

systemctl enable rabbitmq-server.service && systemctl start rabbitmq-server.service

3,Add the openstack user

增加用户并设置密码,密码为RABBIT_PASS,此密码可以自定义

rabbitmqctl add_user openstack RABBIT_PASS

4,

用户赋权

rabbitmqctl set_permissions openstack ".*" ".*" ".*"
输出如下:
[root@openstack1 ~]# rabbitmqctl set_permissions openstack ".*" ".*" ".*"
Setting permissions for user "openstack" in vhost "/"

八,

缓存数据库

官方文档:Memcached for RHEL and CentOS — Installation Guide documentation

缓存数据库的作用是保存用户令牌,此数据库仍然是安装在130服务器上

部署步骤

1,

安装缓存数据库

yum install memcached python-memcached -y

2,

Edit the /etc/sysconfig/memcached file and complete the following actions:

编辑缓存数据库的配置文件;

Change the existing line OPTIONS="-l 127.0.0.1,::1" 修改为OPTIONS="-l 127.0.0.1,::1,openstack1"

这里说明一下,openstack1是130的主机名

3,

设置开启启动并启动缓存服务:

systemctl enable memcached&&systemctl start memcached
systemctl status memcached

最后的输出如下:

[root@openstack1 ~]# systemctl status memcached
● memcached.service - memcached daemon
   Loaded: loaded (/usr/lib/systemd/system/memcached.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2023-01-30 19:13:20 CST; 1s ago
 Main PID: 3345 (memcached)
   CGroup: /system.slice/memcached.service
           └─3345 /usr/bin/memcached -p 11211 -u memcached -m 64 -c 1024 -l 127.0.0.1,::1,openstack1

Jan 30 19:13:20 openstack1 systemd[1]: Started memcached daemon.
Jan 30 19:13:20 openstack1 systemd[1]: Starting memcached daemon...

九,

etcd集群的安装

集群安装使用ansible自动部署,具体步骤见原来的博客:centos7操作系统 ---ansible剧本离线快速部署etcd集群_centos离线安装etcd_晚风_END的博客-CSDN博客

最终测试结果如下即可:

[root@openstack1 ~]# etcd_search  endpoint status -w table
+------------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
|           ENDPOINT           |        ID        | VERSION | DB SIZE | IS LEADER | IS LEARNER | RAFT TERM | RAFT INDEX | RAFT APPLIED INDEX | ERRORS |
+------------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
| https://192.168.123.130:2379 | 8fef69ba298e9bc3 |   3.4.9 |   20 kB |      true |      false |        55 |          9 |                  9 |        |
| https://192.168.123.131:2379 | 548b7cecabe21cd7 |   3.4.9 |   20 kB |     false |      false |        55 |          9 |                  9 |        |
| https://192.168.123.132:2379 | 28b34b044580be86 |   3.4.9 |   20 kB |     false |      false |        55 |          9 |                  9 |        |
+------------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------

以上就是openstack的基本运行环境了,部署完毕后,可以将三个虚拟机打上快照啦。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/189005.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

JavaScript对象~

String对象&#xff1a; 它是 JavaScript 的一种基本的数据类型 String 对象的 length 属性声明了该字符串中的字符数&#xff0c;String 类定义了大量操作字符串的方法&#xff0c;例如从字符串中提取字符或子串&#xff0c;或者检索字符或子串 需要注意的是&#xff0c;Ja…

Java图形化界面---进度条

目录 一、进度条的介绍 二、创建进度条 三、简单案例 四、子线程创建进度条 &#xff08;1&#xff09;为什么要使用子线程创建进度条 &#xff08;2&#xff09;子线程创建进度条的代码 五、创建进度对话框 &#xff08;1&#xff09;如何创建进度对话框 &#xff08;2&…

win32Openssl -1_1_1下载安装与使用

1、下载 https://mp.csdn.net/mp_blog/creation/editor?spm1001.2014.3001.5352 此处我下载的版本是&#xff1a; 2、安装 双击安装&#xff0c;可以自定义安装路径。我的安装路径是&#xff1a;D:\openssl1\OpenSSL-Win32 3、VS2022中使用 使用场景&#xff1a;计算MD5校…

shiro拦截axios请求导致@RequireRole注解失效

文章目录ShiroRequiresRole注解对于axios请求无效场景再现解决方案网上的解决方案最近在整理一个自己以前做过的系统&#xff0c;想要添加一些功能&#xff0c;发现shiro框架出现了点问题&#xff0c;觉得这个错误应该还是蛮有价值的&#xff0c;就写出来和大家分享下… ShiroR…

PostgreSQL11 | 数据类型和运算符

上一篇文章整理并拓展了原书《PostgreSql11从入门到精通》第四章的内容&#xff0c;详细讲述了有关数据库表的创建、修改与删表 PostgreSQL11 | pgsql建表、改表与删表http://t.csdn.cn/ojgCl这一篇整理并拓展原书第五章&#xff08;书第73页起&#xff09;的内容。 数据类型和…

【C++】从0到1入门C++编程学习笔记 - 提高编程篇:模板

文章目录一、模板的概念二、函数模板2.1 函数模板语法2.2 函数模板注意事项2.3 函数模板案例2.4 普通函数与函数模板的区别2.5 普通函数与函数模板的调用规则2.6 模板的局限性三、类模板3.1 类模板语法3.2 类模板与函数模板区别3.3 类模板中成员函数创建时机3.4 类模板对象做函…

【Linux】编辑器——vim的使用

环境&#xff1a;centos7.6&#xff0c;腾讯云服务器Linux文章都放在了专栏&#xff1a;【Linux】欢迎支持订阅&#x1f339;vim的基本概念vim是什么&#xff1f;vim是一款多模式的编辑器&#xff0c;是vi的升级版本&#xff0c;在兼容vi指令的同时&#xff0c;还带有一些新的特…

Linux主机下连接远程postgresql数据库、容器版postgresql数据库

背景 简单啰嗦一下背景&#xff0c;想看解决方案的&#xff0c;直接跳过本章节。 最近在预研postgresql的功能&#xff0c;其中有个场景就是需要在系统中ssh到postgresql集群上执行psql命令。但是我只有容器版的postgresql&#xff0c;并不能直接ssh到容器中。而ssh到我自己的…

Spring5 框架新功能(Webflux)

目录 1、SpringWebflux 介绍 2、响应式编程&#xff08;Java 实现&#xff09; 3、响应式编程&#xff08;Reactor 实现&#xff09; 1、SpringWebflux 介绍 &#xff08;1&#xff09;SpringWebflux 是 Spring5 添加新的模块&#xff0c;用于 web 开发的&#xff0c;功能和…

JDBC用PrepareStatement解决SQL注入

什么是sql注入&#xff1f;SQL注入(SQL injection)是因为应用程序在执行SQL语句的时候没有正确的处理用户输入字符串&#xff0c;将用户输入的恶意字符串拼接到了SQL语句中执行&#xff0c;从而导致了SQL注入。例如&#xff1a;当你的用户名为 qwert or 11;# 密码为123&#xf…

springmvc拦截器及源码分析

springmvc拦截器是我们项目开发中用到的一个功能&#xff0c;常常用于对Handler进行预处理和后处理。本案例来演示一个较简单的springmvc拦截器的使用&#xff0c;并通过分析源码来探究拦截器的执行顺序是如何控制的。1、springmvc拦截器使用1.1 项目初始搭建1.1.1 创建一个mav…

如何用ffmpeg截取视频片段截取时间不准确的坑

之前在工作中&#xff0c;有遇到需要程序化截取视频片段的场景&#xff0c;这里使用ffmpeg命令行就可以很容易实现&#xff0c;这里也记录下我们使用过程中遇到的坑&#xff0c;希望对大家也有所帮助。    举个例子&#xff0c;当我们要截取视频文件中input.mp4的第15秒到第9…

windows+python+bleak+BLE低功耗蓝牙通讯连接

前言 1.为什么选bleak   参考这篇知乎&#xff1a;https://zhuanlan.zhihu.com/p/577687336   windows端使用python连接常规的BLE设备&#xff08;蓝牙4.0&#xff09;&#xff0c;仅考虑bleak模块&#xff08;排除pybluez、pybluez2、pygatt&#xff09;。 2.本文主要参…

【c语言】对结构体数组按照某项规则进行排序

这是基于qsort()函数进行的简单排序。&#xff08;附带其他类型的数组使用qsort()进行的排序&#xff09; 目录 一、qsort()函数 二、compare()函数 1.结构体数组 1&#xff09;升序实现 2&#xff09;降序实现 2.整型数组 为什么不直接返回 a>b&#xff08;a&#x…

CentOS 下PostgreSQL安装、简单配置及数据迁移(存储目录迁移)

目录 数据库安装 数据库初始化 配置修改 1、修改监听范围 2、修改数据库用户密码 3、开启远程连接 附件内容&#xff1a;PostgreSQL数据迁移 方式一&#xff0c;从新初始化数据库在导出导入 方式二&#xff1a;存储文件物理迁移 数据库安装 安装包下载请参考PG官网(根据…

OAuth2介绍(一)

目录 1. 什么是OAuth2.0 2. OAuth2中的角色 3. 认证流程 4. 生活中的Oauth2思维 5. 令牌的特点 6. OAuth2授权方式 6.1 授权码 6.2 隐藏方式 6.3 密码方式 6.4 凭证方式 7. 流程 7.1 资源所有者 7.2 客户 7.3 客户 7.4 认证服务器 7.5 客户 7.6 资源服务器 1.…

【高并发】- 分布式事务都不会?

前言 本章主要对分布式事务进行梳理和讲解。可能在业务设计过程中&#xff0c;各微服务都采用了独立数据库&#xff0c;所以&#xff0c;这些微服务之间的数据共享有了更高的要求&#xff1a;要解决数据一致性的问题。 1. 数据一致性 数据一致性是指&#xff1a;数据被多次操作…

【自然语言处理】主题建模评估:连贯性分数(Coherence Score)

主题建模评估&#xff1a;连贯性分数&#xff08;Coherence Score&#xff09;1.主题连贯性分数 主题连贯性分数&#xff08;Coherence Score&#xff09;是一种客观的衡量标准&#xff0c;它基于语言学的分布假设&#xff1a;具有相似含义的词往往出现在相似的上下文中。 如果…

如何使用ArcGIS计算道路中心线

1.概述 在制图等应用的时候&#xff0c;有时需要将双线的面状道路提取中心线&#xff0c;转换为线状的道路。 由于道路多为不规则的图形&#xff0c;提取难度比较高&#xff0c;加上能提取中心线的软件有限&#xff0c;更加增加了提取的难度。 ArcGIS虽然提供了提取中心线的…

C语言文件操作(二)

文件的随机读写fseek函数#include <stdio.h>int main() {FILE* pf fopen("test.txt", "r");if (NULL pf){perror("fopen");return 1;}char ch fgetc(pf);printf("%c\n", ch);fseek(pf, 2, SEEK_SET);ch fgetc(pf);printf(&q…