首先登录controller1创建glance数据库,并赋于远程和本地访问的权限。
 
 
 mysql -u root -p
 
CREATE DATABASE glance;
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost'  IDENTIFIED BY 'venic8888';
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%'  IDENTIFIED BY 'venic8888';
flush PRIVILEGES;
 
二、身份认证调用创建
只在controller1一台上执行即可
 
source admin-openrc.sh
创建glance用户的密码,我统一配glance
openstack user create --domain default --password-prompt glance
User Password:
Repeat User Password:
+-----------+----------------------------------+
| Field     | Value                            |
+-----------+----------------------------------+
| domain_id | default                          |
| enabled   | True                             |
| id        | e38230eeff474607805b596c91fa15d9 |
| name      | glance                           |
+-----------+----------------------------------+
 
openstack role add --project service --user glance admin
 
 openstack service create --name glance --description "OpenStack Image service" image
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Image service          |
| enabled     | True                             |
| id          | 8c2c7f1b9b5049ea9e63757b5533e6d2 |
| name        | glance                           |
| type        | image                            |
+-------------+----------------------------------+
 
openstack endpoint create --region RegionOne image public http://controller:9292
 
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 340be3625e9b4239a6415d034e98aace |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 8c2c7f1b9b5049ea9e63757b5533e6d2 |
| service_name | glance                           |
| service_type | image                            |
| url          | http://controller:9292           |
+--------------+----------------------------------+
 
 openstack endpoint create --region RegionOne image internal http://controller:9292
 
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | a6e4b153c2ae4c919eccfdbb7dceb5d2 |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 8c2c7f1b9b5049ea9e63757b5533e6d2 |
| service_name | glance                           |
| service_type | image                            |
| url          | http://controller:9292           |
+--------------+----------------------------------+
 
 openstack endpoint create --region RegionOne image admin http://controller:9292
 
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 0c37ed58103f4300a84ff125a539032d |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 8c2c7f1b9b5049ea9e63757b5533e6d2 |
| service_name | glance                           |
| service_type | image                            |
| url          | http://controller:9292           |
+--------------+----------------------------------+
 
三、下载安装glance组件
2台controller
 
 yum install openstack-glance python-glance python-glanceclient -y
 
2台controller修改配置api文件
vi /etc/glance/glance-api.conf
 
[DEFAULT]
notification_driver = noop
verbose = True
rpc_backend = rabbit
#针对IP配置
bind_host = 10.40.42.1
bind_port = 9292   
#如果这里不声明注册IP,它调用本地的注册时使用的是127.0.0.1的IP,跟glance-registry.conf不同,那个是外部调用,所以这两个地方都要配,不然会报http 500错误
registry_host=10.40.42.10
registry_port=9191
 
[database]
connection = mysql://glance:venic8888@controller/glance
 
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = glance
password = glance
 
[paste_deploy]
flavor = keystone
 
[glance_store]
default_store = file
filesystem_store_datadir = /home/local/glance/images/
 
[oslo_messaging_rabbit]
rabbit_host=controller
rabbit_userid = openstack
rabbit_password = openstack
rabbit_retry_interval=1
rabbit_retry_backoff=2
rabbit_max_retries=0
rabbit_durable_queues=true
rabbit_ha_queues=true
 
 
配置完成后,两台controller需要创建目录
mkdir -p /home/local/glance/images/
chown -R glance:glance /home/local/glance
 
 
两台controller修改配置registry文件
 
vi /etc/glance/glance-registry.conf
 
[DEFAULT]
notification_driver = noop
verbose = True
rpc_backend = rabbit
bind_host = 10.40.42.1
bind_port = 9191
 
[database]
connection = mysql://glance:venic8888@controller/glance
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = glance
password = glance
 
[paste_deploy]
flavor = keystone
 
[oslo_messaging_rabbit]
rabbit_host=controller
rabbit_userid = openstack
rabbit_password = openstack
rabbit_retry_interval=1
rabbit_retry_backoff=2
rabbit_max_retries=0
rabbit_durable_queues=true
rabbit_ha_queues=true
 
 
其中一台controller同步数据库
su -s /bin/sh -c "glance-manage db_sync" glance
 
2台controller都启动服务,加入开机自启
# systemctl enable openstack-glance-api.service  openstack-glance-registry.service
# systemctl start openstack-glance-api.service  openstack-glance-registry.service
 
TIPS:是否要使用rabiitmq队列呢?官网没有提到配置,这里我测试加了但没有功能影响,这是一个纯属个人行为的验证
验证,查看haproxy工作是否正常。
在其中带有VIP的controller上创建一个镜像,介时镜像包会放置在主用的controller的/home/local/glance/images/下,另外2台没有。
echo "export OS_IMAGE_API_VERSION=2" | tee -a admin-openrc.sh demo-openrc.sh
 
source admin-openrc.sh
 
 
 glance image-create --name "cirros" \
  --file cirros-0.3.4-x86_64-disk.img \
  --disk-format qcow2 --container-format bare \
  --visibility public --progress
[=============================>] 100%
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | 133eae9fb1c98f45894a4e60d8736619     |
| container_format | bare                                 |
| created_at       | 2015-03-26T16:52:10Z                 |
| disk_format      | qcow2                                |
| id               | 38047887-61a7-41ea-9b49-27987d5e8bb9 |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | cirros                               |
| owner            | ae7a98326b9c455588edd2656d723b9d     |
| protected        | False                                |
| size             | 13200896                             |
| status           | active                               |
| tags             | []                                   |
| updated_at       | 2015-03-26T16:52:10Z                 |
| virtual_size     | None                                 |
| visibility       | public                               |
+------------------+--------------------------------------+
 
验证镜像文件是否存在,以备后续调用

glance image-list
 

openstack私有云布署实践【9.2 Glance镜像管理(办公网环境)】的更多相关文章

  1. openstack私有云布署实践【7.2 keystone + memcache (办公网环境)】

    首先登录controller1创建keystone数据库,并赋于远程和本地访问的权限.   mysql -u root -p CREATE DATABASE keystone; GRANT ALL P ...

  2. openstack私有云布署实践【2 安装前的服务器基本环境准备】

    服务器物理机都安装centos7.2 1511版本 , 此次采用的分区方式全是自动XFS格式LVM,在装系统时就将所有本地raid5硬盘都加入LVM全用了.默认/home目录有着最大的硬盘空间 并且我 ...

  3. openstack私有云布署实践【7.1 keystone + memcache (科兴环境)】

    其实登录数据库集群中任意1台都可以创建库,它们会实时自动同步数据库和对应的数据库权限.   首先登录kxcontroller1创建kx_keystone数据库,并赋于远程和本地访问的权限.   mys ...

  4. openstack私有云布署实践【12.2 网络Neutron-controller节点配置(办公网环境)】

    网络这一块推荐使用的是 Neutron--LinuxBirdge的Ha高可用,此高可用方案对Public作用不是很大,Public只用到DHCP,而Private则会用到L3 Agent,则此方案是有 ...

  5. openstack私有云布署实践【12.1 网络Neutron-controller节点配置(科兴环境)】

    网络这一块推荐使用的是 Neutron--LinuxBirdge的Ha高可用,此高可用方案对Public作用不是很大,Public只用到DHCP,而Private则会用到L3 Agent,则此方案是有 ...

  6. openstack私有云布署实践【0 前言】

    管理控制层面示图: 其实在修改这个布署文档是,我发现当时生产中的布署已经严重偏离了openstack高可用的指导思想.我们自己实践的高可用其实是适应自己的架构而做的调整,因为我们现实手头上中没有比较符 ...

  7. openstack私有云布署实践【15 创建租户网络+实例】

    这里以办公网测试环境为例,   (一)创建租户demo的网络   使用admin用户 source admin-openrc.sh 创建public公网 neutron net-create 1040 ...

  8. openstack私有云布署实践【9.3 主从controller单向同步glance-image目录】

    采用Rysnc单向同步,而不用双方实时同步,原因是在历史的运行过程中,我们发现,有些镜像包太大,当在主用的glance将镜像保存时,并不是一时半会就把镜像保存好,当主用在保存时,备用节点又在实时同步那 ...

  9. openstack私有云布署实践【9.1 Glance镜像管理(科兴环境)】

    首先登录kxcontroller1创建kx_glance数据库,并赋于远程和本地访问的权限.      mysql -u root -p   CREATE DATABASE kx_glance; GR ...

随机推荐

  1. html5跨域数据传递(postMessage)

    在html5中有个支持跨域传递的方法postMessage,可是实现iframe之间的数据传递! 代码如下:数据发送页面 <!DOCTYPE HTML> <html lang=&qu ...

  2. Newtonsoft.Json 将C#对象转化为json格式

    object To json public static string ObjectToJson(object obj) { JsonSerializerSettings jss = new Json ...

  3. 【转】Android折叠效果实现案例

    源文:http://mobile.51cto.com/abased-401983.htm 为了使界面的效果更加绚丽,体验效果更佳,往往需要开发者们自行开发新的界面效果,在这里,我将奉上各种实现折叠效果 ...

  4. navigator获取参数

    <script type="text/javascript" language="javascript"> document.write(" ...

  5. [翻译]用Dart塑造Android未来

    明天回家,今天下午瞅时间翻译了Cyril Mottier的另外一篇有关Android前景的文章. 原谅地址是:http://cyrilmottier.com/2014/06/12/shaping-th ...

  6. 2008技术内幕:T-SQL语言基础

    2008技术内幕:T-SQL语言基础 单表查询摘记 这里的摘抄来自<Microsoft SQL Server 2008技术内幕:T-SQL语言基础>,书中用到的案例数据库是这个 TSQLF ...

  7. iOS基础 - iOS程序启动原理

    一.UIApplicationMain 在main.m的main函数中执行了UIApplicationMain这个方法,这是ios程序的入口点 int UIApplicationMain(int ar ...

  8. 领域模型中分散的事务如何集中统一处理(C#解决方案)

    领域模型中分散的事务如何集中统一处理(C#解决方案)   开篇 什么是事务,事务的应用场景 做项目时,经常会遇到一些需求,比如注册用户时,要求同时存入用户的基本信息和初始化该用户的帐户,如果在这两个环 ...

  9. 推荐系列:最小与最大[DP+余式定理]

    最小与最大 [问题描述] 做过了乘积最大这道题,相信这道题也难不倒你. 已知一个数串,可以在适当的位置加入乘号(设加了k个,当然也可不加,即分成k+1个部分),设这k+1个部分的乘积(如果k=0,则乘 ...

  10. 包图Package

    [UML]UML系列——包图Package 系列文章 [UML]UML系列——用例图Use Case       [UML]UML系列——用例图中的各种关系(include.extend)       ...