一、部署Glance

  1、Glance 安装 

  [root@linux-node1 ~]#yum install openstack-glance python-glance python-glanceclient -y

  2、配置:修改glance-api和glance-registry的配置文件,同步数据库  

[root@linux-node1 ~]# vi /etc/glance/glance-api.conf
[database]
connection = mysql://glance:glance@172.22.0.218/glance
[root@linux-node1 ~]# vi /etc/glance/glance-registry.conf
[database]
connection = mysql://glance:glance@172.22.0.218/glance

  3、同步数据库并检查数据库:  

[root@linux-node1 ~]# su -s /bin/sh -c "glance-manage db_sync" glance
检查导入glance库的表情况:
MariaDB [(none)]> use glance
Database changed
MariaDB [glance]>
MariaDB [glance]> show tables;
+----------------------------------+
| Tables_in_glance |
+----------------------------------+
| artifact_blob_locations |
| artifact_blobs |
| artifact_dependencies |
| artifact_properties |
| artifact_tags |
| artifacts |
| image_locations |
| image_members |
| image_properties |
| image_tags |
| images |
| metadef_namespace_resource_types |
| metadef_namespaces |
| metadef_objects |
| metadef_properties |
| metadef_resource_types |
| metadef_tags |
| migrate_version |
| task_info |
| tasks |
+----------------------------------+
rows in set (0.00 sec)

  4、配置glance连接keystone,对于keystone,每个服务都要有一个用户连接keystone

[root@linux-node1 ~]# source admin-openrc.sh
[root@linux-node1 ~]# openstack user create --domain default --password=glance glance
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | d21d0715890447fb87f72e85dce6d4be |
| enabled | True |
| id | add8d7512b3a4af78236d75e5154978e |
| name | glance |
| password_expires_at | None |
+---------------------+----------------------------------+
[root@linux-node1 ~]# openstack role add --project service --user glance admin

  5、修改glance-api配置文件,结合keystone和mysql  

[root@linux-node1 ~]# vi /etc/glance/glance-api.conf
verbose = true
[keystone_authtoken]
auth_uri = http://172.22.0.218:5000
auth_url = http://172.22.0.218:35357
auth_plugin = password
project_domain_id = d21d0715890447fb87f72e85dce6d4be
user_domain_id = d21d0715890447fb87f72e85dce6d4be
project_name = service
username = glance
password = glance
[paste_deploy]
flavor = keystone
[oslo_messaging_notifications]
# The Drivers(s) to handle sending notifications. Possible values are messaging,
# messagingv2, routing, log, test, noop (multi valued)
# Deprecated group/name - [DEFAULT]/notification_driver
driver = noop
[glance_store]
default_store = file
filesystem_store_datadir = /var/lib/glance/images

  6、修改glance-registry配置文件,结合keystone和mysql

[root@linux-node1 ~]# vi /etc/glance/glance-registry.conf
verbose=True
[oslo_messaging_notifications]
# The Drivers(s) to handle sending notifications. Possible values are messaging,
# messagingv2, routing, log, test, noop (multi valued)
# Deprecated group/name - [DEFAULT]/notification_driver
driver = noop
[keystone_authtoken]
auth_uri = http://172.22.0.218:5000
auth_url = http://172.22.0.218:35357
auth_plugin = password
project_domain_id = d21d0715890447fb87f72e85dce6d4be
user_domain_id = d21d0715890447fb87f72e85dce6d4be
project_name = service
username = glance
password = glance
[paste_deploy]
flavor = keystone

  7、配置检查:

[root@linux-node1 ~]# grep -n '^[a-z]' /etc/glance/glance-api.conf
:verbose = true
:connection = mysql://glance:glance@172.22.0.218/glance
:default_store = file
:filesystem_store_datadir = /var/lib/glance/images
:auth_uri = http://172.22.0.218:5000
:auth_url = http://172.22.0.218:35357
:auth_plugin = password
:project_domain_id = d21d0715890447fb87f72e85dce6d4be
:user_domain_id = d21d0715890447fb87f72e85dce6d4be
:project_name = service
:username = glance
:password = glance
:driver = noop
:flavor = keystone
[root@linux-node1 ~]# grep -n '^[a-z]' /etc/glance/glance-registry.conf
:connection = mysql://glance:glance@172.22.0.218/glance
:auth_uri = http://172.22.0.218:5000
:auth_url = http://172.22.0.218:35357
:auth_plugin = password
:project_domain_id = d21d0715890447fb87f72e85dce6d4be
:user_domain_id = d21d0715890447fb87f72e85dce6d4be
:project_name = service
:username = glance
:password = glance
:driver = noop
:flavor = keystone

二、启动glance

  1、设置开机启动并启动glance服务检查服务:

[root@linux-node1 ~]# systemctl enable openstack-glance-api
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-glance-api.service to /usr/lib/systemd/system/openstack-glance-api.service.
[root@linux-node1 ~]# systemctl enable openstack-glance-registry
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-glance-registry.service to /usr/lib/systemd/system/openstack-glance-registry.service.
查看galnce占用端口情况,其中9191是registry占用端口,9292是api占用端口
[root@linux-node1 ~]# netstat -lntup|egrep "9191|9292"
tcp 0.0.0.0: 0.0.0.0:* LISTEN /python2
tcp 0.0.0.0: 0.0.0.0:* LISTEN /python2
[root@linux-node1 ~]# ps aux | grep
glance 4.6 6.4 ? Ss : : /usr/bin/python2 /usr/bin/glance-api
root 0.0 0.0 pts/ R+ : : grep --color=auto
[root@linux-node1 ~]# ps aux | grep
glance 1.7 6.4 ? Ss : : /usr/bin/python2 /usr/bin/glance-registry
root 0.0 0.0 pts/ S+ : : grep --color=auto

  2、glance服务在keystone上注册,才可以允许其他服务调用glance  

[root@linux-node1 ~]# openstack service create --name glance --description "OpenStack Image service" image
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Image service |
| enabled | True |
| id | b08581e2a35a4ed982ddfac797050ae1 |
| name | glance |
| type | image |
+-------------+----------------------------------+
[root@linux-node1 ~]# openstack endpoint create --region RegionOne image public http://172.22.0.218:9292
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | af6c4a21691344d7adfd6ec3e2d3674e |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | b08581e2a35a4ed982ddfac797050ae1 |
| service_name | glance |
| service_type | image |
| url | http://172.22.0.218:9292 |
+--------------+----------------------------------+
[root@linux-node1 ~]# openstack endpoint create --region RegionOne image internal http://172.22.0.218:9292
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 2646c93f3cda442fb062887f6c510343 |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | b08581e2a35a4ed982ddfac797050ae1 |
| service_name | glance |
| service_type | image |
| url | http://172.22.0.218:9292 |
+--------------+----------------------------------+
[root@linux-node1 ~]# openstack endpoint create --region RegionOne image admin http://172.22.0.218:9292
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 5cc3112ed5944f04935805467ad36ec8 |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | b08581e2a35a4ed982ddfac797050ae1 |
| service_name | glance |
| service_type | image |
| url | http://172.22.0.218:9292 |
+--------------+----------------------------------+

  3、在admin和demo中加入glance的环境变量,告诉其他服务glance使用的环境变量,一定要在admin-openrc.sh的路径下执行  

[root@linux-node1 ~]# echo "export OS_IMAGE_API_VERSION=2" | tee -a admin-openrc.sh demo-openrc.sh
export OS_IMAGE_API_VERSION=
[root@linux-node1 ~]# tail - admin-openrc.sh
export OS_IMAGE_API_VERSION=
[root@linux-node1 ~]# tail - demo-openrc.sh
export OS_IMAGE_API_VERSION=

三、检查是否安装部署正确

  1、如果出现以下情况,表示glance配置成功,由于没有镜像,所以看不到

[root@linux-node1 ~]# glance image-list

+----+------+

| ID | Name |

+----+------+

+----+------+

  2、下载一个镜像:

[root@linux-node1 ~]#wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img

  3、上传镜像到glance,要在上一步所下载的镜像当前目录执行:

[root@linux-node1 ~]# glance image-create --name "cirros"   --file cirros-0.3.-x86_64-disk.img  --disk-format qcow2 --container-format bare  --visibility public --progress
[=============================>] %
+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| checksum | ee1eca47dc88f4879d8a229cc70a07c6 |
| container_format | bare |
| created_at | --06T03::50Z |
| disk_format | qcow2 |
| id | 8f5837b4-bbec-4ef5-96f6-aba989c27206 |
| min_disk | |
| min_ram | |
| name | cirros |
| owner | 503b0eab0420454e909a46e476bf1ede |
| protected | False |
| size | |
| status | active |
| tags | [] |
| updated_at | --06T03::50Z |
| virtual_size | None |
| visibility | public |
+------------------+--------------------------------------+

  4、查看上传镜像:  

[root@linux-node1 ~]# glance image-list
+--------------------------------------+--------+
| ID | Name |
+--------------------------------------+--------+
| 8f5837b4-bbec-4ef5-96f6-aba989c27206 | cirros |
+--------------------------------------+--------+
[root@linux-node1 ~]# cd /var/lib/glance/images/
[root@linux-node1 images]# ls
8f5837b4-bbec-4ef5-96f6-aba989c27206

完成部署!部署成功!

openstack安装newton版本Glance部署(二)的更多相关文章

  1. openstack安装newton版本keyston部署(一)

    一.部署环境:     两台centos7,  内存2G 控制计算节点: Hostname1:                    ip:172.22.0.218 计算节点及存储节点 Hostnam ...

  2. openstack安装newton版本Nova部署(三)

    一.控制节点安装部署Nova Nova 包含API(负责接收相应外部请求,支持OpenStackAPI,EC2API):cert:负责身份认证:schedule:用于云主机调度(虚拟机创建在哪台主机上 ...

  3. openstack安装newton版本neutron服务部署(四)

    一.管理节点部署服务: 1.安装neutron: [root@linux-node1 ~]# yum install openstack-neutron openstack-neutron-ml2 o ...

  4. openstack安装newton版本dashboard+cinder(六)

    一.dashboard 1.安装dashboard及配置 [root@linux-node1 ~]# yum install openstack-dashboard -y #可以装任何地方只要能连接 ...

  5. openstack安装newton版本创建虚拟机(五)

    一.创建网络: 1.在控制节点上创建一个单一扁平网络(名字:flat),网络类型为flat,网络适共享的(share),网络提供者:physnet1,它是和eth0关联起来的 [root@linux- ...

  6. 安装Newton版Glance

    Image Service 本文介绍在controller节点上安装.配置Image服务 glance,镜像存储在本地文件系统 安装准备 controller 节点 ip:192.168.81.11 ...

  7. OpenStack kilo版(4) Glance部署

    Glance简介 Glance-api:接受云系统镜像的构建.删除.读取请求 Glance-Registry:云系统的镜像注册服务 部署在controller节点 配置数据库 MariaDB [(no ...

  8. OpenStack Newton版本Ceph集成部署记录

    2017年2月,OpenStack Ocata版本正式release,就此记录上一版本 Newton 结合Ceph Jewel版的部署实践.宿主机操作系统为CentOS 7.2 . 初级版: 192. ...

  9. devstack安装openstack newton版本

    准备使用devstack安装openstack N版,搞一套开发环境出来.一连整了4天,遇到各种问题,各种错误,一直到第4天下午4点多才算完成. 在这个过程中感觉到使用devstack搭建openst ...

随机推荐

  1. c++类之间的关系

    我们知道,表达方式分为很多种,对于同一种事物,比如爱情,画家用图画和色彩表达爱恋:音乐家用音符和节奏表达喜爱之情,作家用文字表现爱慕. 而程序员怎么办? 程序员构建类,用类来表达单身之苦.因此,类就是 ...

  2. win32com操作word(1):几个重要的对象(28.35)

    Pywin32模块为python封装了操作windows底层API函数的功能.而win32com是Pywin32下面的一个模块,专门负责操作com组件. 由于office工具(Word.Excel等) ...

  3. 【MFC】动态创建CMFCToolbar图标不显示问题

    最近遇到一个问题,需要动态的从xml文件读取一系列图标文件,加载到一个toolbar中,由于使用的是vs2008 with sp1 feature pack,自然想到用CMFCToolbar来做,思路 ...

  4. codeforces 622E E. Ants in Leaves(贪心+dfs)

    题目链接: E. Ants in Leaves time limit per test 2 seconds memory limit per test 256 megabytes input stan ...

  5. 关于禁用bootstrap响应式解决方法

    前几天接到一个任务,用bootstrap框架写几个静态页面,由于长时间专注于后台开发,所以,花费了3天时间,才终于写完了页面,其中,来回的修改,把遇到的问题说一下. 用bootstarp做完页面后,组 ...

  6. About ListView

    这一篇整理一些ListView的基本知识. PartA翻译自API Guide: (A)API Guide 使用Adapter建立(bind)Layout 当layout内容是动态的或者不是预先决定好 ...

  7. dsu on tree(无讲解)

    CF741D. Arpa's letter-marked tree and Mehrdad's Dokhtar-kosh paths 分析: 最多有一个字符出现奇数次 维护某个状态下深度的最大值,注意 ...

  8. BZOJ1453:[WC]Dface双面棋盘

    浅谈树状数组与线段树:https://www.cnblogs.com/AKMer/p/9946944.html 题目传送门:https://lydsy.com/JudgeOnline/problem. ...

  9. Arduino 元件

    http://www.rs-online.com/designspark/electronics/

  10. WCF IIS部署

    创建WCFHost应用程序 Iservice.cs using System; using System.Collections.Generic; using System.Linq; using S ...