tx

薯鼠

愿世界安康,愿你我皆好!
openstack平台部署(三) openstack平台部署(三)

openstack平台部署(二)

根据openstack(前期准备)和openstack(一)两个章节的配置,完成了部署openstack所需的基础配置。

一、OpenStack搭建任务

在控制节点和计算节点上分别安装iaas-xiandian软件包,根据表2配置两个节点脚本文件中的基本变量(配置脚本文件为/etc/xiandian/openrc.sh)。

表2 云平台配置信息

服务名称变量参数/密码
Mysqlroot000000
Keystone000000
Glance000000
Nova000000
Neutron000000
Heat000000
Zun000000
KeystoneDOMAIN_NAMEdemo
Admin000000
Rabbit000000
Glance000000
Nova000000
Neutron000000
Heat000000
Zun000000
NeutronMetadata000000
External Networkenp9s0(外网卡名)

1.1 安装iaas-xiandian服务,并修改xiandian服务的配置文件

1.1.1 安装iaas-xiandian服务(在两节点执行);

yum -y install iaas-xiandian
image-20220713000051130image-20220713000051130

1.1.2 修改xiandian服务的配置文件

vi /etc/xiandian/openrc.sh
 
# 进入配置文件后需要在命令行模式下敲
:%s/^#//g # 一行中只带有一个#注释的,作用去除#注释
:%s/PASS=/PASS=000000/g # 将PASS=全部替换成PASS=000000,这样省的我们自己手动敲很多代码了
#--------------------system Config--------------------##
#Controller Server Manager IP. example:x.x.x.x
HOST_IP=192.168.100.10 #controller节点的IP地址
 
#Controller HOST Password. example:000000
HOST_PASS=000000
 
#Controller Server hostname. example:controller
HOST_NAME=controller #controller节点的主机名
 
#Compute Node Manager IP. example:x.x.x.x
HOST_IP_NODE=192.168.100.20 #compute节点的IP地址
 
#Compute HOST Password. example:000000
HOST_PASS_NODE=000000
 
#Compute Node hostname. example:compute
HOST_NAME_NODE=compute #compute节点的主机名
 
#--------------------Chrony Config-------------------##
#Controller network segment IP.  example:x.x.0.0/16(x.x.x.0/24)
network_segment_IP=192.168.100.0/24 #控制节点的网段
 
#--------------------Rabbit Config ------------------##
#user for rabbit. example:openstack
RABBIT_USER=openstack #rabbit用户名
 
#Password for rabbit user .example:000000
RABBIT_PASS=000000
 
#--------------------MySQL Config---------------------##
#Password for MySQL root user . exmaple:000000
DB_PASS=000000
 
#--------------------Keystone Config------------------##
#Password for Keystore admin user. exmaple:000000
DOMAIN_NAME=demo #OpenStack中登录页面的认证域名
ADMIN_PASS=000000
DEMO_PASS=000000
 
#Password for Mysql keystore user. exmaple:000000
KEYSTONE_DBPASS=000000
 
#--------------------Glance Config--------------------##
#Password for Mysql glance user. exmaple:000000
GLANCE_DBPASS=000000
 
#Password for Keystore glance user. exmaple:000000
GLANCE_PASS=000000
 
#--------------------Nova Config----------------------##
#Password for Mysql nova user. exmaple:000000
NOVA_DBPASS=000000
 
#Password for Keystore nova user. exmaple:000000
NOVA_PASS=000000
 
#--------------------Neturon Config-------------------##
#Password for Mysql neutron user. exmaple:000000
NEUTRON_DBPASS=000000
 
#Password for Keystore neutron user. exmaple:000000
NEUTRON_PASS=000000
 
#metadata secret for neutron. exmaple:000000
METADATA_SECRET=000000
 
#Tunnel Network Interface. example:x.x.x.x
INTERFACE_IP=192.168.100.10 #隧道接口的IP地址,填当前节点的IP地址
 
#External Network Interface. example:eth1
INTERFACE_NAME=ens34 #第二块网卡作为外网,对外提供服务(云主机实例)的网卡名
 
#External Network The Physical Adapter. example:provider
Physical_NAME=provider #物理适配器的外网
 
#First Vlan ID in VLAN RANGE for VLAN Network. exmaple:101
minvlan=5 #VLAN最小从5开始(自己根据需要来给定)
 
#Last Vlan ID in VLAN RANGE for VLAN Network. example:200
maxvlan=201 #VLAN最大到201
 
#--------------------Cinder Config--------------------##
#Password for Mysql cinder user. exmaple:000000
CINDER_DBPASS=000000
 
#Password for Keystore cinder user. exmaple:000000
CINDER_PASS=000000
 
#Cinder Block Disk. example:md126p3
BLOCK_DISK=sdb #compute节点增加的第一快磁盘名称(lsblk查看)
 
#--------------------Swift Config---------------------##
#Password for Keystore swift user. exmaple:000000
SWIFT_PASS=000000
 
#The NODE Object Disk for Swift. example:md126p4.
OBJECT_DISK=sdc #compute节点的增加的第二快磁盘名称
 
#The NODE IP for Swift Storage Network. example:x.x.x.x.
STORAGE_LOCAL_NET_IP=192.168.100.20 #对象存储的IP地址
 
#--------------------Heat Config----------------------##
#Password for Mysql heat user. exmaple:000000
HEAT_DBPASS=000000
 
#Password for Keystore heat user. exmaple:000000
HEAT_PASS=000000
 
#--------------------Zun Config-----------------------##
#Password for Mysql Zun user. exmaple:000000
ZUN_DBPASS=000000
 
#Password for Keystore Zun user. exmaple:000000
ZUN_PASS=000000
 
#Password for Mysql Kuryr user. exmaple:000000
KURYR_DBPASS=000000
 
#Password for Keystore Kuryr user. exmaple:000000
KURYR_PASS=000000
 
#--------------------Ceilometer Config----------------##
#Password for Gnocchi ceilometer user. exmaple:000000
CEILOMETER_DBPASS=000000
 
#Password for Keystore ceilometer user. exmaple:000000
CEILOMETER_PASS=000000
 
#--------------------AODH Config----------------##
#Password for Mysql AODH user. exmaple:000000
AODH_DBPASS=000000
 
#Password for Keystore AODH user. exmaple:000000
AODH_PASS=000000
 
#--------------------Barbican Config----------------##
#Password for Mysql Barbican user. exmaple:000000
BARBICAN_DBPASS=000000
 
#Password for Keystore Barbican user. exmaple:000000
BARBICAN_PASS=000000
#--------------------system Config--------------------##
#Controller Server Manager IP. example:x.x.x.x
HOST_IP=192.168.100.10
 
#Controller HOST Password. example:000000
HOST_PASS=000000
 
#Controller Server hostname. example:controller
HOST_NAME=controller
 
#Compute Node Manager IP. example:x.x.x.x
HOST_IP_NODE=192.168.100.20
 
#Compute HOST Password. example:000000
HOST_PASS_NODE=000000
 
#Compute Node hostname. example:compute
HOST_NAME_NODE=compute
 
#--------------------Chrony Config-------------------##
#Controller network segment IP.  example:x.x.0.0/16(x.x.x.0/24)
network_segment_IP=192.168.100.0/24
 
#--------------------Rabbit Config ------------------##
#user for rabbit. example:openstack
RABBIT_USER=openstack
 
#Password for rabbit user .example:000000
RABBIT_PASS=000000
 
#--------------------MySQL Config---------------------##
#Password for MySQL root user . exmaple:000000
DB_PASS=000000
 
#--------------------Keystone Config------------------##
#Password for Keystore admin user. exmaple:000000
DOMAIN_NAME=demo
ADMIN_PASS=000000
DEMO_PASS=000000
 
#Password for Mysql keystore user. exmaple:000000
KEYSTONE_DBPASS=000000
 
#--------------------Glance Config--------------------##
#Password for Mysql glance user. exmaple:000000
GLANCE_DBPASS=000000
 
#Password for Keystore glance user. exmaple:000000
GLANCE_PASS=000000

需要修改的地方已在后面增加注释(有的地方还需输入六个零上面会有 example: 提示)

通过scp方法将修改过的xiandian配置文件传输到compute节点

scp /etc/xiandian/openrc.sh compute:/etc/xiandian/openrc.sh

在compute节点中将xiandian配置文件修改第69行的IP地址,改成对应节点的IP地址(在compute节点只需修改这一行)

image-20220713000448821image-20220713000448821

修改完成后保存退出。

二.通过脚本安装服务

2.1-2.3的基础配置操作命令已经编写成shell脚本,通过脚本进行一键安装。如下:

执行脚本iaas-pre-host.sh进行安装

#Controller节点
[root@controller ~]# iaas-pre-host.sh

#Compute节点
[root@compute ~]# iaas-pre-host.sh

安装完成后同时重启

#Controller节点
[root@controller ~]# reboot

#Compute节点
[root@compute ~]# reboot

2.1 安装Openstack包

#Controller节点
[root@controller ~]# yum -y install openstack-utils openstack-selinux python-openstackclient
[root@controller ~]# yum upgrade

#Compute节点
[root@compute ~]# yum -y install openstack-utils openstack-selinux python-openstackclient
[root@compute ~]# yum upgrade

2.2 配置域名解析

2.2.1 修改/etc/hosts添加一下内容。

#Controller节点
172.129.7.10 controller
172.129.7.20 compute

#Compute节点
172.129.7.10 controller
172.129.7.20 compute

2.3 安装chrony服务

2.3.1 安装chrony服务;

#Controller节点
[root@controller ~]# yum install -y chrony

#Compute节点
[root@compute ~]# yum install -y chrony

2.3.2 配置controller节点

image-20220713164240811image-20220713164240811

#Controller节点
[root@controller ~]# vi /etc/chrony.conf #编辑/etc/chrony.conf文件
#添加以下内容(删除默认sever规则,默认sever规则如上图)
server controller iburst
allow 192.168.100.0/24
#启动ntp服务器
[root@controller ~]# systemctl restart chronyd
[root@controller ~]# systemctl enable chronyd

#Compute节点
[root@compute ~]# vi /etc/chrony.conf #编辑/etc/chrony.conf文件
#添加以下内容(删除默认sever规则,默认sever规则如上图)
server controller iburst
#启动ntp服务器
[root@compute ~]# systemctl restart chronyd
[root@compute ~]# systemctl enable chronyd

三、通过脚本安装openstack相关服务

依次运行相关脚本,脚本运行时间看虚拟机配置。

3.1 数据库安装

在controller节点上使用iaas-install-mysql.sh 脚本安装Mariadb、Memcached、etcd服务。

#Controller节点
[root@controller ~]# iaas-install-mysql.sh

3.2 Keystone服务安装

在controller节点上使用iaas-install-keystone.sh 脚本安装Keystone服务。

#Controller节点
[root@controller ~]# iaas-install-keystone.sh 

3.3 Glance安装

在controller节点上使用iaas-install-glance.sh脚本安装glance 服务。

#Controller节点
[root@controller ~]# iaas-install-glance.sh

3.4 Nova安装

在controller节点和compute节点上分别使用iaas-install-nova -controller.sh脚本、iaas-install-nova-compute.sh脚本安装Nova 服务。

#Controller节点
[root@controller ~]# iaas-install-nova -controller.sh

#Compute节点
[root@compute ~]# iaas-install-nova-compute.sh

3.5 Neutron安装

在controller节点和compute节点上分别修改iaas-install-neutron-controller.sh脚本、iaas-install-neutron-compute.sh脚本分别安装 Neutron 服务。

#Controller节点
[root@controller ~]# iaas-install-neutron-controller.sh

#Compute节点
[root@compute ~]# iaas-install-neutron-compute.sh

3.6 Doshboard安装

在controller节点上使用iaas-install-dashboad.sh脚本安装dashboad服务。

#Controller节点
[root@controller ~]# iaas-install-dashboad.sh

3. 7 Cinder安装

在控制节点和计算节点上分别使用iaas-install-cinder-controller.sh脚本和iaas-install-cinder-compute.sh安装cinder服务。

#Controller节点
[root@controller ~]# iaas-install-cinder-controller.sh

#Compute节点
[root@compute ~]# iaas-install-cinder-compute.sh
0 条评论
user 编辑评论信息
插入图片

隐私评论