openstack高阶集群管理

环境准备

资源规划

控制节点controller1(4c8g)
计算节点compute
2(2c4g)
存储节点storage2(1c1g)
存储设备NAS
1(NAS服务器替代)(1c1g)
创建openstack_template模板系统,通过该系统模板部署openstack节点虚拟机

网络规划

VMware workstation:
VMnet8(NAT模式)192.168.8.0/24
VMnet11(仅主机模式)192.168.11.0/24
VMnet19(仅主机模式)192.168.199.0/24
由于openstack自带有DHCP功能,所有网络关闭DHCP功能。

创建模板虚拟机

VMware workstation创建虚拟机
镜像:centos7
资源:1c1g
磁盘:单个文件 200G1 100G1 50G*1
网络:适配器1-VMnet8 适配器2-VMnet11 适配器3-VMnet19
处理开启虚拟化引擎

创建openstack-template

开启虚拟机-进入安装引导界面-按tab键修改内核参数使网卡名称eth开头 net.ifnames=0 biosdevname=0
最小化安装
手动配置分区,swap-2G /-198G
IP地址配置:
eth0 - 192.168.8.209/24 DNS - 192.168.8.2
主机名:OpenstackTemplate

openstack-template初始化

修改网卡配置
在这里插入图片描述
重启网卡:systemctl restart network
停止NetworkManager:systemctl stop NetworkManager &&systemctl disable NetworkManager
关闭防火墙:systemctl stop firewalld && systemctl disable firewalld
关闭selinux:修改配置文件,setenforce 0
禁用GSSAPI优化:ssh配置文件中的GSSAPIAuthentication no
设置YUM仓库:
local-iso:配置本地光盘作为仓库
常用命令安装:
yum install -y vim bash-completion net-tools tcpdump lrzsz wget tree screen lsof
关闭非必要的端口-防止冲突:systemctl stop postfix && systemctl disable postfix
openstack:配置openstack仓库
将openstack_rpm tar压缩包上传到/opt/openstack
解压:tar -xvzf openstack_rpm.tar
添加openstack的repo仓库
在这里插入图片描述

控制节点和计算节点部署

通过模板克隆虚拟机并修改配置,按照下表写入hosts文件:

IP地址 主机名
192.168.8.210 controller
192.168.8.211 compute01
192.168.8.212 compute02
192.168.8.221 stroage01
192.168.8.222 storage02
192.168.8.229 nas

NTP时钟同步

控制节点-服务端
其他节点-客户端
yum install -y chrony
allow 192.168.8.0/16
systemctl restart chronyd && systemctl enable chronyd
server controller iburst

openstack软件包安装

官方文档:https://docs.openstack.org/zh_CN/
安装openstack客户端

yum install  python-openstackclient -y

openstack-selinux服务的安全策略

yum install openstack-selinux -y

安装mariadb数据库

yum install mariadb mariadb-server python2-PyMySQL

配置数据库:

[mysqld]
...
bind-address = 192.168.8.210 #控制节点管理ip
default-storage-engine = innodb
innodb_file_per_table
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8

启动数据库

systemctl enable mariadb.service
systemctl start mariadb.service

为了保证数据库服务的安全性,运行mysql_secure_installation脚本。特别需要说明的是,为数据库的root用户设置一个适当的密码。
全选y

安装消息队列
消息队列服务一般运行在控制节点上

yum install rabbitmq-server -y
systemctl enable rabbitmq-server.service
systemctl start rabbitmq-server.service
rabbitmqctl add_user openstack RABBIT_PASS
#Creating user "openstack" ...
rabbitmqctl set_permissions openstack ".*" ".*" ".*"
#Setting permissions for user "openstack" in vhost "/" ...

默认密码:RABBIT_DBPASS

安装Memcached
令牌缓存,认证服务会使用到缓存服务

yum install memcached python-memcached
systemctl enable memcached.service
systemctl start memcached.service

修改Memcached配置文件

认证服务Keystone

安装和配置

认证服务介绍

  1. 部署在控制节点
  2. 功能作用
    身份认证
    令牌管理
    服务管理
    端点注册
    访问控制
  3. 自身端口
    5000 普通用户
    35357 管理员

创建keystone啊数据库

mysql
#创建keystone数据库
CREATE DATABASE keystone;
#对``keystone``数据库授予恰当的权限:
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' \
  IDENTIFIED BY 'KEYSTONE_DBPASS';
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' \
  IDENTIFIED BY 'KEYSTONE_DBPASS';

安装keystone软件包

yum install openstack-keystone httpd mod_wsgi
#在``[DEFAULT]``部分,定义初始管理令牌的值:
[DEFAULT]
...
admin_token = ADMIN_TOKEN
#在 [database] 部分,配置数据库访问:
[database]
...
connection = mysql+pymysql://keystone:KEYSTONE_DBPASS@controller/keystone
#在``[token]``部分,配置Fernet UUID令牌的提供者。
[token]
...
provider = fernet

可以换使用openstack开发工具utils给予命令自动修改

yum install -y openstack-utils
openstack-config --set /etc/keystone/keystone.conf DEFAULT admin_token ADMIN_TOKEN
openstack-config --set /etc/keystone/keystone.conf database connection mysql+pymysql://keystone:KEYSTONE_DBPASS@controller/keystone
openstack-config --set /etc/keystone/keystone.conf token provider fernet

校验

md5sum /etc/keystone/keystone.conf
d5acb3db852fe3f247f4f872b051b7a9  /etc/keystone/keystone.conf

修改本地字符集

[root@controller ~]# export LANG="en_US.UTF-8"
[root@controller ~]# env | grep -i lang
LANG=en_US.UTF-8

初始化身份认证服务的数据库:

su -s /bin/sh -c "keystone-manage db_sync" keystone

检查

mysql keystone -e "show tables;"

初始化Fernet keys:

keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone

配置 Apache HTTP 服务器

  1. 编辑/etc/httpd/conf/httpd.conf 文件,配置ServerName 选项为控制节点:
[root@controller ~]# echo "ServerName controller" >> /etc/httpd/conf/httpd.conf 
[root@controller ~]# md5sum /etc/httpd/conf/httpd.conf 
369555d67b9fc284259c40606d422033  /etc/httpd/conf/httpd.conf
  1. 用下面的内容创建文件 /etc/httpd/conf.d/wsgi-keystone.conf。
Listen 5000
Listen 35357

<VirtualHost *:5000>
    WSGIDaemonProcess keystone-public processes=5 threads=1 user=keystone group=keystone display-name=%{GROUP}
    WSGIProcessGroup keystone-public
    WSGIScriptAlias / /usr/bin/keystone-wsgi-public
    WSGIApplicationGroup %{GLOBAL}
    WSGIPassAuthorization On
    ErrorLogFormat "%{cu}t %M"
    ErrorLog /var/log/httpd/keystone-error.log
    CustomLog /var/log/httpd/keystone-access.log combined

    <Directory /usr/bin>
        Require all granted
    </Directory>
</VirtualHost>

<VirtualHost *:35357>
    WSGIDaemonProcess keystone-admin processes=5 threads=1 user=keystone group=keystone display-name=%{GROUP}
    WSGIProcessGroup keystone-admin
    WSGIScriptAlias / /usr/bin/keystone-wsgi-admin
    WSGIApplicationGroup %{GLOBAL}
    WSGIPassAuthorization On
    ErrorLogFormat "%{cu}t %M"
    ErrorLog /var/log/httpd/keystone-error.log
    CustomLog /var/log/httpd/keystone-access.log combined

    <Directory /usr/bin>
        Require all granted
    </Directory>
</VirtualHost>

启动 Apache HTTP 服务并配置其随系统启动:

systemctl enable httpd.service
systemctl start httpd.service

创建keystone服务和注册API<

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值