table of Contents
- One, environment configuration
-
- 1. Modify and add NAT network card configuration
- 2. Turn off the firewall and system security mechanism, modify the host name
- 3. The basic environment depends on the package
- 4. Modify VMnet1 network card configuration
- 5. Configure the host mapping file
- 6. No interaction
- 7. Configure DNS
- 8. Time synchronization + periodic scheduled tasks
- Two, system environment configuration
One, environment configuration
Control node ct
CPU | Dual-core dual-thread-CPU virtualization enabled |
---|---|
RAM | 8G |
hard disk | 300G+1024G (CEPH block storage) |
Dual network card | VM1-(Local Area Network) 192.168.86.11/NAT-192.168.109.12 |
operating system | Centos 7.6 (1810)-Minimal installation |
Control node c1
CPU | Dual-core dual-thread-CPU virtualization enabled |
---|---|
RAM | 8G |
hard disk | 300G+1024G (CEPH block storage) |
Dual network card | VM1-(Local Area Network) 192.168.86.22 /NAT-192.168.109.22 |
operating system | Centos 7.6 (1810)-Minimal installation |
Control node c2
CPU | Dual-core dual-thread-CPU virtualization enabled |
---|---|
RAM | 8G |
hard disk | 300G+1024G (CEPH block storage) |
Dual network card | VM1-(Local Area Network) 192.168.86.33 /NAT-192.168.109.32 |
operating system | Centos 7.6 (1810)-Minimal installation |
Add dual network cards before
installation. Before installing centos7, press tab on the install interface and use the command: net.ifnames=0 biosdevname=0 to specify the network card type as eth0
1. Modify and add NAT network card configuration
ct\c1\c2
cd /etc/sysconfig/network-scripts
vi ifcfg-eth0
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
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=eth0
UUID=07de1bab-75ee-4d54-b81b-e8a6c8cfcc23
DEVICE=eth0
ONBOOT=yes
IPADDR=192.168.109.12 #添加字段,静态模式IP自定义
NETMASK=255.255.255.0 #添加字段,设置网段
GATEWAY=192.168.109.2 #添加字段,设置网关
DNS1=192.168.109.2 #添加字段,设置DNS服务器
IPV4_ROUTE_METRIC=90 #设置网卡优先级,默认100,越低优先级越高,防止出现两张网卡为了抢占优先级导致无法连接问题
systemcrl restart network
The three nodes have changed the NAT network card to connect to the terminal to facilitate subsequent operations
2. Turn off the firewall and system security mechanism, modify the host name
hostnamectl set-hostname ct #c1 c2
su
systemctl stop firewalld
systemctl disable firewalld
setenforce 0
ct
c1
c2
3. The basic environment depends on the package
ct\c1\c2
yum -y install \
net-tools \
bash-completion \
vim \
gcc gcc-c++ \
make \
pcre pcre-devel \
expat-devel \
cmake \
bzip2 \
lrzsz
#-----------------------模块解释------------------------
net-tools ifconfig命令行工具
bash-completion 辅助自动补全工具
vim vim工具
gcc gcc-c++ 编译环境
make 编译器
pcre pcre-devel 是一个Perl库,包括 perl 兼容的正则表达式库
expat-devel Expat库,Expat是一个面向流的xml解析器
cmake CMake是一个跨平台的编译工具,CMkae目前主要使用场景是作为make的上层工具,产生可移植的makefile文件
lrzsz 可使用rz、sz命令上传、下载数据
OpenStack train version warehouse source installation package, install OpenStack client and openstack-selinux installation package at the same time
yum -y install \
centos-release-openstack-train \
python-openstackclient \
openstack-selinux \
openstack-utils
#----------------模块解释------------------------------
centos-release-openstack-train train版本包
python-openstackclient 安装openstack客户端
openstack-selinux 安装selinux自动管理,这里selinux是关闭的
openstack-utils 方便后续直接可以通过命令行方式修改配置文件
4. Modify VMnet1 network card configuration
ct\c1\c2
cd /etc/sysconfig/network-scripts/
vim ifcfg-eth1
#修改
BOOTPROTO=static
ONBOOT=yes
#末行添加
IPADDR=192.168.86.11 #根据网段,设置VMnet1网段的IP,自定义
NETMASK=255.255.255.0 #设置掩码
systemctl restart network #重启网卡
ifconfig #再次查看,是否修改完成
5. Configure the host mapping file
ct\c1\c2
Inject VMnet1IP and the host name into the host mapping file to distinguish hosts and facilitate mutual access
echo '192.168.86.11 ct' >> /etc/hosts
echo '192.168.86.22 c1' >> /etc/hosts
echo '192.168.86.33 c2' >> /etc/hosts
6. No interaction
ct\c1\c2
Create an asymmetric key and upload the public key file
ssh-keygen -t rsa
ssh-copy-id ct
ssh-copy-id c1
ssh-copy-id c2
7. Configure DNS
ct\c1\c2
echo 'nameserver 114.114.114.114' >> /etc/resolv.conf
8. Time synchronization + periodic scheduled tasks
Time synchronization:
configure
ct through the control node ct time synchronization configuration ct -> synchronize Alibaba Cloud clock server
c1, c2 -> synchronize ct
ct
yum install chrony -y
vim /etc/chrony.conf
#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.86.0/24 #允许192.168.86.0/24网段的主机来同步时钟服务
#使用chronyc sources命令查询时间同步信息
systemctl enable chronyd
systemctl restart chronyd
chronyc sources
c1\c2
vim /etc/chrony.conf
#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
systemctl enable chronyd.service
systemctl restart chronyd.service
chronyc sources
ct
Periodic scheduled tasks:
#配置计划任务,每隔2分钟同步一次
crontab -e
*/2 * * * * /usr/bin/chronyc sources >>/var/log/chronyc.log
#查看设置的周期性任务
crontab -l
Two, system environment configuration
1. Install and configure MariaDB
ct
yum -y install mariadb mariadb-server python2-PyMySQL libibverbs
#---------模块解释---------------------------------
mariadb:是mysql的一个分支,是一款完全兼容mysql的开源软件
mariadb-server:数据库服务
python2-PyMySQL:用于openstack的控制端连接mysql所需要的模块,如果不安装,则无法连接数据库;此包只安装在控制端
libibverbs:远程直接内存访问
2. Add MySQL sub-configuration file and add the following content
ct
vim /etc/my.cnf.d/openstack.cnf
[mysqld]
bind-address = 192.168.86.11
default-storage-engine = innodb
innodb_file_per_table = on
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8
#---------配置解释---------------------------------------------
bind-address = 192.168.186。11 #控制节点局域网地址
default-storage-engine = innodb #默认存储引擎
innodb_file_per_table = on #每张表独立表空间文件
max_connections = 4096 #最大连接数
collation-server = utf8_general_ci #服务器校对时不区分大小写
character-set-server = utf8 #默认字符集
#---------------------------------------------------------------
#开机自启动、开启服务
systemctl enable mariadb
systemctl start mariadb
3. Execute MariaDB installation and configuration script
ct
mysql_secure_installation
Enter current password for root (enter for none): #输入当前root密码,回车
OK, successfully used password, moving on...
Set root password? [Y/n] Y #是否需要更改root密码,Y确认
Remove anonymous users? [Y/n] Y #是否移除其他用户,Y确认移除
... Success!
Disallow root login remotely? [Y/n] n #是否不允许root用户远程登陆,输入n,允许root用户远程登陆
... skipping.
Remove test database and access to it? [Y/n] Y #是否删除test测试库,Y确认删除
Reload privilege tables now? [Y/n] Y #是否刷新规则,Y确认刷新
4. Install RabbitMQ
ct
All instructions for creating a virtual machine will be sent from the control end to rabbitmq, and the node node will monitor rabbitmq
yum -y install rabbitmq-server
systemctl enable rabbitmq-server.service
systemctl start rabbitmq-server.service
#创建消息队列用户,用于controler和 计算节点连接rabbitmq的认证(关联)
rabbitmqctl add_user openstack RABBIT_PASS
#-----------输出内容-------------
Creating user "openstack"
#----------------------------------
#配置openstack用户的操作权限(正则,配置读写权限)
rabbitmqctl set_permissions openstack ".*" ".*" ".*"
#------------输出内容---------------------------------------
Setting permissions for user "openstack" in vhost "/"
#可查看25672和5672 两个端口(5672是Rabbitmq默认端口,25672是Rabbit的测试工具CLI的端口)
netstat -natp | grep 5672
#查看rabbitmq插件列表
rabbitmq-plugins list
#开启rabbitmq的web管理界面的插件,端口为15672
rabbitmq-plugins enable rabbitmq_management
netstat -natp | grep 5672
ss -natp | grep 5672
Accessible at 192.168.163.10:15672 The
default account password is guest
5. Install memcached
是一个缓存数据库,安装memcached是用于存储session信息;服务身份验证机制(keystone)使用Memcached来缓存令牌 在登录openstack的dashboard时,会产生一些session信息,这些session信息会存放到memcached中
ct
yum install -y memcached python-memcached
#python-*模块在OpenStack中起到连接数据库的作用
#修改Memcached配置文件
vim /etc/sysconfig/memcached
PORT="11211" #memcached端口11211
USER="memcached" #用户memcached
MAXCONN="1024" #最大连接数1024
CACHESIZE="64" #字符集大小64位
OPTIONS="-l 127.0.0.1,::1,ct" #监听地址,127.0.0.1:本地地址,::是ipv6地址,ct是本地VMnet1地址
systemctl enable memcached
systemctl start memcached
netstat -nautp | grep 11211
6. Install etcd
etcd is a distributed and reliable key-value storage system, database
ct
yum -y install etcd
vim /etc/etcd/etcd.conf
#删除所有内容,复制粘贴以下内容并进行修改
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_PEER_URLS="http://192.168.86.11:2380"
ETCD_LISTEN_CLIENT_URLS="http://192.168.86.11:2379"
ETCD_NAME="ct"
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://192.168.86.11:2380"
ETCD_ADVERTISE_CLIENT_URLS="http://192.168.86.11:2379"
ETCD_INITIAL_CLUSTER="ct=http://192.168.86.11:2380"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster-01"
ETCD_INITIAL_CLUSTER_STATE="new"
#-------------------配置解释---------------------------------------
ETCD_DATA_DIR="/var/lib/etcd/default.etcd" #数据目录位置
ETCD_LISTEN_PEER_URLS="http://192.168.86.11:2380" #监听其他etcd member的url(2380端口,集群之间通讯,域名为无效值)
ETCD_LISTEN_CLIENT_URLS="http://192.168.86.11:2379" #对外提供服务的地址(2379端口,集群内部的通讯端口)
ETCD_NAME="ct" #集群中节点标识(名称)
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://192.168.86.11:2380" #该节点成员的URL地址,2380端口:用于集群之间通讯。
ETCD_ADVERTISE_CLIENT_URLS="http://192.168.86.11:2379"
ETCD_INITIAL_CLUSTER="ct=http://192.168.86.11:2380"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster-01" #集群唯一标识
ETCD_INITIAL_CLUSTER_STATE="new" #初始集群状态,new为静态,若为existing,则表示此ETCD服务将尝试加入已有的集群若为DNS,则表示此集群将作为被加入的对象
#-----------------------------------------------------------------------
systemctl enable etcd.service
systemctl start etcd.service
netstat -anutp |grep 2379
netstat -anutp |grep 2380
The deployment environment must pay attention to whether the installed software is installed, and confirm the installation multiple times to avoid unnecessary trouble