Skip to content

安装OpenStack基本框架

安装时间同步服务

yum install -y chrony net-tools telnet telnet-server 

配置时间同步服务文件

备份

cp /etc/chrony.conf /etc/chrony.conf.back

编辑

[root@controller ~]# vi /etc/chrony.conf
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server ntp.aliyun.com iburst
local stratum 1
allow 192.168.10.0/24

启动时间同步服务,并设置开机自启

systemctl start chronyd.service && systemctl enable chronyd.service

查看时间

[root@controller ~]# chronyc sources
210 Number of sources = 1
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
^* 203.107.6.88                  2   6    17    43  +1700us[+4310us] +/-   37ms

安装OpenStack云计算平台框架

yum -y install centos-release-openstack-train

安装OpenStack云计算平台客户端

yum -y install python-openstackclient

安装OpenStack-selinux

yum -y install openstack-selinux

查看OpenStack版本

openstack --version

安装MariaDB

yum install -y mariadb mariadb-server python2-PyMySQL

配置MariaDB

vi /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

MariaDB参数及功能说明

参数说明
port数据库对外服务的端口号,默认3306
datadir数据库文件存放目录
bind-address绑定远程访问地址,只允许该地址访问
default-storage-engine默认存储引擎,MariaDB支持几十种存储引擎
innodb_file_per_tableInnoDB引擎的独立表空间,每张表单独保存
max_connections最大连接数
collation-server字符的排序规则
character-set-server字符集

启动数据库,并设置开机自启

systemctl enable mariadb.service && systemctl start mariadb.service

初始化数据库,设置root密码

 mysql_secure_installation
问题释义
Enter ourment password for root(erter for none)输入当前密码,若没有密码则直接Enter
Set root password? [Y/n] Y是否设置新密码
New password:000000输入新密码:000000
Re-enter new password:000000确认新密码:000000
Remove anonymous users? [Y/n]Y是否去掉匿名用户
Disallow root lagin remotely?[Y/n]Y是否禁止root用户远程登录
Remove test database and access to it? [Y/n]Y是否去掉测试数据库
Reload privilege tables now? [Y/n]Y是否重新加载权限表

登录数据库管理系统

mysql -hlocalhost -uroot -p000000

查讯所以的存在的数据库

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.002 sec)

查讯MySQL数据库中存在的表

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]> show tables;
+---------------------------+
| Tables_in_mysql           |
+---------------------------+
| column_stats              |
| columns_priv              |
| db                        |
| event                     |
| func                      |
| general_log               |
| gtid_slave_pos            |
| help_category             |
| help_keyword              |
| help_relation             |
| help_topic                |
| host                      |
| index_stats               |
| innodb_index_stats        |
| innodb_table_stats        |
| plugin                    |
| proc                      |
| procs_priv                |
| proxies_priv              |
| roles_mapping             |
| servers                   |
| slow_log                  |
| table_stats               |
| tables_priv               |
| time_zone                 |
| time_zone_leap_second     |
| time_zone_name            |
| time_zone_transition      |
| time_zone_transition_type |
| transaction_registry      |
| user                      |
+---------------------------+
31 rows in set (0.001 sec)

数据库账号和密码

数据库账号:root
数据库密码:000000

安装RabbitMQ消息队列服务

yum install -y rabbitmq-server

启动并设置开机自启

systemctl start rabbitmq-server.service && systemctl enable rabbitmq-server.service

创建消息队列用户,账号前面密码后面

rabbitmqctl add_user rabbitmq 000000

给消息队列用户授权

rabbitmqctl set_permissions rabbitmq ".*" ".*" ".*"

将RabbitMQ消息队列用户名为"rabbitmq"修改密码为"000000"(不用操作,需要知道)

rabbitmqctl change_password rabbitmq 000000

删除用户"rabbitmq"(不用操作,需要知道)

rabbitmqctl delete_user rabbitmq

查看rabbitmq用户的权限(不用操作,需要知道)

rabbitmqctl list_user_permissions rabbitmq

查看RabbitMQ用户列表(不用操作,需要知道)

rabbitmqctl list_users

增加用户组(不用操作)

rabbitmqctl set_user_tags rabbitmq administrator

RabbitMQ消息队列账号和密码

账号:rabbitmq
密码:000000

启用web管理界面(暂时可以不用操作)

查看rabbitmq有那些插件

rabbitmq-plugins list

启动web界面

rabbitmq-plugins enable rabbitmq_management

浏览器访问你的ip:15672,是NAT网卡的ip

账号:guest     管理员账号:rabbitmq
密码:guest     管理员密码:000000

安装Memcached内存缓存服务

安装Memcached内存缓存软件

yum -y install memcached python-memcached

配置memcached文件

cp /etc/sysconfig/memcached /etc/sysconfig/memcached.back
vi /etc/sysconfig/memcached
PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS="-l 127.0.0.1,::1,192.168.10.160"

启动memcached,并设置开机自启

systemctl start memcached.service && systemctl enable memcached.service

检查服务是否运行

[root@controller ~]# netstat -tnlup | grep memcached
tcp        0      0 192.168.10.10:11211     0.0.0.0:*               LISTEN      8048/memcached      
tcp        0      0 127.0.0.1:11211         0.0.0.0:*               LISTEN      8048/memcached      
tcp6       0      0 ::1:11211               :::*                    LISTEN      8048/memcached   

查看端口占用情况

netstat -tnlup

安装etcd分布式键值对存储系统

yum -y install etcd

配置etcd

cp /etc/etcd/etcd.conf /etc/etcd/etcd.conf.back
echo "123" > /etc/etcd/etcd.conf
cat /etc/etcd/etcd.conf
vi /etc/etcd/etcd.conf

修改部分内容和启用(取消注释)下面数据(仔细一点修改的地方很多)

ETCD_LISTEN_PEER_URLS="http://192.168.10.160:2380"
ETCD_LISTEN_CLIENT_URLS="http://192.168.10.160:2379,http://127.0.0.1:2379"
ETCD_NAME="controller"
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://192.168.10.160:2380"
ETCD_ADVERTISE_CLIENT_URLS="http://192.168.10.160:2379"
ETCD_INITIAL_CLUSTER="controller=http://192.168.10.160:2380"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster-01"
ETCD_INITIAL_CLUSTER_STATE="new"

启动etcd,并设置开机自启

systemctl start etcd.service && systemctl enable etcd.service

向etcd存入一个键值对,键为"mykey",值为"007"

etcdctl set mykey 007

读取etcd中的键"mykey"

etcdctl get mykey 

检查上面的服务启动状态,宿主机访问控制节点IP:15672应该有rabbitmq的web管理界面

systemctl status chronyd.service mariadb.service rabbitmq-server.service memcached.service etcd.service

所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自linlink~文档