<手动安装Openstack Mikita>之(三) Glance安装
2016-08-02 10:42
155 查看
手动安装Openstack Mikita的第三部分: 镜像服务Glance安装. 这部分内容主要是对OpenStack Installation Guide for Red Hat Enterprise Linux and CentOS在Glance这部分内容的实践总结.
The Image service (glance) enables users to discover, register, and retrieve virtual machine images. It offers a REST API that enables you to query virtual machine image metadata and retrieve an actual image. You can store virtual machine images made available through the Image service in a variety of locations, from simple file systems to object-storage systems like OpenStack Object Storage.
为了简化操作, 我们将Glance服务安装在controller节点. 默认的镜像目录为 /var/lib/glance/images/ . 以下操作均在controller节点进行.
其中, GLANCE_DBPASS是Glance访问数据库时使用的密码.
这里glance用户的密码为: zzr.
internal endpoint
admin endpoint
其中, zzr为上一步骤中为glance用户设置的密码.
编辑文件 /etc/glance/glance-registry.conf .
[keystone_authtoken]的内容, 除了以上增加的内容外, 其它的全部删除.
The Image service (glance) enables users to discover, register, and retrieve virtual machine images. It offers a REST API that enables you to query virtual machine image metadata and retrieve an actual image. You can store virtual machine images made available through the Image service in a variety of locations, from simple file systems to object-storage systems like OpenStack Object Storage.
为了简化操作, 我们将Glance服务安装在controller节点. 默认的镜像目录为 /var/lib/glance/images/ . 以下操作均在controller节点进行.
一. 安装前准备
1. 为Glance创建数据库
[root@controller ~]# mysql -u root -p CREATE DATABASE glance; GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' \ IDENTIFIED BY 'GLANCE_DBPASS'; GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' \ IDENTIFIED BY 'GLANCE_DBPASS';
其中, GLANCE_DBPASS是Glance访问数据库时使用的密码.
2. 创建Service和API Endpoint
(1) 获取admin-only CLI指令的权限
[root@controller ~]# . admin-openrc
(2) 创建glance用户
[root@controller ~]# openstack user create --domain default --password-prompt glance User Password: Repeat User Password: +-----------+----------------------------------+ | Field | Value | +-----------+----------------------------------+ | domain_id | 23445595d52c44be995b0b393870b5ef | | enabled | True | | id | dee5c1d866804d2a83d6f5f62c329dc4 | | name | glance | +-----------+----------------------------------+
这里glance用户的密码为: zzr.
(3) 把glance用户增加到admin角色和service租户
[root@controller ~]# openstack role add --project service --user glance admin
(4) 创建image服务
[root@controller ~]# openstack service create --name glance \ --description "OpenStack Image" image +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | OpenStack Image | | enabled | True | | id | 9df122e5374742cb9bfd1bec48622f30 | | name | glance | | type | image | +-------------+----------------------------------+
(5) 创建image服务的Endpoints
public endpoint[root@controller ~]# openstack endpoint create --region RegionOne \ image public http://controller:9292 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 7ddc527f399f4592943c0ac687e313ed | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | 9df122e5374742cb9bfd1bec48622f30 | | service_name | glance | | service_type | image | | url | http://controller:9292 | +--------------+----------------------------------+
internal endpoint
[root@controller ~]# openstack endpoint create --region RegionOne \ image internal http://controller:9292 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 70f89821d1054a64ba044ac35554a082 | | interface | internal | | region | RegionOne | | region_id | RegionOne | | service_id | 9df122e5374742cb9bfd1bec48622f30 | | service_name | glance | | service_type | image | | url | http://controller:9292 | +--------------+----------------------------------+
admin endpoint
[root@controller ~]# openstack endpoint create --region RegionOne \ image admin http://controller:9292 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 98f67ed0b6ab454a915d5c585b66b22d | | interface | admin | | region | RegionOne | | region_id | RegionOne | | service_id | 9df122e5374742cb9bfd1bec48622f30 | | service_name | glance | | service_type | image | | url | http://controller:9292 | +--------------+----------------------------------+
二. 安装glance组件
1. 安装glance
[root@controller ~]# yum install openstack-glance -y
2. 配置glance
编辑文件 /etc/glance/glance-api.conf :[database] ... connection = mysql+pymysql://glance:GLANCE_DBPASS@controller/glance [keystone_authtoken] ... auth_uri = http://controller:5000 auth_url = http://controller:35357 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = glance password = zzr [paste_deploy] ... flavor = keystone [glance_store] ... stores = file,http default_store = file filesystem_store_datadir = /var/lib/glance/images/
其中, zzr为上一步骤中为glance用户设置的密码.
编辑文件 /etc/glance/glance-registry.conf .
[database] ... connection = mysql+pymysql://glance:GLANCE_DBPASS@controller/glance [keystone_authtoken] ... auth_uri = http://controller:5000 auth_url = http://controller:35357 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = glance password = zzr [paste_deploy] ... flavor = keystone
[keystone_authtoken]的内容, 除了以上增加的内容外, 其它的全部删除.
(3) 同步glance配置成数据库
以glance用户的身份执行指令 glance-manage db_sync , 同步glance的配置到数据库:[root@controller ~]# su -s /bin/sh -c "glance-manage db_sync" glance
(4) 开启Image服务
[root@controller ~]# # systemctl enable openstack-glance-api.service \ openstack-glance-registry.service [root@controller ~]# # systemctl start openstack-glance-api.service \ openstack-glance-registry.service
3. 验证
(1) 获取admin-only CLI指令的权限
[root@controller ~]# . admin-openrc
(2) 获取镜像
[root@controller ~]# wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img[/code](3) 上传镜像到Image service
使用QCOW2硬盘格式. public可视, 从而所有project可以看到它.[root@controller ~]# openstack image create "cirros" \ --file cirros-0.3.4-x86_64-disk.img \ --disk-format qcow2 --container-format bare \ --public +------------------+------------------------------------------------------+ | Field | Value | +------------------+------------------------------------------------------+ | checksum | ee1eca47dc88f4879d8a229cc70a07c6 | | container_format | bare | | created_at | 2016-08-01T11:26:58Z | | disk_format | qcow2 | | file | /v2/images/57d1498f-cbd2-4314-9114-6f74c11d5952/file | | id | 57d1498f-cbd2-4314-9114-6f74c11d5952 | | min_disk | 0 | | min_ram | 0 | | name | cirros | | owner | f8207344afbc4983837fccd7ad29c3d7 | | protected | False | | schema | /v2/schemas/image | | size | 13287936 | | status | active | | tags | | | updated_at | 2016-08-01T11:26:59Z | | virtual_size | None | | visibility | public | +------------------+------------------------------------------------------+(4) 查看现有镜像
[root@controller ~]# openstack image list +--------------------------------------+--------+--------+ | ID | Name | Status | +--------------------------------------+--------+--------+ | 38047887-61a7-41ea-9b49-27987d5e8bb9 | cirros | active | +--------------------------------------+--------+--------+参考文献
OpenStack Installation Guide for Red Hat Enterprise Linux and CentOS
OpenStack Mitaka 安裝 for CentOS — Kyle.Bai
OpenStack Liberty
相关文章推荐
- <手动安装Openstack Mikita>之(四) Nova安装
- <手动安装Openstack Mikita>之(二) Keystone安装
- <手动安装Openstack Mikita>之(五) Horizon安装
- 手动安装liberty版本openstack环境(allinone)---安装glance
- 简易手动部署多节点的Openstack(L版)——叁(安装Glance服务)
- Centos7手动部署Openstack Mitaka版安装配置--(四)安装镜像服务glance
- Centos0S7手动安装OpenStack Pike版--(glance)
- 四、OpenStack Glance安装 推荐
- [OpenStack] OpenStack Essex - Glance 安装部署与命令行详解
- <转载>Mac OS 安装oracle client
- OpenStack 高可用性解决方案手动安装指南(三)
- OpenStack云计算入门指南——<br/>2.安装和配置
- OpenStack 安装部署手册——<br/>3.安装假设
- <转>Ubuntu 10.04 安装配置手记
- 在ubuntu 12.04 上安装openstack 的glance服务问题
- OpenStack 高可用性解决方案手动安装指南(一)
- <perl> 安装与配置
- [OpenStack] OpenStack ESSEX 全新手动安装,动手,实践,出真知!
- <转载>在Win7下硬盘安装ubuntu9.10方法小结
- CentOS6.2下一步一步源代码安装OpenStack(四)glance配置、运行、测试