CPU:双核双线程-CPU虚拟化开启
内存:8G 硬盘:300G+1024G(CEPH块存储)
双网卡:VM1-(局域网)192.168.100.11 NAT-192.168.226.150
操作系统:Centos 7.6(1810)-最小化安装
CPU:双核双线程-CPU虚拟化开启
内存:8G 硬盘:300G+1024G(CEPH块存储)
双网卡:VM1(局域网)-192.168.100.12 NAT-192.168.226.151
操作系统:Centos 7.6(1810)-最小化安装
CPU:双核双线程-CPU虚拟化开启
内存:8G 硬盘:300G+1024G(CEPH块存储)
双网卡:VM1(局域网)-192.168.100.13 NAT-192.168.226.152
操作系统:Centos 7.6(1810)-最小化安装
PS:最小内存6G
主机名 | 内存 | 硬盘 | 网卡 | 系统 |
---|---|---|---|---|
CT | 8 | 300+300 | VM:192.168.100.10 | Centos7.6 |
NAT:192.168.111.11 | ||||
C1 | 8 | 300+300 | VM:192.168.100.20 | Centos7.6 |
NAT:192.168.111.12 | ||||
C2 | 8 | 300+300 | VM:192.168.100.30 | Centos7.6 |
NAT:192.168.111.13 |
修改主机名
[root@server1 ~]# hostnamectl set-hostname ct
[root@server1 ~]# su
[root@server2 ~]# hostnamectl set-hostname c1
[root@server2 ~]# su
[root@server3 ~]# hostnamectl set-hostname c2
[root@server3 ~]# su
环境依赖包
[root@ct ~]# yum -y install net-tools bash-completion vim gcc gcc-c++ make pcre pcre-devel expat-devel cmake bzip2
[root@ct ~]# yum -y install centos-release-openstack-train python-openstackclient openstack-selinux openstack-utils
python-openstackclient #安装 OpenStack 客户端
openstack-selinux #RHEL和 CentOS 默认启用 SELinux 。安装 openstack-selinux 包实现对OpenStack服务的安全策略进行自动管理
设置网卡参数
vm1
[root@ct ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPADDR=192.168.100.10
NETMASK=255.255.255.0
NAME=ens33
DEVICE=ens33
ONBOOT=yes
net
[root@ct ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens37
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPADDR=192.168.111.11
NETMASK=255.255.255.0
GATEWAY=192.168.111.2
IPV4_ROUTE_METRIC=90
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens37
UUID=0c17a064-44b8-4ddd-99a1-4276fcff9dde
DEVICE=ens37
ONBOOT=yes
配置Hosts
[root@ct ~]# vi /etc/hosts
192.168.100.10 ct
192.168.100.20 c1
192.168.100.30 c2
[root@ct ~]# systemctl stop firewalld
[root@ct ~]# systemctl disable firewalld
[root@ct ~]# setenforce 0
[root@ct ~]# vim /etc/sysconfig/selinux
SELINUX=disabled
免交互
[root@ct ~]# ssh-keygen -t rsa #一直空格
[root@ct ~]# ssh-copy-id ct
[root@ct ~]# ssh-copy-id c1
[root@ct ~]# ssh-copy-id c2
配置DNS
[root@ct ~]# vi /etc/resolv.conf
# Generated by NetworkManager
nameserver 114.114.114.114
控制节点ct时间同步配置
[root@ct ~]# yum install chrony -y
[root@ct ~]# vim /etc/chrony.conf
#4-7行注释
#8行ct添加两行
server ntp6.aliyun.com iburst
allow 192.168.100.0/24
#8行另外两个节点上添加一行
server ct iburst
[root@ct ~]# systemctl enable chronyd
[root@ct ~]# systemctl restart chronyd
使用 chronyc sources 命令查询时间同步信息
[root@ct ~]# chronyc sources
210 Number of sources = 1
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* 203.107.6.88 2 6 377 57 -11ms[ -12ms] +/- 49ms
设置周期性任务
[root@ct ~]# crontab -e
*/30 * * * * /usr/bin/chronyc sources >> /var/log/chronyc.log
安装、配置MariaDB
[root@ct ~]# yum -y install mariadb mariadb-server python2-PyMySQL
[root@ct ~]# yum -y install libibverbs
添加MySQL子配置文件,增加如下内容
[root@ct ~]# vim /etc/my.cnf.d/openstack.cnf
[mysqld]
bind-address = 192.168.100.100 #控制节点局域网地址
default-storage-engine = innodb #默认存储引擎
innodb_file_per_table = on #每张表独立表空间文件
max_connections = 4096 #最大连接数
collation-server = utf8_general_ci #默认字符集
character-set-server = utf8
开机自启动、开启服务
[root@ct my.cnf.d]# systemctl enable mariadb
[root@ct my.cnf.d]# systemctl start mariadb
执行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
... skipping.
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y
安装RabbitMQ
所有创建虚拟机的指令,控制端都会发送到rabbitmq,node节点监听rabbitmq
[root@ct ~]# yum -y install rabbitmq-server
配置服务,启动RabbitMQ服务,并设置其开机启动
[root@ct ~]# systemctl enable rabbitmq-server.service
[root@ct ~]# systemctl start rabbitmq-server.service
创建消息队列用户,用于controler和node节点连接rabbitmq的认证
[root@ct ~]# rabbitmqctl add_user openstack RABBIT_PASS
Creating user "openstack"
配置openstack用户的操作权限(正则,配置读写权限)
[root@ct ~]# rabbitmqctl set_permissions openstack ".*" ".*" ".*"
Setting permissions for user "openstack" in vhost "/"
查看rabbitmq插件列表
[root@ct ~]# rabbitmq-plugins list
Configured: E = explicitly enabled; e = implicitly enabled
| Status: [failed to contact rabbit@ct - status not shown]
|/
[e ] amqp_client 3.6.16
[e ] cowboy 1.0.4
[e ] 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
[E ] rabbitmq_management 3.6.16
[e ] 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
[e ] 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
开启rabbitmq的web管理界面的插件,端口为15672
[root@ct ~]# rabbitmq-plugins enable rabbitmq_management
The following plugins have been enabled:
mochiweb
webmachine
rabbitmq_web_dispatch
amqp_client
rabbitmq_management_agent
rabbitmq_management
Applying plugin configuration to rabbit@likeadmin... started 6 plugins.
检查端口(25672 5672 15672)
[root@ct ~]# ss -anpt | grep 5672
LISTEN 0 128 *:25672 *:* users:(("beam.smp",pid=35087,fd=46))
LISTEN 0 128 *:15672 *:* users:(("beam.smp",pid=35087,fd=57))
LISTEN 0 128 :::5672 :::* users:(("beam.smp",pid=35087,fd=55))
网页访问http://192.168.111.11:15672,默认账户密码均为guest
安装memcached
安装memcached是用于存储session信息;服务身份验证机制使用Memcached来缓存令牌 在登录openstack的dashboard时,会产生一些session信息,这些session信息会存放到memcached中
[root@ct ~]# yum install -y memcached python-memcached
#python-*模块在OpenStack中起到连接数据库的作用
修改Memcached配置文件
[root@ct ~]# cat /etc/sysconfig/memcached
PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS="-l 127.0.0.1,::1,ct"
[root@ct ~]# systemctl enable memcached
[root@ct ~]# systemctl start memcached
[root@ct ~]# netstat -nautp | grep 11211
安装etcd
[root@ct ~]# yum -y install etcd
修改etcd配置文件
[root@ct ~]# cd /etc/etcd/
[root@ct etcd]# ls
etcd.conf
[root@ct etcd]# vim etcd.conf
ETCD_DATA_DIR="/var/lib/etcd/default.etcd" #数据目录位置
ETCD_LISTEN_PEER_URLS="http://192.168.100.10:2380" #监听其他etcd member的url(2380端口,集群之间通讯,域名为无效值)
ETCD_LISTEN_CLIENT_URLS="http://192.168.100.10:2379" #对外提供服务的地址(2379端口,集群内部的通讯端口)
ETCD_NAME="ct" #集群中节点标识(名称)
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://192.168.100.10:2380"
ETCD_ADVERTISE_CLIENT_URLS="http://192.168.100.10:2379
ETCD_INITIAL_CLUSTER="ct=http://192.168.100.10:2380" #该节点成员的URL地址,2380端口:用于集群之间通讯。
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster-01" #集群唯一标识
ETCD_INITIAL_CLUSTER_STATE="new" #初始集群状态,new为静态,若为existing,则表示此ETCD服务将尝试加入已有的集群
若为DNS,则表示此集群将作为被加入的对象
开机自启动、开启服务,检测端口
[root@ct ~]# systemctl enable etcd.service
[root@ct ~]# systemctl start etcd.service
[root@ct ~]# netstat -anutp |grep 2379
[root@ct ~]# netstat -anutp |grep 2380