OpenStack安装-MySQL,Rabbitmq,memcache.

基于前一篇的基本环境,现在我们开始安装MySQL.

在node1上面安装MySQL:

[root@linux-node1 ~]# yum install mariadb mariadb-server python2-PyMySQL -y

设置为开机自动启动:

[root@linux-node1 ~]# systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.

创建并编辑openstack.cnf文件:

[root@linux-node1 ~]# cat /etc/my.cnf.d/openstack.cnf [mysqld]
bind-address = 192.168.56.11
default-storage-engine = innodb
innodb_file_per_table = on
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8
[root@linux-node1 ~]#

启动数据库,因为初始没有密码,我们需要为数据库设置一个密码,现在设置密码为wandl123

[root@linux-node1 ~]# mysql
Welcome to the MariaDB monitor. Commands end with ; or g. Your MariaDB connection id is 4
Server version: 10.1.20-MariaDB MariaDB Server
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others. Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

MariaDB [(none)]> use mysql;
Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A
 Database changed

MariaDB [mysql]> update user set password=password("wandl123")where user="root"; Query OK, 4 rows affected (0.00 sec)
Rows matched: 4 Changed: 4 Warnings: 0

MariaDB [mysql]> flush privileges; Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql]> exit Bye

为每一个openstack服务(keystone,nova,nova_api,glance,neutron)创建一个数据库并配置密码

MariaDB [(none)]> create database keystone; Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> create database nova; Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> create database nova_api; Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> create database glance; Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> create database neutron; Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> create database cinder; Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> CREATE DATABASE nova_cell0

为新的数据库授权

MariaDB [(none)]> grant all on nova.* to 'nova'@'localhost' identified by 'nova' -> ;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all on nova.* to 'nova'@'%' identified by 'nova'; Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all on nova_api.* to 'nova'@'%' identified by 'nova'; Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all on nova_api.* to 'nova'@'localhost' identified by 'nova'; Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all on keystone.* to 'keystone'@'localhost' identified by 'keystone'; Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all on keystone.* to 'keystone'@'%' identified by 'keystone'; Query OK, 0 rows affected (0.01 sec)
MariaDB [(none)]> grant all on glance.* to 'glance'@'localhost' identified by 'glance';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all on glance.* to 'glance'@'%' identified by 'glance'; Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all on neutron.* to 'neutron'@'localhost' identified by 'neutron'; Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all on neutron.* to 'neutron'@'%' identified by 'neutron'; Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all on cinder.* to 'cinder'@'localhost' identified by 'cinder'; Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all on cinder.* to 'cinder'@'%' identified by 'cinder'; Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' IDENTIFIED BY 'nova';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' DENTIFIED BY 'nova';

在创建并授权新的数据库后,需要自己验证一下自己配置的密码是不是可以登录自己创建的数据库,这一步在这里就省略了。

安装rabbitmq 

[root@linux-node1 ~]# yum install rabbitmq-server


启动消息队列服务并将其配置为随系统启动:

[root@linux-node1 ~]# systemctl enable rabbitmq-server.service
Created symlink from /etc/systemd/system/multi-user.target.wants/rabbitmq-server.service to /usr/lib/systemd/system/rabbitmq-server.service.
[root@linux-node1 ~]# systemctl start rabbitmq-server.service
[root@linux-node1 ~]#

为rabbitmq添加openstack用户,并将密码设置为openstack

[root@linux-node1 ~]# rabbitmqctl add_user openstack openstack
Creating user "openstack" ...

给``openstack``用户配置写和读权限:

 
[root@linux-node1 ~]# rabbitmqctl set_permissions openstack ".*" ".*" ".*"
Setting permissions for user "openstack" in vhost "/" ...

安装memcach: 

[root@linux-node1 ~]# yum install memcached python-memcached

编辑/etc/sysconfig/memcached, 将127.0.0.1替换为192.168.56.11

[root@linux-node1 ~]# cat /etc/sysconfig/memcached 
PORT="11211" USER="memcached" MAXCONN="1024" CACHESIZE="64" OPTIONS="-l 192.168.56.11,::1"

将memcache启动并设置为开机启动

[root@linux-node1 ~]# systemctl enable memcached.service
Created symlink from /etc/systemd/system/multi-user.target.wants/memcached.service to /usr/lib/systemd/system/memcached.service.
[root@linux-node1 ~]# systemctl start memcached.service

现在将openstack所需的控制节点服务安装上,供后面章节使用:

#keystone
[root@linux-node1 ~]# yum install -y openstack-keystone httpd mod_wsgi memcached python-memcached

#Glance
[root@linux-node1 ~]# yum install -y openstack-glance

#nova
[root@linux-node1 ~]# yum install -y openstack-nova-api openstack-nova-placement-api 
  openstack-nova-conductor openstack-nova-console 
  openstack-nova-novncproxy openstack-nova-scheduler

#neutron
[root@linux-node1 ~]# yum install -y openstack-neutron openstack-neutron-ml2 
openstack-neutron-linuxbridge ebtables 

然后将计算节点的服务安装上,供后面章节使用

[root@linux-node2 ~]# yum install -y openstack-nova-compute sysfsutils

[root@linux-node2 ~]# yum install -y openstack-neutron openstack-neutron-linuxbridge ebtables 

这一部分先到这,后面介绍keystone的配置

原文地址:https://www.cnblogs.com/nurruden/p/8269433.html