OpenStack(一)简介+T版部署

云计算服务模型

IaaS(基础架构即服务)
提供底层 IT 基础设施服务,包括处理能力、存储空间、网络资源等
面向对象一般是 IT 管理人员
PaaS(平台即服务)
把安装好开发环境的系统平台作为一种服务通过互联网提供给用户
面向对象一般是开发人员
SaaS(软件即服务)
直接通过互联网为用户提供软件和应用程序等服务
面向对象一般是普通用户

OpenStack 简介

1、NASA (美国国家航空航天局)和 Rackspace(是一家全球领先的托管服务器及云计算提供商)共同发起

2、以 Apache 许可证(Apache 软件基金会发布的一个自由软件许可证)授权的自由软件和开放源代码项目,不只是一个软件,这个项目由几个主要的组件组合起来完成一些具体的工作

3、为公有云及私有云的建设与管理提供可扩展的弹性的云计算服务(开源项目)

4、覆盖了网络、虚拟化、操作系统、服务器等各个方面

Openstack得服务

在这里插入图片描述
简单理解总结
计算 nova 管理实例生命周期
镜像 glance 管理镜像快照服务
认证 keystone 全局认证、授权
块存储 cinder 为实例提供持久化功能
对象存储 swift 对象存储,存储镜像加快照
度量、监控 ceilometer 计费、监控
网络 neutron 为实例提供网络支持(拓扑结构)
控制台 horizon 用户登陆、使用的控制台界面

OpenStack 的优势

1、控制性
完全开源的平台,开源的平台意味着不会被某个特定的厂商绑定和限制
提供 API 接口,模块化的设计能把遗留的和第三方的技术进行集成,从而来满足自身业务需要
2、兼容性
OpenStack 兼容其他公有云,方便用户(企业)很容易的将数据和应用迁移
3、可扩展性
模块化设计,可以通过横向扩展来增加节点、添加资源
4、灵活性
用户可以根据自己的需要建立基础设施,也可以轻松地为自己的集群增加规模
5、行业标准
众多行业领军企业已经加入到OpenStack项目

OpenStack设计基本原则

Openstack的部署和运维之前,应当熟悉其架构和运行机制,OpenStack作为开源、可扩展、富有弹性(资源弹性,抗压能力的弹性)的云操作系统,其设计基本原则如下:

按照不同的功能和通用性划分不同项目,拆分子系统
按照逻辑计划、规范子系统之间的通信
通过分层设计整个系统架构

以不同维度/分层介绍openstack
1、以宏观/全局维度
openstack包含了8个核心组件分别是:
2、以服务、项目角度来看
以nova为例
里面包含了api、scheduler.controller、computer、db同时子功能系统之间使用
消息代理(rabbitmq)进行通讯
不同的功能子系统间提供统一的API接口
在这里插入图片描述

OpenStack逻辑架构

OpenStack包括若干个称为OpenStack服务的独立组件。所有服务均可通过一个公共身份服务进行身份验证。除了那些需要管理权限的命令,每个服务之间均可通过公共API进行交互。

每个OpenStack服务又由若干组件组成。包含多个进程。所有服务至少有一个API进程,用于侦听API请求,对这些请求进行预处理,并将它们传送到该服务的其他组件。除了认证服务,实际工作都是由具体的进程完成的

至于一个服务的进程之间通信,则使用AMQP消息代理。服务的状态存储在数据库中。

OpenStack组件通信关系

1、基于AMQP协议的通信
用于每个项目内部各个组件之间的通信。

2、基于SQL的通信
用于各个项目内部的通信。
openstack核心组件/服务 很多都是由python开发的

3、基于HTTP协议进行通信
通过各项目的API建立的通信关系,API都是RESTful Web APIl。

项目和项目之间的通讯比如novA和keystone之间的通讯http,而http在openstack是借助apache来实现的
项目之间点到点的通讯是借助不同项目暴露出来的公共api接口进行的通讯的过程:借助了AMQP进行通讯
restful :通讯协议的一种规范
Web:URL形式域名(URL)
http://www.my.com/index.html

4、通过Native API实现通信
OpenStack各组件和第三方软硬件之间的通信。

nova想和外部的实例交互管理
外部存储ceph etcd gfs nfs

部署

8G内存,2处理器,2内核,cpu开启虚拟化,双网卡,最小化安装。
在这里插入图片描述

在这里插入图片描述

// 
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost ~]# setenforce 0
[root@localhost ~]# hostnamectl set-hostname c1
[root@localhost ~]# su
[root@c1 ~]# vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.100.146 ct
192.168.100.147 c1

免密

//
[root@ct ~]# ssh-keygen -t rsa ##一路回车
[root@ct ~]# ssh-copy-id ct  ##yes 输入密码
[root@ct ~]# ssh-copy-id c1  ##yes 输入密码

安装基础环境包

//
[root@c1 ~]# yum -y install net-tools bash-completion vim gcc gcc-c++ make pcre  pcre-devel expat-devel cmake  bzip2 lrzsz
[root@ct ~]# yum -y install centos-release-openstack-train python-openstackclient openstack-selinux openstack-utils

在这里插入图片描述
在这里插入图片描述

配置时间同步

ct ->同步阿里云时钟服务器;c1、c2 -> 同步ct
在这里插入图片描述

在这里插入图片描述
c1
在这里插入图片描述
在这里插入图片描述

配置计划任务

//
[root@ct ~]# crontab -e
*/2 * * * * /usr/bin/chronuc  sources >>/var/log/chronyc.log  #配置计划任务,每隔2分钟同步一次

系统环境配置(控制节点)

安装、配置MariaDB

// 
[root@ct ~]#yum -y install mariadb mariadb-server python2-PyMySQL
[root@ct ~]#yum -y install libibverbs
[root@ct ~]# vim /etc/my.cnf.d/openstack.cnf

[mysqld]
        bind-address = 192.168.142.146          ##控制节点局域网地址,即本机
        default-storage-engine = innodb         ##默认引擎
        innodb_file_per_table = on                      ##开启表空间
        max_connections = 4096                  ##最大连接4096
        collation-server = utf8_general_ci              ##默认字符集
        character-set-server = utf8
[root@ct ~]# systemctl start mariadb   #开启服务
[root@ct ~]# systemctl enable mariadb #设置开机自启动
Created symlink from /etc/systemd/system/mysql.service to /usr/lib/systemd/system/mariadb.service.
Created symlink from /etc/systemd/system/mysqld.service to /usr/lib/systemd/system/mariadb.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@ct ~]# mysql_secure_installation #执行MariaDB完全配置脚本
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):   #直接回车
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] Y    #是否需要创建密码
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] Y  #是否需要移除其他用户
 ... Success!
Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] N   #是否不允许root用户远程登录
 ... skipping.
By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] Y  #删除test测试库
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y #是否现在重载以上的配置
 ... Success!
Cleaning up...
All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
您在 /var/spool/mail/root 中有新邮件

安装RabbitMQ

//
[root@ct ~]# yum -y install rabbitmq-server #下载rabbitmq服务
[root@ct ~]# systemctl start rabbitmq-server  #启动rabbitmq服务
[root@ct ~]# systemctl enable rabbitmq-server  # 设置开机自启
Created symlink from /etc/systemd/system/multi-user.target.wants/rabbitmq-server.service to /usr/lib/systemd/system/rabbitmq-server.service.
[root@ct ~]# rabbitmqctl add_user openstack RABBIT_PASS  #创建消息队列用户,用于controler和计算节点连接rabbitmq的认证
Creating user "openstack"
[root@ct ~]# rabbitmqctl set_permissions openstack ".*" ".*" ".*"   #配置openstack用户的操作权限(正则,配置读写权限);set:修改;permissions:权限
Setting permissions for user "openstack" in vhost "/"   
[root@ct ~]# netstat -anpt | grep 5672   #可查看256725672 两个端口(5672是Rabbitmq默认端口,25672是Rabbit的测试工具CLI的端口)
tcp        0      0 0.0.0.0:25672           0.0.0.0:*               LISTEN      12397/beam.smp      
tcp        0      0 127.0.0.1:55924         127.0.0.1:25672         TIME_WAIT   -

[root@ct ~]# rabbitmq-plugins list  #查看rabbitmq插件列表
 Configured: E = explicitly enabled; e = implicitly enabled
 | Status:   * = running on rabbit@localhost
 |/
[  ] amqp_client                       3.6.16
[  ] cowboy                            1.0.4
[  ] cowlib                            1.0.2
[  ] rabbitmq_amqp1_0                  3.6.16
[  ] rabbitmq_auth_backend_ldap        3.6.16
[  ] rabbitmq_auth_mechanism_ssl       3.6.16
[  ] rabbitmq_consistent_hash_exchange 3.6.16
[  ] rabbitmq_event_exchange           3.6.16
[  ] rabbitmq_federation               3.6.16
[  ] rabbitmq_federation_management    3.6.16
[  ] rabbitmq_jms_topic_exchange       3.6.16
[  ] rabbitmq_management               3.6.16
[  ] rabbitmq_management_agent         3.6.16
[  ] rabbitmq_management_visualiser    3.6.16
[  ] rabbitmq_mqtt                     3.6.16
[  ] rabbitmq_random_exchange          3.6.16
[  ] rabbitmq_recent_history_exchange  3.6.16
[  ] rabbitmq_sharding                 3.6.16
[  ] rabbitmq_shovel                   3.6.16
[  ] rabbitmq_shovel_management        3.6.16
[  ] rabbitmq_stomp                    3.6.16
[  ] rabbitmq_top                      3.6.16
[  ] rabbitmq_tracing                  3.6.16
[  ] rabbitmq_trust_store              3.6.16
[  ] rabbitmq_web_dispatch             3.6.16
[  ] rabbitmq_web_mqtt                 3.6.16
[  ] rabbitmq_web_mqtt_examples        3.6.16
[  ] rabbitmq_web_stomp                3.6.16
[  ] rabbitmq_web_stomp_examples       3.6.16
[  ] sockjs                            0.3.4

[root@ct ~]# rabbitmq-plugins enable rabbitmq_management #开启rabbitmq的web管理界面的插件,端口为15672
The following plugins have been enabled:
  amqp_client
  cowlib
  cowboy
  rabbitmq_web_dispatch
  rabbitmq_management_agent
  rabbitmq_management

Applying plugin configuration to rabbit@localhost... started 6 plugins.
[root@ct ~]# netstat -anpt | grep 5672
tcp        0      0 0.0.0.0:25672           0.0.0.0:*               LISTEN      12397/beam.smp      
tcp        0      0 0.0.0.0:15672           0.0.0.0:*               LISTEN      12397/beam.smp      
tcp        0      0 127.0.0.1:51215         127.0.0.1:25672         TIME_WAIT   -                   
tcp        0      0 127.0.0.1:59527         127.0.0.1:25672         TIME_WAIT   -                   
tcp6       0      0 :::5672                 :::*                    LISTEN      12397/beam.smp      


访问浏览器

默认账号和密码都是guest,点击Login即可进入以下界面
在这里插入图片描述

安装memcached

是一个缓存数据库,安装memcached是用于存储session信息;服务身份验证机制(keystone)使用Memcached来缓存令牌 在登录openstack的dashboard时,会产生一些session信息,这些session信息会存放到memcached中

//
 [root@ct ~]# yum install -y memcached python-memcached
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.cn99.com
 * centos-ceph-nautilus: mirrors.cn99.com
 * centos-nfs-ganesha28: mirrors.ustc.edu.cn
 * centos-openstack-train: mirrors.cn99.com
 * centos-qemu-ev: mirrors.ustc.edu.cn
 * extras: mirrors.ustc.edu.cn
 * updates: mirrors.cn99.com
软件包 memcached-1.5.6-1.el7.x86_64 已安装并且是最新版本
软件包 python-memcached-1.58-1.el7.noarch 已安装并且是最新版本
无须任何处理
[root@ct ~]# vim /etc/sysconfig/memcached

PORT="11211"   #memcached端口11211
USER="memcached"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS="-l 127.0.0.1,::1,ct"  #监听地址,127.0.0.1:本地地址,::是ipv6地址,ct是本地VMnet1地址
[root@ct ~]#  systemctl enable memcached
Created symlink from /etc/systemd/system/multi-user.target.wants/memcached.service to /usr/lib/systemd/system/memcached.service.
[root@ct ~]# systemctl start memcached
[root@ct ~]# netstat -antp | grep 11211
tcp        0      0 192.168.100.146:11211   0.0.0.0:*               LISTEN      14214/memcached     
tcp        0      0 127.0.0.1:11211         0.0.0.0:*               LISTEN      14214/memcached     
tcp6       0      0 ::1:11211               :::*                    LISTEN      14214/memcached     

安装、配置etcd

etcd是一个分布式可靠的键值存储系统,数据库

//
[root@ct ~]# yum -y install etcd
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.cn99.com
 * centos-ceph-nautilus: mirrors.cn99.com
 * centos-nfs-ganesha28: mirrors.cn99.com
 * centos-openstack-train: mirrors.cn99.com
 * centos-qemu-ev: mirrors.cn99.com
 * extras: mirrors.cn99.com
 * updates: mirrors.cn99.com
软件包 etcd-3.3.11-2.el7.centos.x86_64 已安装并且是最新版本
无须任何处理
[root@ct ~]# vim /etc/etcd/etcd.conf
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_PEER_URLS="http://192.168.100.146:2380"
ETCD_LISTEN_CLIENT_URLS="http://192.168.100.146:2379"
ETCD_NAME="ct"
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://192.168.100.146:2380"
ETCD_ADVERTISE_CLIENT_URLS="http://192.168.100.146:2379"
ETCD_INITIAL_CLUSTER="ct=http://192.168.100.146:2380"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster-01"
ETCD_INITIAL_CLUSTER_STATE="new"
[root@ct ~]# systemctl enable etcd
[root@ct ~]# systemctl start etcd
[root@ct ~]# netstat -anutp | grep 2379
tcp        0      0 192.168.100.146:2379    0.0.0.0:*               LISTEN      15745/etcd          
tcp        0      0 192.168.100.146:2379    192.168.100.146:54012   ESTABLISHED 15745/etcd          
tcp        0      0 192.168.100.146:54012   192.168.100.146:2379    ESTABLISHED 15745/etcd          

[root@ct ~]# netstat -anutp | grep 2380
tcp        0      0 192.168.100.146:2380    0.0.0.0:*               LISTEN      15745/etcd          

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值