介绍
openstack 可以根据使用场景分配多种组合架构,此处以两个节点,控制节点和计算节点为例展示安装配置过程。注意:openstack 中每个节点服务器的主机名必须是唯一且后期不可变更的。(centos-7 配置/etc/hostname和/etc/hosts)
时间同步
两个节点都要配置时间同步服务(参照官方文档即可),在openstack 中所有节点时间必须一致,设置控制节点同步时间服务器时间,其他节点同步控制节点的时间。
基础软件包安装(默认yum 源即可)
两个节点都要执行
yum install centos-release-openstack-queens
yum upgrade (注意:此命令不仅升级软件包还会升级系统版本和内核版本,生产环境不可使用此命令)
yum install python-openstackclient
数据库安装配置(控制节点安装)
yum install mariadb mariadb-server python2-PyMySQL
创建和编辑/etc/my.cnf.d/openstack.cnf文件
创建一个[mysqld]部分,并将bind-address 密钥设置为控制器节点的管理IP地址,以允许其他节点通过管理网络进行访问。设置其他键以启用有用选项和UTF-8字符集:
[mysqld]
bind-address = 10.0.0.11
default-storage-engine = innodb
innodb_file_per_table = on
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8
启动数据库服务并将其配置为在系统引导时启动:
# systemctl enable mariadb.service
# systemctl start mariadb.service
数据库安全设置
mysql_secure_installation #先回车,再设置密码,往后一律Y 同意即可
数据库创建并授权: #以下操作可以在创建各个服务时候再操作,也可以提前操作。
MariaDB [(none)]> create database keystone;
MariaDB [(none)]> create database glance;
MariaDB [(none)]> create database nova;
MariaDB [(none)]> create database nova_api;
MariaDB [(none)]> create database neutron;
MariaDB [(none)]> create database cinder;
MariaDB [(none)]> grant all on keystone.* to 'keystone'@'localhost' identified by 'keystone';
MariaDB [(none)]> grant all on keystone.* to 'keystone'@'%' identified by 'keystone';
MariaDB [(none)]> grant all on glance.* to 'glance'@'localhost' identified by 'glance';
MariaDB [(none)]> grant all on glance.* to 'glance'@'%' identified by 'glance';
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)]> grant all on nova_api.* to 'nova'@'localhost' identified by 'nova';
MariaDB [(none)]> grant all on nova_api.* to 'nova'@'%' identified by 'nova';
MariaDB [(none)]> grant all on neutron.* to 'neutron'@'localhost' identified by 'neutron';
MariaDB [(none)]> grant all on neutron.* to 'neutron'@'%' identified by 'neutron';
MariaDB [(none)]> grant all on cinder.* to 'cinder'@'localhost' identified by 'cinder';
MariaDB [(none)]> grant all on cinder.* to 'cinder'@'%' identified by 'cinder';
show databases 查看数据库是否全部创建,名字是否正确
消息队列服务安装配置
(此服务可以安装在任意节点,如果规模很大需要单独安装并作集群)
yum install rabbitmq-server
systemctl enable rabbitmq-server.service
systemctl start rabbitmq-server.service
添加openstack用户:
# rabbitmqctl add_user 用户名 密码
允许用户进行配置,写入和读取访问 openstack:
# rabbitmqctl set_permissions openstack ".*" ".*" ".*"
rabbitmq-plugins list 查看可用的插件
rabbitmq-plugins enable rabbitmq_management 启用此插件,就可以web 页面管理rabbitmq 了
[root@localhost my.cnf.d]# lsof -i:15672 查看是否已经启动
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
beam.smp 36610 rabbitmq 55u IPv4 82209 0t0 TCP *:15672 (LISTEN)
登录web 页面 http://192.168.1.1:15672/ 注意管理员为guest 密码guest ,可以登录后更改一下密码
memcache 服务安装配置
yum install memcached python-memcached
/etc/sysconfig/memcached
PORT="11211"
USER="memcached"
MAXCONN="1024" #最大lianjieshu
CACHESIZE="64" #内存64M
OPTIONS="-l controller,::1" #监听地址为controller
systemctl enable memcached.service
systemctl start memcached.service