实验环境准备
网络规划及基础环境准备
初始化基础环境
配置网络
所有节点】:配置管理网卡IP(例如:eth0)
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
-----------------------------------------
TYPE=Ethernet
BOOTPROTO=static
NAME=eth0
DEVICE=eth0
ONBOOT=yes
IPADDR=10.10.36.x
NETMASK=255.255.255.0
GATEWAY=10.10.36.254
-----------------------------------------
注意:修改成每台节点自己具体的IP
【控制/网络节点】:配置外部网卡IP(例如:eth1)
# vi /etc/sysconfig/network-scripts/ifcfg-eth1
-----------------------------------------
TYPE=Ethernet
BOOTPROTO=none
NAME=eth1
DEVICE=eth1
ONBOOT=yes
-----------------------------------------注意:此配置适用于外部网络模式为VLAN
【控制/网络节点、计算节点】:配置VM业务网卡IP(例如:eth2)
如果VM租住网络采用VLAN模式,则配置如下:
# vi /etc/sysconfig/network-scripts/ifcfg-eth2
-----------------------------------------
TYPE=Ethernet
BOOTPROTO=none
NAME=eth2
DEVICE=eth2
ONBOOT=yes
-----------------------------------------
如果VM租住网络采用VxLAN模式,则需要配置隧道网络,配置如下:
# vi /etc/sysconfig/network-scripts/ifcfg-eth2
-----------------------------------------
TYPE=Ethernet
BOOTPROTO=static
NAME=eth2
DEVICE=eth2
ONBOOT=yes
IPADDR=10.10.38.x
NETMASK=255.255.255.0
-----------------------------------------
【所有节点】:配置存储公共网卡IP(例如:eth3)
# vi /etc/sysconfig/network-scripts/ifcfg-eth3
-----------------------------------------
TYPE=Ethernet
BOOTPROTO=static
NAME=eth3
DEVICE=eth3
ONBOOT=yes
IPADDR=20.20.36.x
NETMASK=255.255.255.0
-----------------------------------------
【所有节点】:修改DNS解析,如果能上网或者存在内部DNS的前提下:
# vi /etc/resolv.conf
-----------------------------------------
# Generated by NetworkManager
nameserver 114.114.114.114
-----------------------------------------
【所有节点】:重启网络服务
#systemctl restart network
修改【所有节点】的主机名
根据第一节的基础环境规划,配置各个节点的主机名,命令如下(控制节点上):
# hostnamectl set-hostname swanstack-ctl
修改【所有节点】主机的/etc/hosts文件,追加以下解析
10.10.36.81 swanstack-ctl
10.10.36.82 swanstack-nc01
10.10.36.83 swanstack-nc02
20.20.36.84 swanstack-blk01
关闭禁用【所有节点】SELINUX,编辑配置文件
# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
或者:
# vi /etc/selinux/config
修改:SELINUX=disabled
执行临时关闭命令或者重启机器。
# setenforce 0
关闭停止【所有节点】相关服务
# systemctl stop firewalld && systemctl disable firewalld
# systemctl stop NetworkManager && systemctl disable NetworkManager
更新【所有节点】源文件,包括
更新centos基础repo配置:
# mkdir /etc/yum.repos.d/bak
# mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak
# 此处采用阿里云的镜像源
# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo 或者 # curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
# sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
更新centos基础epel配置:
# 此处采用阿里云的镜像源
# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
在【控制、计算节点】上编辑centos-openstack-stein.repo源
# vi /etc/yum.repos.d/centos-openstack-stein.repo
[centos-7-openstack-stein-x86_64]
name=centos-7-x86_64-openstack-stein
enabled=1
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/cloud/x86_64/openstack-stein
gpgcheck=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
# yum clean all && yum makecache
【所有节点】:安装常用工具
# yum install -y net-tools bash-completion vim yum-utils wget
【所有节点】:ssh互信认证
# 提前做好互信文件的KEY包,例如Tic.tar
# tar xvf /opt/openstack-rocky/Tic.tar -C /root/
# chown root:root -R /root/.ssh
# sed -i "s/# StrictHostKeyChecking ask/StrictHostKeyChecking no/g" /etc/ssh/ssh_config
# systemctl restart sshd.service
【所有节点】:优化系统参数
# vi /etc/systemd/system.conf #在末尾增加以下内容:
# echo "DefaultLimitNOFILE=1024000" >> /etc/systemd/system.conf
# echo "DefaultLimitNPROC=1024000" >> /etc/systemd/system.conf
----------------
DefaultLimitNOFILE=1024000 #这里需要修改
DefaultLimitNPROC=1024000 #这里也需要修改
----------------
【所有节点】:重启服务器
# init 6
# ulimit -a #完成后可以使用此命令检查
环境部署
初始openstack安装环境
【控制/网络、计算节点】:安装openstack工具包
在openstack节点安装以下包(非ceph节点)
openstack节点安装
# yum install -y libselinux-python python-openstackclient openstack-selinux MySQL-python
说明:如果节点又做compute节点,又做ceph节点,则在最后完成部署后安装以下工具包
# yum install -y openstack-utils
【所有节点】:安装chronyd 服务
# yum install -y chrony
修改配置文件vim /etc/chrony.conf 中的时钟同步服务器
# vim /etc/chrony.conf
server ntp2.aliyun.com iburst
# systemctl restart chronyd.service
# systemctl enable chronyd.service
# chronyc sources
【控制节点】:安装mariadb数据库服务
# yum install -y mariadb mariadb-server python2-PyMySQL
# vim /etc/my.cnf.d/openstack.cnf
-----------------------------------------
[mysqld]
bind-address = 10.10.36.81
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
# mysql_secure_installation
移除匿名等,允许连接等。
验证查看最大连接数是否生效:
1、查看最大连接数
show variables like '%max_connections%';
2、修改最大连接数
set GLOBAL max_connections = 4096;
【控制节点】:安装rabbitmq消息队列
# yum install -y rabbitmq-server
# systemctl enable rabbitmq-server.service
# systemctl start rabbitmq-server.service
# rabbitmqctl add_user openstack openstack
# rabbitmqctl set_permissions openstack ".*" ".*" ".*"
【控制节点】:安装memcached缓存服务
# yum install -y memcached python-memcached
配置/etc/sysconfig/memcached文件
# vim /etc/sysconfig/memcached
修改:OPTIONS="-l 127.0.0.1,::1,swanstack-ctl"
# systemctl enable memcached.service