openstack-T版部署之环境部署!

Posted 龙少。

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了openstack-T版部署之环境部署!相关的知识,希望对你有一定的参考价值。

openstack-T版环境部署

一.实验准备

1.虚拟机资源准备

(1)控制节点ct
CPU:双核双线程-CPU虚拟化开启
内存:8G
硬盘:300G
双网卡:VM1-(局域网)192.168.100.11 NAT-192.168.206.11
操作系统:Centos 7.6(1810)-最小化安装

(2)计算节点c1
CPU:双核双线程-CPU虚拟化开启
内存:8G
硬盘:300G
双网卡:VM1(局域网)-192.168.100.22 NAT-192.168.206.22
操作系统:Centos 7.6(1810)-最小化安装

(3)计算节点c2
CPU:双核双线程-CPU虚拟化开启
内存:8G
硬盘:300G
双网卡:VM1(局域网)-192.168.100.33 NAT-192.168.206.33
操作系统:Centos 7.6(1810)-最小化安装

2.基础环境配置

(1)修改主机名

3个节点

[root@localhost ~]# hostnamectl set-hostname ct
[root@ct ~]# su

[root@localhost ~]# hostnamectl set-hostname c1
[root@c1 ~]# su

[root@localhost ~]# hostnamectl set-hostname c2
[root@c2 ~]# su

(2)关闭防火墙、核心防护

3个节点

[root@ct ~]# systemctl stop firewalld
[root@ct ~]# systemctl disable firewalld
[root@ct ~]# setenforce 0

(3)设置网卡,每个节点添加网卡

说明:
每个节点双网卡,分别选择nat和vmnet1

IPV4_ROUTE_METRIC=90 #调优先级,设置NAT网卡优先

①ct控制节点

配置ens33网卡

配置ens37网卡

重启network,ifconfig查看网卡信息

② c1计算节点

配置ens33网卡

配置ens37网卡

重启network,ifconfig查看网卡信息

③ c2计算节点

配置ens33网卡

配置ens37网卡

重启network,ifconfig查看网卡信息

(4)配置主机映射,配置局域网ip

3个节点

[root@ct ~]# vi /etc/hosts

192.168.100.11  ct
192.168.100.22  c1
192.168.100.33  c2

(5)设置免交互

3个节点

[root@ct ~]#  ssh-keygen -t rsa	
[root@ct ~]#  ssh-copy-id ct
[root@ct ~]#  ssh-copy-id c1
[root@ct ~]#  ssh-copy-id c2

(6)安装基础环境依赖包

3个节点均安装

yum -y install net-tools bash-completion vim gcc gcc-c++ make pcre  pcre-devel expat-devel cmake  bzip2 lrzsz 

EXPAT C语言发开库

#OpenStack 的 train 版本仓库源安装 包,同时安装 OpenStack 客户端和 openstack-selinux 安装包

yum -y install centos-release-openstack-train python-openstackclient openstack-selinux openstack-utils

(7)设置时间同步、周期性计划

ct ->同步阿里云时钟服务器

c1、c2 -> 同步ct

① ct节点

[root@ct ~]# yum install chrony -y
[root@ct ~]# 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.100.0/24							#允许192.168.100.0/24网段的主机来同步时钟服务

② c1和c2节点

[root@c1 ~]# yum install chrony -y
[root@c1 ~]# vi /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配置服务)

1.安装、配置MariaDB

(1)安装

[root@ct ~]# yum -y install mariadb mariadb-server python2-Pymysql
#此包用于openstack的控制端连接mysql所需要的模块,如果不安装,则无法连接数据库;此包只安装在控制端
[root@ct ~]# yum -y install libibverbs	

(2)添加MySQL子配置文件,增加如下内容

[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

(3)开机自启动、开启服务

[root@ct my.cnf.d]# systemctl enable mariadb
[root@ct my.cnf.d]# systemctl start mariadb

(4)执行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						#是否不允许root用户远程登陆
 ... skipping.
Remove test database and access to it? [Y/n] Y 				#是否删除test测试库
Reload privilege tables now? [Y/n] Y

2.安装RabbitMQ

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

(1)下载安装RabbitMQ服务

[root@ct ~]# yum -y install rabbitmq-server

(2)配置服务,启动RabbitMQ服务,并设置其开机启动

[root@ct ~]# systemctl enable rabbitmq-server.service
[root@ct ~]# systemctl start rabbitmq-server.service

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

[root@ct ~]# rabbitmqctl add_user openstack RABBIT_PASS
Creating user "openstack"

(4)配置openstack用户的操作权限(正则,配置读写权限)

[root@ct ~]# rabbitmqctl set_permissions openstack ".*" ".*" ".*"
Setting permissions for user "openstack" in vhost "/"

#可查看25672和5672 两个端口(5672是Rabbitmq默认端口,25672是Rabbit的测试工具CLI的端口)

(5)查看rabbitmq插件列表

[root@ct ~]# rabbitmq-plugins list
 Configured: E = explicitly enabled; e = implicitly enabled
 | Status:   * = running on rabbit@localhost
 |/
[  ] amqp_client                       3.6.16
[  ] cowboy                            1.0.4
[  ] 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
[  ] rabbitmq_management               3.6.16
[  ] 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
[  ] 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

(6)开启rabbitmq的web管理界面的插件,端口为15672

[root@ct ~]# rabbitmq-plugins enable
Error: Not enough arguments for 'enable'
[root@ct ~]# rabbitmq-plugins enable rabbitmq_management
The following plugins have been enabled:
  amqp_client
  cowlib
  cowboy
  rabbitmq_web_dispatch
  rabbitmq_management_agent
  rabbitmq_management

Applying plugin configuration to rabbit@localhost... started 6 plugins.

[root@ct ~]# ss -natp | grep 5672
LISTEN     0      128          *:25672                    *:*                   users:(("beam.smp",pid=21123,fd=46))
LISTEN     0      128          *:15672                    *:*                   users:(("beam.smp",pid=21123,fd=57))
TIME-WAIT  0      0      127.0.0.1:52091              127.0.0.1:25672              
LISTEN     0      128         :::5672                    :::*                   users:(("beam.smp",pid=21123,fd=55))

(7)访问网页

浏览器访问192.168.206.11:15672

用户名密码guest登录

3.安装memcached

memcached作用

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

(1)安装

[root@ct ~]# yum install -y memcached python-memcached

(2)修改Memcached配置文件

[root@ct ~]# vim /etc/sysconfig/memcached 
PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS="-l 127.0.0.1,::1,ct"

(3)设置开机自启,重启服务,查看端口

[root@ct ~]# systemctl enable memcached
Created symlink from /etc/systemd/system/multi-user.target.wants/memcached.service to /usr/lib/systemd/system/memcached.service.
[root@ct ~]# systemctl start memcached
[root@ct ~]# netstat -nautp | grep 11211
tcp        0      0 192.168.100.11:11211    0.0.0.0:*               LISTEN      23935/memcached     
tcp        0      0 127.0.0.1:11211         0.0.0.0:*               LISTEN      23935/memcached     
tcp6       0      0 ::1:11211               :::*                    LISTEN      23935/memcached    

4.安装etcd

(1)下载安装etcd

[root@ct ~]# yum -y install etcd

(2)修改etcd配置文件

[root@ct ~]# cd /etc/etcd/
[root@ct etcd]# ls
etcd.conf
[root@ct etcd]# vim etcd.conf 

(3)开机自启动、开启服务,检测端口

[root@ct etcd]# 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 etcd]# systemctl start etcd.service
[root@ct etcd]# netstat -anutp |grep 2379
tcp        0      0 192.168.100.11:2379     0.0.0.0:*               LISTEN      25010/etcd          
tcp        0      0 192.168.100.11:2379     192.168.100.11:48718    ESTABLISHED 25010/etcd          
tcp        0      0 192.168.100.11:48718    192.168.100.11:2379     ESTABLISHED 25010/etcd          
[root@ct etcd]# netstat -anutp |grep 2380
tcp        0      0 192.168.100.11:2380     0.0.0.0:*               LISTEN      25010/etcd          
[root@ct etcd]# 

以上是关于openstack-T版部署之环境部署!的主要内容,如果未能解决你的问题,请参考以下文章

攻防环境之win2003weblogic部署 无脑图文版

Openstack 安装部署指南翻译系列 之 环境配置

layuiAdmin之iframe版部署到ThinkPHP6.0中

微服务链路之测试环境快速部署

openstack部署之创建第一个实例

安装RabbitMQ,创建消息队列用户时报错怎么办???