准备环境
这里使用的是CentOS 7.6版本,采用最小化安装
资源规划如下表:
主机名 | 网卡配置 | 内存 | 硬盘 |
---|---|---|---|
ct | ens37 192.168.100.10 、 ens33 20.0.0.6 | 8G | 300G |
c1 | ens37 192.168.100.11、ens33 20.0.0.7 | 8G | 300G |
c2 | ens37 192.168.100.12 、ens33 20.0.0.8 | 8G | 300G |
基础环境配置
ens33使用的是DHCP,ens37使用的是static
配置如下
#ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPVV4_ROUTE_METRIC=90 # 配置优先级
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
DEVICE=ens33
ONBOOT=yes
#ens37
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
IPADDR=192.168.100.10
NETMASK=255.255.255.0
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens37
DEVICE=ens37
ONBOOT=yes
基本优化
修改主机名
# ct
[root@localhost ~]# hostnamectl set-hostname ct
[root@ct ~]# su
# c1
[root@localhost ~]# hostnamectl set-hostname c1
[root@c1 ~]# su
# c2
[root@localhost ~]# hostnamectl set-hostname c2
[root@c2 ~]# su
关闭防火墙及核心防护
# systemctl stop firewalld
# setenforce 0
配置hosts
[root@ct ~]# vi /etc/hosts
192.168.100.10 ct
192.168.100.11 c1
192.168.100.12 c2
安装基础依赖包
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
配置时间同步并定时同步
[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 ntp1.aliyun.com iburst #同步阿里云时间,c1、c2指向ct
# Record the rate at which the system clock gains/losses time.
driftfile /var/lib/chrony/drift
# Allow the system clock to be stepped in the first three updates
# if its offset is larger than 1 second.
makestep 1.0 3
# Enable kernel synchronization of the real-time clock (RTC).
rtcsync
[root@ct ~]# systemctl enable chronyd
[root@ct ~]# systemctl restart chronyd
#查询时间同步信息
[root@ct ~]# chronyc sources
210 Number of sources = 1
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* 120.25.115.20 2 6 17 50 -9932ns[ -20us] +/- 15ms
# 定时同步
[root@ct ~]# crontab -e
*/2 * * * * /usr/bin/chronyc sources >> /var/log/chronyc.log
系统环境配置
安装配置MariaDB
[root@ct ~]# yum -y install mariadb mariadb-server python2-PyMySQL libibverbs
[root@ct ~]# vim /etc/my.cnf.d/openstack.cnf
[mysqld]
bind-address = 192.168.100.11 #控制节点局域网地址
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
安装RabbitMQ
[root@ct ~]# yum -y install rabbitmq-server
[root@ct ~]# systemctl enable rabbitmq-server.service
[root@ct ~]# systemctl start rabbitmq-server.service
[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 "/"
[root@ct ~]# rabbitmq-plugins list
Configured: E = explicitly enabled; e = implicitly enabled
| Status: [failed to contact rabbit@ct - status not shown]
|/
[e ] amqp_client 3.6.16
[e ] cowboy 1.0.4
[e ] cowlib 1.0.2
[ ] rabbitmq_amqp1_0 3.6.16
[ ] rabbitmq_auth_backend_ldap 3.6.16
[ ] rabbitmq_auth_mechanism_ssl 3.6.16
[ ] rabbitmq_consistent_hash_exchange 3.6.16
[ ] rabbitmq_event_exchange 3.6.16
[ ] rabbitmq_federation 3.6.16
[ ] rabbitmq_federation_management 3.6.16
[ ] rabbitmq_jms_topic_exchange 3.6.16
[E ] rabbitmq_management 3.6.16
[e ] rabbitmq_management_agent 3.6.16
[ ] rabbitmq_management_visualiser 3.6.16
[ ] rabbitmq_mqtt 3.6.16
[ ] rabbitmq_random_exchange 3.6.16
[ ] rabbitmq_recent_history_exchange 3.6.16
[ ] rabbitmq_sharding 3.6.16
[ ] rabbitmq_shovel 3.6.16
[ ] rabbitmq_shovel_management 3.6.16
[ ] rabbitmq_stomp 3.6.16
[ ] rabbitmq_top 3.6.16
[ ] rabbitmq_tracing 3.6.16
[ ] rabbitmq_trust_store 3.6.16
[e ] rabbitmq_web_dispatch 3.6.16
[ ] rabbitmq_web_mqtt 3.6.16
[ ] rabbitmq_web_mqtt_examples 3.6.16
[ ] rabbitmq_web_stomp 3.6.16
[ ] rabbitmq_web_stomp_examples 3.6.16
[ ] sockjs 0.3.4
#开启web插件 端口为15762
[root@ct ~]# rabbitmq-plugins enable rabbitmq_management
#检测 25672 5672 15672端口
[root@ct ~]# ss -natp | grep 5672
LISTEN 0 128 *:25672 *:* users:(("beam.smp",pid=28319,fd=46))
LISTEN 0 128 *:15672 *:* users:(("beam.smp",pid=28319,fd=57))
LISTEN 0 128 [::]:5672 [::]:* users:(("beam.smp",pid=28319,fd=55))
访问http://192.168.100.10:15672/,用户名和密码都是guest
安装memcached
在登录openstack的dashboard时,会产生一些session信息,安装memcached是用于存储session信息;服务身份验证机制使用Memcached来缓存令牌,这些session信息会存放在memcached中
# 安装memcached
[root@ct ~]# yum install -y memcached python-memcached
# 修改Memcached配置文件
[root@ct ~]# vi /etc/sysconfig/memcached
PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS="-l 127.0.0.1,::1,ct"
[root@ct ~]# systemctl enable memcached
[root@ct ~]# systemctl start memcached
[root@ct ~]# netstat -nautp | grep 11211
tcp 0 0 192.168.100.10:11211 0.0.0.0:* LISTEN 71451/memcached
tcp 0 0 127.0.0.1:11211 0.0.0.0:* LISTEN 71451/memcached
tcp6 0 0 ::1:11211 :::* LISTEN 71451/memcached
安装etcd
[root@ct ~]# yum -y install etcd
# 修改etcd配置文件
[root@ct etcd]# vim /etc/etcd/etcd.conf
#[Member]
#ETCD_CORS=""
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
#ETCD_WAL_DIR=""
ETCD_LISTEN_PEER_URLS="http://192.168.100.10:2380"
ETCD_LISTEN_CLIENT_URLS="http://192.168.100.10:2379"
#ETCD_MAX_SNAPSHOTS="5"
#ETCD_MAX_WALS="5"
ETCD_NAME="ct"
#ETCD_SNAPSHOT_COUNT="100000"
#ETCD_HEARTBEAT_INTERVAL="100"
#ETCD_ELECTION_TIMEOUT="1000"
#ETCD_QUOTA_BACKEND_BYTES="0"
#ETCD_MAX_REQUEST_BYTES="1572864"
#ETCD_GRPC_KEEPALIVE_MIN_TIME="5s"
#ETCD_GRPC_KEEPALIVE_INTERVAL="2h0m0s"
#ETCD_GRPC_KEEPALIVE_TIMEOUT="20s"
#
#[Clustering]
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://192.168.100.10:2380"
ETCD_ADVERTISE_CLIENT_URLS="http://192.168.100.10:2379"
#ETCD_DISCOVERY=""
#ETCD_DISCOVERY_FALLBACK="proxy"
#ETCD_DISCOVERY_PROXY=""
#ETCD_DISCOVERY_SRV=""
ETCD_INITIAL_CLUSTER="ct=http://192.168.100.10:2380"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster-1"
ETCD_INITIAL_CLUSTER_STATE="new"
#ETCD_STRICT_RECONFIG_CHECK="true"
#ETCD_ENABLE_V2="true"
# 设置开机自启 ,开启服务,检测2379 2380端口
[root@ct ~]# systemctl enable etcd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/etcd.service to /usr/lib/systemd/system/etcd.service.
[root@ct ~]# systemctl start etcd.service
[root@ct ~]# netstat -anutp |grep 2379
tcp 0 0 192.168.100.10:2379 0.0.0.0:* LISTEN 76860/etcd
tcp 0 0 192.168.100.10:2379 192.168.100.10:34808 ESTABLISHED 76860/etcd
tcp 0 0 192.168.100.10:34808 192.168.100.10:2379 ESTABLISHED 76860/etcd
[root@ct ~]# netstat -anutp |grep 2380
tcp 0 0 192.168.100.10:2380 0.0.0.0:* LISTEN 76860/etcd