OpenStack manual deployment practice-----environment deployment

OpenStack manual deployment practice---environment deployment

One, OpenStack environment configuration

Virtual machine resource information
1. Control node ct
CPU: dual-core dual-thread ----CPU virtualization enabled
Memory: 8G
hard disk: 300G+1024G (CEPH block storage)
dual network card: VM1- (local area network) 192.168.100.10 NAT-192.168. 246.90
operating system: Centos 7.6 (1810)-minimal installation

2. Computing node c1
CPU: dual-core dual-thread-CPU virtualization enabled
Memory: 8G Hard disk: 300G+1024G (CEPH block storage)
dual network card: VM1 (local area network)-192.168.100.20 NAT-192.168.246.100
Operating system: Centos 7.6 ( 1810)-Minimal installation

3. Compute node c2
CPU: dual-core dual-thread-CPU virtualization enabled
Memory: 8G Hard disk: 300G+1024G (CEPH block storage)
dual network card: VM1 (local area network)-192.168.100.20 NAT-192.168.246.110
Operating system: Centos 7.6 ( 1810) -Minimum installation
PS: minimum memory 6G

Two, deployment ideas

1. Configure the operating system + OpenStack operating environment

2. Configure OpenStack platform basic services (rabbitmq, mariadb, memcache, Apache)

3. Configure the OpenStack keystone component

4. Configure OpenStack Glance components

5. Configure placement service

6. Configure OpenStack Nova components

7. Configure OpenStack Neutron components

8. Configure the OpenStack dashboard component

9. Configure OpenStack Cinder components

10. Common cloud host operations

Three, basic environment configuration

1. Modify and add NAT network card configuration (all nodes)

BOOTPROTO=static			#修改网卡配置参数,修改为静态IP
ONBOOT=yes					#开启设备开机启动

IPADDR=192.168.246.90  		#添加字段,静态模式IP自定义
NETMASK=255.255.255.0		#添加字段,设置网段
GATEWAY=192.168.246.2		#添加字段,设置网关
DNS1=192.168.246.2			#添加字段,设置DNS服务器

2. Turn off the firewall and system security mechanism, modify the host name

Host name ip mapping, node-free interactive login, time synchronization

控制节点ct(192.168.246.90
systemctl stop firewalld
setenforce 0
hostnamectl set-hostname ct
su -



计算节点c1(192.168.246.100
systemctl stop firewalld
setenforce 0
hostnamectl set-hostname c1
su -


计算节点c2(192.168.246.110
systemctl stop firewalld
setenforce 0
hostnamectl set-hostname c2
su -

3. Install the basic environment dependency package (repeat the installation at least three times to ensure that each component is up to date, otherwise an error will be reported)

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命令上传、下载数据
yum -y install centos-release-openstack-train python-openstackclient openstack-selinux openstack-utils
OpenStack 的 train 版本仓库源安装 包,同时安装 OpenStack 客户端和 openstack-selinux 安装包

4. VMnet1 network card configuration parameters (configured on all nodes)

1、查看VMnet1网卡名称
ifconfig  	  

例:ens37: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

2、修改VMnet1网卡配置
cd /etc/sysconfig/network-scripts/
cp ifcfg-ens33 ifcfg-ens37
vim ifcfg-ens37

#UUID=d76d9e83-4413-488f-a41c-acf8f453332b 		#注释uuid,设备id不能重复	
NAME=ens37										#修改名称
DEVICE=ens37									#修改设备名
IPADDR=192.168.10.30							#设置VMnet1网段的IP,自定义
NETMASK=255.255.255.0							#设置掩码

systemctl restart network		#重启网卡


5. Configure the host mapping file (all nodes)

将VMnet1IP与主机名注入到主机映射文件中,用于区分主机,便于相互访问
echo '192.168.10.10 ct' >> /etc/hosts
echo '192.168.10.20 c1' >> /etc/hosts
echo '192.168.10.30 c2' >> /etc/hosts

6. Three nodes do no interaction

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, configure control node time synchronization

所有节点
echo 'nameserver 114.114.144.144' >> /etc/resolv.conf


控制节点ct(192.168.246.90
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.10.0/24				#允许192.168.100.0/24网段的主机来同步时钟服务
		
#使用chronyc sources命令查询时间同步信息

systemctl enable chronyd
systemctl restart chronyd
chronyc sources

8. Configure time synchronization of computing nodes

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 



所有节点,配置计划性任务,每隔两分钟时间同步一次
crontab -e		
*/2 * * * * /usr/bin/chronyc sources >>/var/log/chronyc.log

crontab -l

Four, system environment configuration

1. Install and configure MariaDB

控制节点ct(192.168.246.90
yum -y install mariadb mariadb-server python2-PyMySQL

mariadb:是mysql的一个分支,是一款完全兼容mysql的开源软件
mariadb-server:数据库服务
python2-PyMySQL:用于openstack的控制端连接mysql所需要的模块,如果不安装,则无法连接数据库;此包只安装在控制端



yum -y install libibverbs
libibverbs:远程直接内存访问

2. Add MySQL sub-configuration file and add the following content

vim /etc/my.cnf.d/openstack.cnf

[mysqld]
bind-address = 192.168.10.10
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.10.10 #控制节点局域网地址
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

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

所有创建虚拟机的指令,控制端都会发送到rabbitmq,node节点监听rabbitmq
yum -y install rabbitmq-server

===配置服务,启动RabbitMQ服务,并设置其开机启动===
systemctl enable rabbitmq-server.service
systemctl start rabbitmq-server.service

===创建消息队列用户,用于controler和 计算节点连接rabbitmq的认证(关联)===
rabbitmqctl add_user openstack RABBIT_PASS

===配置openstack用户的操作权限(正则,配置读写权限)===
rabbitmqctl set_permissions openstack ".*" ".*" ".*"

查看rabbitmq插件列表
rabbitmq-plugins list

开启rabbitmq的web管理界面的插件,端口为15672
rabbitmq-plugins enable 

此时可查看256725672 两个端口(5672是Rabbitmq默认端口,25672是Rabbit的测试工具CLI的端口)
netstat -natp | grep 25672
netstat -natp | grep 5672

此时可访问192.168.246.90:15672
默认账号和密码都是guest

5. Install memcached

是一个缓存数据库,安装memcached是用于存储session信息;服务身份验证机制(keystone)使用Memcached来缓存令牌 在登录openstack的dashboard时,会产生一些session信息,这些session信息会存放到memcached中


yum install -y memcached python-memcached
#python-*模块在OpenStack中起到连接数据库的作用

①, modify the memcached configuration file

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是一个分布式可靠的键值存储系统,数据库

yum -y install etcd

①, modify etcd configuration file

cd /etc/etcd/
vim etcd.conf 
删除所有内容,复制粘贴以下内容并进行修改

ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_PEER_URLS="http://192.168.10.10:2380"
ETCD_LISTEN_CLIENT_URLS="http://192.168.10.10:2379"	
ETCD_NAME="ct"	
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://192.168.10.10:2380"
ETCD_ADVERTISE_CLIENT_URLS="http://192.168.10.10:2379"
ETCD_INITIAL_CLUSTER="ct=http://192.168.10.10: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.10.10:2380” #监听其他etcd member的url(2380端口,集群之间通讯,
域名为无效值)
ETCD_LISTEN_CLIENT_URLS=“http://192.168.10.10:2379” #对外提供服务的地址(2379端口,集群内部的通讯端
口)
ETCD_NAME=“ct” #集群中节点标识(名称)
ETCD_INITIAL_ADVERTISE_PEER_URLS=“http://192.168.10.10:2380” #该节点成员的URL地址,2380端口:用于集
群之间通讯。
ETCD_ADVERTISE_CLIENT_URLS=“http://192.168.10.10:2379”
ETCD_INITIAL_CLUSTER=“ct=http://192.168.10.10:2380”
ETCD_INITIAL_CLUSTER_TOKEN=“etcd-cluster-01” #集群初始化令牌
ETCD_INITIAL_CLUSTER_STATE=“new” #初始集群状态,new为静态,若为existing,则表示此ETCD服务将尝试加入
已有的集群
若为DNS,则表示此集群将作为被加入的对象

②, boot automatically, start service, detect port

systemctl enable etcd.service
systemctl start etcd.service
netstat -anutp |grep 2379
netstat -anutp |grep 2380

Guess you like

Origin blog.csdn.net/weixin_51431591/article/details/114634092