本文章旨在记录自己安装过程,有关其他知识请移步官方网站,本实例鉴于初登OpenStack的人使用。
环境介绍本次用到两台服务器。
为方便使用需要初始化环境。yum源位置使用阿里云。
[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
[cloud]
name=CentOS-$releasever - cloud - mirrors.aliyun.com
baseurl=http://mirrors.aliyun.com/centos/$releasever/cloud/$basearch/openstack-rocky/
gpgcheck=0
enabled=1
[kvm]
name=CentOS-$releasever - kvm - mirrors.aliyun.com
baseurl=http://mirrors.aliyun.com/centos/$releasever/virt/$basearch/kvm-common/
gpgcheck=0
enabled=1
一、基础环境
#添加地址解析。
192.168.44.10 IP1 controller #控制节点
192.168.44.11 IP2 compute #计算节点
# 修改完成后执行重新执行以下命令
# yum clean all && yum repolist
# 客户端及其依赖环境
# yum install python-openstackclient -y
# yum install openstack-selinux -y
# yum -y install libibverbs
2、安装OpenStack应用组件
(1)认证服务 keystone
# yum install openstack-keystone httpd mod_wsgi -y
# yum install openstack-glance -y
# yum install openstack-nova-api openstack-nova-conductor \
openstack-nova-console openstack-nova-novncproxy \
openstack-nova-scheduler openstack-nova-placement-api -y
# yum install openstack-neutron openstack-neutron-ml2 \
openstack-neutron-linuxbridge ebtables -y
(5)块存储服务cinder
# yum install openstack-cinder -y
3、安装其他必须模块
# yum install rabbitmq-server -y
# yum install -y memcached python-memcached
# yum install mariadb mariadb-server python2-PyMySQL -y
(4)安装LVM模块
# yum install lvm2 device-mapper-persistent-data targetcli -y
4、添加防火墙放行
以下为OpenStack模块用到的端口(测试实验可以关闭防火墙)
firewall-cmd --permanent --add-port=15672/tcp
firewall-cmd --permanent --add-port=5672/tcp
firewall-cmd --permanent --add-port=5000/tcp
firewall-cmd --permanent --add-port=11211/tcp
firewall-cmd --permanent --add-port=6080/tcp
firewall-cmd --permanent --add-port=9292/tcp
firewall-cmd --permanent --add-port=9696/tcp
firewall-cmd --permanent --add-port=8778/tcp
firewall-cmd --permanent --add-port=8774/tcp
firewall-cmd --permanent --add-port=3306/tcp
firewall-cmd --reload
二、配置非OpenStack组件
1、数据库mariadb
提供OpenStack平台数据存储
(1)创建数据库配置文件 vim /etc/my.cnf.d/openstack.cnf
[mysqld]
bind-address = 0.0.0.0
default-storage-engine = innodb
innodb_file_per_table = on
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8
(2)启动服务:
# systemctl enable mariadb.service
# systemctl start mariadb.service
grant all on keystone.* to 'keystone'@'localhost' identified by 'keystone';
grant all on keystone.* to 'keystone'@'%' identified by 'keystone';
grant all on glance.* to 'glance'@'localhost' identified by 'glance';
grant all on glance.* to 'glance'@'%' identified by 'glance';
grant all on nova.* to 'nova'@'localhost' identified by 'nova';
grant all on nova.* to 'nova'@'%' identified by 'nova';
grant all on nova_api.* to 'nova'@'localhost' identified by 'nova';
grant all on nova_api.* to 'nova'@'%' identified by 'nova';
grant all on neutron.* to 'neutron'@'localhost' identified by 'neutron';
grant all on neutron.* to 'neutron'@'%' identified by 'neutron';
grant all on cinder.* to 'cinder'@'localhost' identified by 'cinder';
grant all on cinder.* to 'cinder'@'%' identified by 'cinder';
grant all on nova_cell0.* to 'nova'@'localhost' identified by 'nova';
grant all on nova_cell0.* to 'nova'@'%' identified by 'nova';
grant all on placement.* to 'placement'@'localhost' identified by 'placement';
grant all on placement.* to 'placement'@'%' identified by 'placement';
2、消息队列rabbitmq
解决OpenStack资源管理组件使用过程中资源争抢问题。
(1)启动消息队列,并设置开机自启:
# systemctl enable rabbitmq-server.service
# systemctl start rabbitmq-server.service
# rabbitmqctl add_user openstack openstack
(3)授权:授予openstack对所有资源的配置、写、读权限。
# rabbitmqctl set_permissions openstack ".*" ".*" ".*"
(4)启动rabbitmq_management用于消息队列web界面管理
# rabbitmq-plugins enable rabbitmq_management
再次查看
15672:访问 RabbitMQ 的Web管理界面,默认账号密码:guest guest
25672:集群通讯端口
5672:客户端连接使用
3、缓存系统memcache
提高OpenStack组件间访问速度
(1)修改配置文件制定监听地址
# vim /etc/sysconfig/memcached
(2)启动服务并设置开机自启
# systemctl enable memcached.service
# systemctl start memcached.service
(3)查看监听端口