OpenStack Train:基础环境安装

Posted flyfish225

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了OpenStack Train:基础环境安装相关的知识,希望对你有一定的参考价值。

标签(空测试用例格分隔):OpenStack Train 系列


一:准备NTP 服务器校验

1、统一时区,在所有节点(controller、compute01、compute02)上执行
# ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
注:安装时若有选择正确时区,可忽略上述设置

2、在控制节点 controller 安装 chrony,将控制节点作为 NTP 服务端,默认已经安装。
# yum -y install chrony
修改配置 /etc/chrony.conf
指定时间同步服务器,这里采用阿里云时钟源。如果无外网,则指向本机主机名
# vi /etc/chrony.conf
# server ntp.aliyun.com iburst
# server ntp1.aliyun.com iburst
server controller prefer
...
allow 172.16.10.0/24
allow 10.16.10.0/24
allow 20.16.10.0/24
local stratum 10

3、设置开机自启动

# systemctl enable chronyd.service
# systemctl start chronyd.service

4、在 ntp 服务器上启用 NTP 同步。

# timedatectl set-ntp yes
# timedatectl status

5、在所有计算节点(compute01、compute02)安装 chrony,默认已安装

# yum -y install chrony
然后,修改配置/etc/chrony.conf 中服务器为 controller,即

#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
server controller prefer
设置开机自启动
# systemctl enable chronyd
# systemctl start chronyd
验证时间同步:
# chronyc sources -v

二: MariaDB 安装及配置

1、安装与配置数据库
在控制节点(controller)执行以下操作。
# yum -y install mariadb mariadb-server python2-Pymysql
2、配置数据库。
创建并编辑文件/etc/my.cnf.d/openstack.cnf
vim /etc/my.cnf.d/openstack.cnf
[mysqld]
# 此处可只 bind 为内网管理 IP,限制外部访问
bind-address = 0.0.0.0
default-storage-engine = innodb

innodb_file_per_table = on
max_connections = 8192
collation-server = utf8_general_ci
character-set-server = utf8
修改“/usr/lib/systemd/system/mariadb.service”文件,在文件[Service]下添加如下内容:
# vim /usr/lib/systemd/system/mariadb.service
LimitNOFILE=65535
LimitNPROC=65535
注:不修改此配置,max_connections 参数不会生效
3、设置开机自启动
# systemctl daemon-reload
# systemctl enable mariadb.service
# systemctl start mariadb.service
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, well need the current
password for the root user. If youve just installed MariaDB, and
you havent 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
production environment.
Remove anonymous users? [Y/n] Y
... Success!
Normally, root should only be allowed to connect from localhost. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] n
... skipping.
By default, MariaDB comes with a database named test that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] Y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far

will take effect immediately.
Reload privilege tables now? [Y/n] Y
... Success!
Cleaning up...
All done! If youve completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!

------

设置 root 密码为:mysql 或者其他复杂密码,允许 root 登录,不管在 Disallow root login remotely 选择了 N 还是 Y,都只允许在本机登录。可以使用
以下 sql 进行 update 设置
update user set Host=% where User=root and Host=localhost and user=root;
GRANT ALL PRIVILEGES ON *.* TO root@%IDENTIFIED BY root WITH GRANT OPTION;

flush privileges;

5、登录验证
# mysql -uroot -pmysql
Welcome to the MariaDB monitor. Commands end with ; or \\g.
Your MariaDB connection id is 15
Server version: 10.3.20-MariaDB MariaDB Server
Copyright (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)]> exit

6. 测试试用natvcat 连接 正常既可以。

三:RabbitMQ 安装及配置

1、安装与配置 rabbitMQ
在控制节点(controller)执行以下操作
# yum -y install rabbitmq-server

2、配置 rabbitmq,修改 rabbitmq 默认打开文件句柄数限制
# vi /usr/lib/systemd/system/rabbitmq-server.service
在 Service 模块下添加如下参数:
[Service]
LimitNOFILE=32768

3、设置开机自启动
# systemctl daemon-reload
# systemctl enable rabbitmq-server.service
# systemctl restart rabbitmq-server.service

4、在 rabbitMQ 中添加用于 openstack 的用户并授予管理员权限。
# rabbitmqctl add_user openstack openstack
# rabbitmqctl set_user_tags openstack administrator
# rabbitmqctl set_permissions openstack ".*" ".*" ".*"
也可在 web 控制台完成用户添加
注:为 openstack 用户设置的密码,密码不要包含字符"#"

5、启用 rabbitmq-manager 插件,开启 Web 控制台
# rabbitmq-plugins enable rabbitmq_management

6、登录验证
控制台登录:http://controller:15672

guest/guest (缺省账户)
openstack/openstack

/*
注:使用 hosts 访问,需要修改 C:\\Windows\\System32\\drivers\\etc\\hosts 文件,添加如下记录
172.16.10.11 controller
*/



四:Memcache 安装及配置

1、安装与配置 memcached
在控制节点(controller)执行以下操作
# yum -y install memcached python-memcached

2、修改配置
# vi /etc/sysconfig/memcached
PORT="11211"
USER="memcached"
MAXCONN="4096" CACHESIZE="256"
OPTIONS="-l 0.0.0.0,::1"
注意监听 IP 地址,也可以设置成 本地IP地址

3、设置服务开机自启
# systemctl enable memcached.service
# systemctl restart memcached.service

4、验证
# systemctl status memcached

● memcached.service - memcached daemon
Loaded: loaded (/usr/lib/systemd/system/memcached.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2021-12-28 15:59:20 CST; 26s ago
Main PID: 7451 (memcached)
Tasks: 10
CGroup: /system.slice/memcached.service
└─7451 /usr/bin/memcached -p 11211 -u memcached -m 64 -c 4096 -l 0.0.0.0,::1
Dec 28 15:59:20 controller systemd[1]: Started memcached daemon.

# netstat -atnp |grep 11211

tcp 0 0 0.0.0.0:11211 0.0.0.0:* LISTEN 7451/memcached
tcp6 0 0 ::1:11211 :::* LISTEN 7451/memcached



五:准备etcd 服务

1、安装与 etcd
在控制节点(controller)执行以下操作
yum -y install etcd

2、配置 etcd
# cp -ap /etc/etcd/etcd.conf /etc/etcd/etcd.conf.bak
# vim /etc/etcd/etcd.conf
修改如下9项参数,其余的全部注释掉。
#[Member]
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_PEER_URLS="http://172.16.10.11:2380"
ETCD_LISTEN_CLIENT_URLS="http://172.16.10.11:2379"
ETCD_NAME="controller"
#[Clustering]
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://172.16.10.11:2380"
ETCD_ADVERTISE_CLIENT_URLS="http://172.16.10.11:2379"
ETCD_INITIAL_CLUSTER="controller=http://172.16.10.11:2380"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster-01"
ETCD_INITIAL_CLUSTER_STATE="new"

3、设置服务开机自启
# systemctl enable etcd
# systemctl start etcd

六:安装 openstack 客户端

1、确保所有节点上已经安装了 OpenStack 客户端
# yum -y install python-openstackclient

以上是关于OpenStack Train:基础环境安装的主要内容,如果未能解决你的问题,请参考以下文章

OpenStack Train版-1.环境安装

OpenStack Train:系统环境实施准备

#打卡不停更#[图文并茂]Packstack部署train版openstack

OpenStack Train:业务组件Neutron装安装

OpenStack 运维 - 部署Keystone组件 [Train版]

OpenStack Train:业务组件装 glances安装