【OpenStack】环境搭建-基础组件安装

212 阅读2分钟

image.png

开启掘金成长之旅!这是我参与「掘金日新计划 · 2 月更文挑战」的第 6 天,点击查看活动详情

基础组件安装

controller01 compute01 compute02同步安装

yum install python-openstackclient
yum install openstack-selinux
  • 确保安装2者正确

image.png

image.png

安装数据库

只在controller01安装

yum install mariadb mariadb-server python2-PyMySQL

确保安装正确

image.png

创建/etc/my.cnf.d/openstack.cnf

vi openstack.cnf

添加如下信息:

#为控制节点的管理网络IP地址以使得其它节点可以通过管理网络访问数据库
[mysqld]
bind-address = 10.8.4.38
default-storage-engine = innodb
innodb_file_per_table = on
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8
  • 启动服务
systemctl enable mariadb.service
systemctl start mariadb.service

确保服务正常

image.png

  • 运行mysql_secure_installation脚本,并设置root密码
mysql_secure_installation
[root@controller01 my.cnf.d]# 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   # 设置root密码
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] y   # 禁止远程登录
 ... Success!

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   # 删除test数据库
 - 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 you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

优化参数

vim /etc/security/limits.conf

* soft nofile 65536
* hard nofile 65536
# ulimit -SHn 65536

vim /etc/sysctl.conf

# max open files
fs.file-max = 65536
# sysctl -p

重启 mariadb

systemctl restart mariadb
  • 确保无报错

image.png

安装MQ 消息服务 只在控制节点

yum install rabbitmq-server

确保服务正确安装

image.png

启动服务并设置开机启动

systemctl enable rabbitmq-server.service
systemctl start rabbitmq-server.service
  • 确保服务正常无报错

image.png

添加openstack用户

# rabbitmqctl add_user 【用户名】【密码】
rabbitmqctl add_user openstack xxxx
  • 确保用户正确创建

image.png

为openstack 用户设置读写权限

rabbitmqctl set_permissions openstack ".*" ".*" ".*"
  • 确保权限创建正确无报错

image.png

安装memcache

yum install memcached python-memcached -y
systemctl enable memcached.service
systemctl start memcached.service
  • 确保服务正确安装

image.png

  • 确保服务正确启动

image.png