◎ 部署图(基于M版)
◎ OpenStack数据库基础服务
1. 安装基础软件包(两台都安装)
1 安装EPEL仓库 #rpm -ivh http://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm 2.安装OpenStack仓库 # yum install -y centos-release-openstack-mitaka [root@linux-node1 ~]# ls /etc/yum.repos.d/CentOS-OpenStack-mitaka.repo /etc/yum.repos.d/CentOS-OpenStack-mitaka.repo 3.安装OpenStack客户端 # yum install -y python-openstackclient #安装OpenStack常用客户端 4.安装openstack SELinux管理包 # yum install -y openstack-selinux #若SELinux没关,OpenStack会进行自动管理
2. MySQL数据库部署
OpenStack基础服务:
MySQL和RabbitMQ
2.1 MySQL安装配置
[root@linux-node1 ~]# yum install -y mariadb mariadb-server python2-PyMySQL #存储组件数据(KeyStone、Nova等) [root@linux-node1 ~]# cd /etc/my.cnf.d/ [root@linux-node1 my.cnf.d]# vi openstack.cnf [mysqld] bind-address = 192.168.56.11 #监听IP地址 default-storage-engine = innodb innodb_file_per_table #使用独享表空间 max_connections = 4096 #最大连接数(默认1024) collation-server = utf8_general_ci character-set-server = utf8 #默认字符集 启动数据库服务,并将其配置为开机自启: [root@linux-node1 my.cnf.d]# systemctl enable mariadb [root@linux-node1 my.cnf.d]# systemctl start mariadb 为了保证数据库服务的安全性,运行 mysql_secure_installation 脚本。特别需要说明的是,为数据库的root用户设置一个适当的密码 [root@linux-node1 my.cnf.d]# mysql_secure_installation
2.2 设置OpenStack组件数据库
创建keystone数据库 [root@linux-node1 my.cnf.d]# mysql -uroot -p MariaDB [(none)]> create database keystone; MariaDB [(none)]> grant all on keystone.* to 'keystone'@'localhost' identified by 'keystone'; MariaDB [(none)]> grant all on keystone.* to 'keystone'@'%' identified by 'keystone'; 创建glance数据库 MariaDB [(none)]> create database glance; MariaDB [(none)]> grant all on glance.* to 'glance'@'localhost' identified by 'glance'; MariaDB [(none)]> grant all on glance.* to 'glance'@'%' identified by 'glance'; 创建nova、nova_api数据库 MariaDB [(none)]> create database nova; MariaDB [(none)]> grant all on nova.* to 'nova'@'localhost' identified by 'nova'; MariaDB [(none)]> grant all on nova.* to 'nova'@'%' identified by 'nova'; MariaDB [(none)]> create database nova_api; MariaDB [(none)]> grant all on nova_api.* to 'nova_api'@'localhost' identified by 'nova'; MariaDB [(none)]> grant all on nova_api.* to 'nova_api'@'%' identified by 'nova'; 创建neutron数据库 MariaDB [(none)]> create database neutron; MariaDB [(none)]> grant all on neutron.* to 'neutron'@'localhost' identified by 'neutron'; MariaDB [(none)]> grant all on neutron.* to 'neutron'@'%' identified by 'neutron';
3. 消息代理RabbitMQ配置
3.1.安装RabbitMQ
[root@linux-node1 ~]# yum install -y rabbitmq-server #提供各组件之间通信管道(如Nova) 启动消息队列服务并将其配置为随系统启动: [root@linux-node1 ~]# systemctl enable rabbitmq-server.service [root@linux-node1 ~]# systemctl start rabbitmq-server.service
3.2 添加 openstack 用户
#密码设置为openstack [root@linux-node1 ~]# rabbitmqctl add_user openstack openstack Creating user "openstack" ...
3.3 给 openstack 用户配置写和读权限
[root@linux-node1 ~]# rabbitmqctl set_permissions openstack ".*" ".*" ".*" Setting permissions for user "openstack" in vhost "/" ...
3.4 安装RabbitMQ Web管理插件
查看支持的插件列表 [root@linux-node1 ~]# rabbitmq-plugins list 安装Web管理插件 [root@linux-node1 ~]# rabbitmq-plugins enable rabbitmq_management [root@linux-node1 ~]# netstat -tunpl |grep 15672 tcp 0 0 0.0.0.0:15672 0.0.0.0:* LISTEN 11284/beam.smp
打开浏览器访问http://192.168.56.11:15672,使用guest/guest账号登陆
4. 设置时间同步
#时间不同步则不能创建虚机 [root@linux-node1 ~]# timedatectl set-timezone Asia/Shanghai [root@linux-node1 ~]# ntpdate time1.aliyun.com 30 Mar 15:05:25 ntpdate[12566]: adjust time server 115.28.122.198 offset -0.010337 sec
参考:
MariaDB [(none)]> create database nova_api;
MariaDB [(none)]> grant all on nova.* to 'nova_api'@'localhost' identified by 'nova';
MariaDB [(none)]> grant all on nova.* to 'nova_api'@'%' identified by 'nova';
楼主,这一块有问题吧,否则后面nova配置里同步数据nova_api库会报错的,应该是
MariaDB [(none)]> grant all on nova_aip.* to 'nova'@'localhost' identified by 'nova';
MariaDB [(none)]> grant all on nova_api.* to 'nova'@'%' identified by 'nova';
@ouats 感谢提醒,确实是打错了,已修改。
@anzhihe 楼主openstack文章写得不错,尤其是注释比较多,方便人理解一些参数的含义,后面还有继续写的计划不?尤其是网络这一块,感觉比较复杂,如果能写些跟生产案例有关或者比较深入的文章共大家一起学习那就台perfect了。
@ouats 一起学习,现在在公司里维护管理cloudstack,后续有机会继续写些openstack的文章,都是以前学习的总结。