zoukankan      html  css  js  c++  java
  • 云计算OpenStack环境搭建(4)

    准备工作:

      准备3台机器,确保yum源是可用的,分别为控制节点(192.168.11.3)、计算节点(192.168.11.4)和存储节点(192.168.11.5)

    控制节点:OpenStack日常的管理服务都运行的节点(OpenStack packages、mariadb、rabbitmq、memcached、keystone、glance)

    计算节点:创建虚机的(实际中可有多台)

    存储节点:提供存储资源

    部署步骤:

    1、进入官网,查看安装指导

    2、因为yum源已经配好,所以直接安装OpenStack软件包

    (1)安装OpenStack客户端

    [root@ren3 ~]# yum install python-openstackclient -y

    (2)RHEL和CentOS默认启用SELinux。安装OpenStack -selinux包来自动管理OpenStack服务的安全策略:

    [root@ren3 ~]# yum install openstack-selinux -y

    3、安装配置数据库服务

    (1)安装数据库所需软件包

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

    (2)修改数据库配置文件(创建并编辑/etc/my.cnf.d/openstack.cnf文件)

    [root@ren3 ~]# cd /etc/my.cnf.d/
    [root@ren3 my.cnf.d]# ls
    auth_gssapi.cnf  enable_encryption.preset  mysql-clients.cnf
    client.cnf       mariadb-server.cnf        tokudb.cnf
    [root@ren3 my.cnf.d]# vim openstack.cnf
    [mysqld]
    bind-address = 192.168.11.3
    
    default-storage-engine = innodb
    innodb_file_per_table = on
    max_connections = 4096
    collation-server = utf8_general_ci
    character-set-server = utf8

    (3)启动数据库

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

    (4)初始化数据库

    [root@ren3 ~]# mysql_secure_installation

    (5)登录数据库进行验证

    [root@ren3 ~]# mysql -u root -proot
    Welcome to the MariaDB monitor.  Commands end with ; or g.
    Your MariaDB connection id is 9
    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)]> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | mysql              |
    | performance_schema |
    +--------------------+
    3 rows in set (0.00 sec)
    
    MariaDB [(none)]> exit
    Bye

    4、安装消息传输组件rabbitmq

    (1)安装

    [root@ren3 ~]# yum install rabbitmq-server -y

    (2)启动rabbitmq

    [root@ren3 ~]# systemctl enable rabbitmq-server.service
    [root@ren3 ~]# systemctl start rabbitmq-server.service
    [root@ren3 ~]# systemctl status rabbitmq-server.service
    ● rabbitmq-server.service - RabbitMQ broker
       Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: disabled)
       Active: active (running) since 五 2019-10-11 14:21:22 CST; 1h 48min ago

    (3)添加openstack用户

    [root@ren3 ~]# rabbitmqctl add_user openstack admin  #用户名为openstack;密码为admin
    Creating user "openstack" ...
    [root@ren3 ~]# rabbitmqctl list_users
    Listing users ...
    openstack    []
    guest    [administrator]

    (4)添加openstack用户管理权限,使其成为管理员

    [root@ren3 ~]# rabbitmqctl set_permissions openstack ".*" ".*" ".*"
    Setting permissions for user "openstack" in vhost "/" ...
    [root@ren3 ~]# rabbitmqctl set_user_tags openstack administrator
    Setting tags for user "openstack" to [administrator] ...
    [root@ren3 ~]# rabbitmqctl list_users
    Listing users ...
    openstack    [administrator]
    guest    [administrator]

    (5)浏览器登录验证http://192.168.11.3:15672/#/

    添加防火墙规则:

    firewall-cmd --add-port=4369/tcp --permanent
    firewall-cmd --add-port=5672/tcp --permanent
    firewall-cmd --add-port=15672/tcp --permanent
    firewall-cmd --add-port=25672/tcp --permanent
    firewall-cmd --reload

    5、安装缓存Memcached

    (1)安装

    [root@ren3 ~]# yum install memcached python-memcached -y

    (2)编辑/etc/sysconfig/memcached文件

    将服务配置为使用控制器节点的管理IP地址;这是为了允许其他节点通过管理网络访问。

    [root@ren3 ~]# vim /etc/sysconfig/memcached
    PORT="11211"
    USER="memcached"
    MAXCONN="1024"
    CACHESIZE="64"
    OPTIONS="-l 127.0.0.1,::1,ren3"      #增加主机名或者IP

    (3)启动memcached

    [root@ren3 ~]# systemctl enable memcached.service 
    Created symlink from /etc/systemd/system/multi-user.target.wants/memcached.service to /usr/lib/systemd/system/memcached.service.
    [root@ren3 ~]# systemctl start memcached.service 
    [root@ren3 ~]# ss -tnl |grep 11211
    LISTEN     0      128    192.168.11.3:11211                    *:*                  
    LISTEN     0      128    127.0.0.1:11211                    *:*                  
    LISTEN     0      128        ::1:11211                   :::*           

    添加数据库和缓存所用的防火墙端口:

    [root@ren3 ~]# firewall-cmd --add-port=3306/tcp
    success
    [root@ren3 ~]# firewall-cmd --add-port=3306/tcp --permanent
    success
    [root@ren3 ~]# firewall-cmd --add-port=11211/tcp --permanent
    success
    [root@ren3 ~]# firewall-cmd --add-port=11211/tcp 
    success

    6、OpenStack共享服务组件已经安装完成,接下来就是安装核心组件,安装核心组件的步骤大致为:

    (1)要在数据库当中创建对应服务的用户,并且设置权限

    (2)在OpenStack中创建对应服务的用户,配置用户的角色,创建服务端点(endpoint:服务端点(服务的地址)分为3种:管理网、内部网、公共网)

    (3)安装对应服务的软件包

    (4)修改服务的配置文件

  • 相关阅读:
    2013总结,新的征程开始了!
    NOIP2015滚粗记
    HelloWorld!
    For the strivers ——
    【DP】最长公共子序列
    【DP】青蛙过河
    【DP+拓扑】关键子工程
    【线段树+向量】POJ 2991 Crane
    【线段树】POJ3225 Help with intervals
    【数学】test20170311
  • 原文地址:https://www.cnblogs.com/renyz/p/11655055.html
Copyright © 2011-2022 走看看