一:项目拓扑
1.1:环境介绍
主机名 | 内存 | 硬盘 | 网卡 | 系统 |
---|---|---|---|---|
ct | 8G | 300G+300G | VM1:192.168.100.110 NAT:192.168.158.110 |
Centos-7.6 |
c1 | 8G | 300G+300G | VM1:192.168.100.120 NAT:192.168.158.120 |
Centos-7.6 |
c2 | 8G | 300G+300G | VM1:192.168.100.130 NAT:192.168.158.130 |
Centos-7.6 |
yum -y install net-tools bash-completion vim gcc gcc-c++ make pcre pcre-devel expat-devel cmake bzip2
yum -y install centos-release-openstack-train python-openstackclient openstack-selinux openstack-utils
yum -y install centos-release-openstack-train #openstack的train版本仓库源安装包
yum -y install python-openstackclient #openstack客户端
yum -y install openstack-selinux #openstack核心防护
yum -y install openstack-utils #openstack管理工具
- 若安装不上,下载阿里源
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum clean all
yum list
- 三台节点做免密登录
[root@ct ~]# ssh-keygen -t rsa
[root@ct ~]# ssh-copy-id ct
[root@ct ~]# ssh-copy-id c1
[root@ct ~]# ssh-copy-id c2
- 时间同步
#主机ct
[root@ct ~]# yum install chrony -y
[root@ct ~]# vim /etc/chrony.conf
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#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 ntp6.aliyun.com iburst #添加阿里云时间同步
allow 192.168.100.0/24 #允许100网段同步自己的时间
[root@ct ~]# systemctl enable chronyd
[root@ct ~]# systemctl restart chronyd
#主机c1,c2
[root@c1 ~]# yum install chrony -y
[root@c1 ~]# vi /etc/chrony.conf
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#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 ct iburst #同步主机ct
[root@c1 ~]# systemctl enable chronyd
[root@c1 ~]# systemctl restart chronyd
#使用 chronyc sources 命令查询时间同步信息
[root@ct ~]# chronyc sources
210 Number of sources = 1
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* 203.107.6.88 2 6 77 49 +57us[+1658us] +/- 21ms
#设置周期性任务
[root@ct ~]# crontab -e
*/30 * * * * /usr/bin/chronyc sources >> /var/log/chronyc.log #每半小时执行一次时间同步的日志记录
二:系统环境配置
2.1:安装、配置MariaDB
[root@ct ~]# yum -y install mariadb mariadb-server python2-PyMySQL
#此包用于openstack的控制端连接mysql所需要的模块,如果不安装,则无法连接数据库;此包只安装在控制端
[root@ct ~]# yum -y install libibverbs
- 添加MySQL子配置文件,增加如下内容
[root@ct ~]# vim /etc/my.cnf.d/openstack.cnf
[mysqld]
bind-address = 192.168.100.110 #控制节点局域网地址
default-storage-engine = innodb #默认存储引擎
innodb_file_per_table = on #每张表独立表空间文件
max_connections = 4096 #最大连接数
collation-server = utf8_general_ci #默认字符集
character-set-server = utf8
[root@ct my.cnf.d]# systemctl enable mariadb
[root@ct my.cnf.d]# systemctl start mariadb
- 执行MariaDB 安全配置脚本
[root@ct my.cnf.d]# mysql_secure_installation
Enter current password for root (enter for none): #回车
OK, successfully used password, moving on...
Set root password? [Y/n] Y
Remove anonymous users? [Y/n] Y
... Success!
Disallow root login remotely? [Y/n] N
... skipping.
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y
2.2:安装RabbitMQ
- 所有创建虚拟机的指令,控制端都会发送到rabbitmq,node节点监听rabbitmq
[root@ct ~]# yum -y install rabbitmq-server
#配置服务,启动RabbitMQ服务,并设置其开机启动。
[root@ct ~]# systemctl enable rabbitmq-server.service
[root@ct ~]# systemctl start rabbitmq-server.service
- 创建消息队列用户,用于controler和node节点连接rabbitmq的认证
[root@ct ~]# rabbitmqctl add_user openstack RABBIT_PASS
Creating user "openstack"
- 配置openstack用户的操作权限(正则,配置读写权限)
[root@ct ~]# rabbitmqctl set_permissions openstack ".*" ".*" ".*"
Setting permissions for user "openstack" in vhost "/"
可查看25672和5672 两个端口(5672是Rabbitmq默认端口,25672是Rabbit的测试工具CLI的端口)
- 查看rabbitmq插件列表
[root@ct ~]# rabbitmq-plugins list
- 开启rabbitmq的web管理界面的插件,端口为15672
[root@ct ~]# rabbitmq-plugins list
- 开启rabbitmq的web管理界面的插件,端口为15672
[root@ct ~]# rabbitmq-plugins enable rabbitmq_management
- 检查端口(25672 5672 15672)
[root@localhost ~]# ss -natp | grep 5672
LISTEN 0 128 *:25672 *:* users:(("beam.smp",pid=31356,fd=46))
LISTEN 0 128 *:15672 *:* users:(("beam.smp",pid=31356,fd=57))
LISTEN 0 128 :::5672 ::