OpenStack搭建企业私有云 二:镜像服务(持续更新...)

栏目: 服务器 · 发布时间: 5年前

内容简介:简单来说使用file作为后端配置镜像服务,能够上传并存储在一个托管镜服务的控制节点目录中。默认情况下,这个目录是 /var/lib/glance/images/大量周期性进程运行于OpenStack镜像服务上以支持缓存。同步复制(Replication)服务保证集群中的一致性和可用性。

OpenStack镜像服务概览

OpenStack镜像服务(glance)是IaaS的核心服务,允许用户发现、注册和获取虚拟机的镜像。 他提供了一个RESTAPI,允许查询虚拟机镜像的元数据并获取一个现存的镜像。可以将虚拟机镜像存储到各种位置,从简单的文件系统到对象存储系统—例如OpenStack对象存储,并通过镜像服务使用。

简单来说使用file作为后端配置镜像服务,能够上传并存储在一个托管镜服务的控制节点目录中。默认情况下,这个目录是 /var/lib/glance/images/

大量周期性进程运行于OpenStack镜像服务上以支持缓存。

同步复制(Replication)服务保证集群中的一致性和可用性。

其它周期性进程包括auditors, updaters, 和 reapers。

OpenStack镜像服务包括以下组件:

  • glance-api

    接收镜像API的调用,诸如镜像发现、恢复、存储。

  • glance-registry

    存储、处理和恢复镜像的元数据,元数据包括项诸如大小和类型。

  • 数据库

    存放镜像元数据,用户是可以依据个人喜好选择数据库的,多数的部署使用 MySQL 或SQLite。

  • 镜像文件的存储仓库

    支持多种类型的仓库,它们有普通文件系统、对象存储、RADOS块设备、HTTP、以及亚马逊S3。记住,其中一些仓库仅支持只读方式使用。

  • 元数据定义服务

    通用的API,是用于为厂商,管理员,服务,以及用户自定义元数据。这种元数据可用于不同的资源,例如镜像,工件,卷,配额以及集合。一个定义包括了新属性的键,描述,约束以及可以与之关联的资源的类型。

部署镜像服务glance

控制节点上部署

  • 创建glance数据库,并授权

    # mysql -u root -p
    > CREATE DATABASE glance;
    > GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY '123456';
    > GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%'  IDENTIFIED BY '123456';
  • 获取admin用户的环境变量,并创建服务认证

    # cd ~
    # . admin-openrc
    # export | grep OS_
  • 创建glance用户

    # openstack user create --domain default --password-prompt glance
  • 把admin用户添加到glance用户和项目中

    # openstack role add --project service --user glance admin
  • 创建glance服务

    # openstack service create --name glance  --description "OpenStack Image" image

OpenStack搭建企业私有云 二:镜像服务(持续更新...)

  • 创建镜像服务API端点

    # openstack endpoint create --region RegionOne image public http://controller:9292
    # openstack endpoint create --region RegionOne  image internal http://controller:9292
    # openstack endpoint create --region RegionOne  image admin http://controller:9292

OpenStack搭建企业私有云 二:镜像服务(持续更新...)

  • 安装glance包

    # yum install openstack-glance -y
    # mkdir /var/lib/glance/images
    # cd /var/lib
    # chown -hR glance:glance glance
    # vim /etc/glance/glance-api.conf
    [database]
    connection = mysql+pymysql://glance:123456@controller/glance
    [keystone_authtoken]
    auth_uri = http://controller:5000    //3501行
    auth_url = http://controller:35357   (!注意 url 不是 uri)
    memcached_servers = controller:11211    //3552行
    auth_type = password      //3659行
    project_domain_name = default
    user_domain_name = default
    project_name = service
    username = glance
    password = 123456
    [paste_deploy]
    flavor = keystone  ////4508
    [glance_store]
    stores = file,http    //2066
    default_store = file   //2110
    filesystem_store_datadir = /var/lib/glance/images  //2429

.

# vim /etc/glance/glance-registry.conf
    [database]
    //1188行
    connection = mysql+pymysql://glance:123456@controller/glance
    [keystone_authtoken]
    auth_uri = http://controller:5000
    auth_url = http://controller:35357    (!注意 url 不是 uri)
    memcached_servers = controller:11211    //1365行
    auth_type = password        //1472行
    project_domain_name = default
    user_domain_name = default
    project_name = service
    username = glance
    password = 123456
    [paste_deploy]
    flavor = keystone       //2294行
  • 同步镜像数据库
  • 启动镜像服务、配置开机启动

    # su -s /bin/sh -c "glance-manage db_sync" glance
    # systemctl enable openstack-glance-api.service
    # systemctl start openstack-glance-api.service
    # systemctl enable openstack-glance-registry.service
    # systemctl start openstack-glance-registry.service

OpenStack搭建企业私有云 二:镜像服务(持续更新...)

  • 获取admin用户的环境变量,且下载镜像

    # source ~/admin-openrc
    # wget http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img
  • 上传镜像
  • 使用QCOW2磁盘格式,裸容器格式和公开可见性将图像上传到Image服务,以便所有项目都可以访问它

    # openstack image create "cirros" --file cirros-0.3.5-x86_64-disk.img  --disk-format qcow2 --container-format bare  --public
  • 查看上传的镜像

    # openstack image list

OpenStack搭建企业私有云 二:镜像服务(持续更新...)


以上所述就是小编给大家介绍的《OpenStack搭建企业私有云 二:镜像服务(持续更新...)》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Writing Windows VxDs and Device Drivers, Second Edition

Writing Windows VxDs and Device Drivers, Second Edition

Karen Hazzah / CMP / 1996-01-12 / USD 54.95

Software developer and author Karen Hazzah expands her original treatise on device drivers in the second edition of "Writing Windows VxDs and Device Drivers." The book and companion disk include the a......一起来看看 《Writing Windows VxDs and Device Drivers, Second Edition》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

在线进制转换器
在线进制转换器

各进制数互转换器

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具