OpenStack 学习笔记(四):OpenStack glance服务搭建
2016-06-13 18:18
453 查看
[b][b]——先决条件[/b][/b]
1.)创建数据库
[b]——glance服务搭建配置[/b]
6.)安装glance
7.)配置glance
8.) 同步数据库
9.) Start glance service
10.)校验操作
10.1)Download the source image
10.2)Upload the image to the Image service
1.)创建数据库
MariaDB [(none)]> CREATE DATABASE glance; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> GRANT ALL ON glance.* TO 'glance'@'%' IDENTIFIED BY 'glance'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> GRANT ALL ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'glance'; Query OK, 0 rows affected (0.00 sec)2.) create glance user
[root@openstack ~]# openstack user create --domain default --password glance glance +-----------+----------------------------------+ | Field | Value | +-----------+----------------------------------+ | domain_id | 505647f0f06e408e9d176da82a6684f1 | | enabled | True | | id | fa8739bf463a40e5a1945c700c16b8a8 | | name | glance | +-----------+----------------------------------+3.) Add the admin role to the glance user and service project
[root@openstack ~]# openstack role add --project service --user glance admin4.) create image service
[root@openstack ~]# openstack service create --name glance --description "OpenStack Image" image +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | OpenStack Image | | enabled | True | | id | e67a6d01628149b897be0a7795feb10a | | name | glance | | type | image | +-------------+----------------------------------+5.)Create the Image service API endpoints
[root@openstack ~]# openstack endpoint create --region RegionOne image public http://192.168.100.120:9292 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 68c611cc0add4c178b7f1d58df0843af | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | e67a6d01628149b897be0a7795feb10a | | service_name | glance | | service_type | image | | url | http://192.168.100.120:9292 | +--------------+----------------------------------+ [root@openstack ~]# openstack endpoint create --region RegionOne image internal http://192.168.100.120:9292 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 716335ae9a8f46f9b9b175ae7e381aa9 | | interface | internal | | region | RegionOne | | region_id | RegionOne | | service_id | e67a6d01628149b897be0a7795feb10a | | service_name | glance | | service_type | image | | url | http://192.168.100.120:9292 | +--------------+----------------------------------+ [root@openstack ~]# openstack endpoint create --region RegionOne image admin http://192.168.100.120:9292 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | b92d362f5d0d49d0a78cbc3ea3ed63f1 | | interface | admin | | region | RegionOne | | region_id | RegionOne | | service_id | e67a6d01628149b897be0a7795feb10a | | service_name | glance | | service_type | image | | url | http://192.168.100.120:9292 | +--------------+----------------------------------+
[b]——glance服务搭建配置[/b]
6.)安装glance
[root@openstack ~]# yum -y install openstack-glance python-glanceclient python-crypto
7.)配置glance
[root@openstack ~]# cp /etc/glance/glance-api.conf /etc/glance/glance-api.conf.bak [root@openstack ~]# cp /etc/glance/glance-registry.conf /etc/glance/glance-registry.conf.bak [root@openstack ~]# vim /etc/glance/glance-api.conf 1: [DEFAULT] 378: debug = true 405: log_file = /var/log/glance/glance-api.log 618: [database] 641: connection = mysql://glance:glance@localhost:3306/glance 741: stores = file,http 746: default_store = file 1025: filesystem_store_datadir = /var/lib/glance/images 1111: [keystone_authtoken] 1112: auth_uri = http://192.168.100.120:5000 1113: auth_url = http://192.168.100.120:35357 1114: memcached_servers = 192.168.100.120:11211 1115: auth_type = password 1116: project_domain_name = default 1117: user_domain_name = default 1118: project_name = service 1119: username = glance 1120: password = glance 1696: flavor = keystone [root@openstack ~]# vim /etc/glance/glance-registry.conf 1: [DEFAULT] 179: debug = true 206: log_file = /var/log/glance/glance-registry.log 359: [database] 382: connection = mysql://glance:glance@localhost:3306/glance 836: [keystone_authtoken] 837: auth_uri = http://192.168.100.120:5000 838: auth_url = http://192.168.100.120:35357 839: memcached_servers = 192.168.100.120:11211 840: auth_type = password 841: project_domain_name = default 842: user_domain_name = default 843: project_name = service 844: username = glance 845: password = glance 1402: flavor = keystone
8.) 同步数据库
[root@openstack ~]# glance-manage db_sync [root@openstack ~]# mysql -uglance -pglance -e 'use 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 | +----------------------------------+
9.) Start glance service
[root@openstack ~]# chown -R glance:glance /var/log/glance [root@openstack ~]# systemctl enable openstack-glance-api.service openstack-glance-registry.service [root@openstack ~]# systemctl start openstack-glance-api.service openstack-glance-registry.service [root@openstack ~]# systemctl status openstack-glance-api.service openstack-glance-registry.service [root@openstack ~]]# netstat -antup|egrep '9191|9292'|grep LISTEN tcp 0 0 0.0.0.0:9292 0.0.0.0:* LISTEN 5529/python2 tcp 0 0 0.0.0.0:9191 0.0.0.0:* LISTEN 5530/python2
10.)校验操作
10.1)Download the source image
[root@openstack ~]# wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img -P /soft
10.2)Upload the image to the Image service
[root@openstack ~]# openstack image create "cirros-0.3.4-x86_64" \ --file /soft/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-05-26T06:03:52Z | | disk_format | qcow2 | | file | /v2/images/138d731b-0372-4237-9187-62f7885ac147/file | | id | 138d731b-0372-4237-9187-62f7885ac147 | | min_disk | 0 | | min_ram | 0 | | name | cirros-0.3.4-x86_64 | | owner | e4f62edc6ed547109768b515be56044a | | protected | False | | schema | /v2/schemas/image | | size | 13287936 | | status | active | | tags | | | updated_at | 2016-05-26T06:03:52Z | | virtual_size | None | | visibility | public | +------------------+------------------------------------------------------+ [root@openstack ~]# openstack image list +--------------------------------------+---------------------+--------+ | ID | Name | Status | +--------------------------------------+---------------------+--------+ | 138d731b-0372-4237-9187-62f7885ac147 | cirros-0.3.4-x86_64 | active | +--------------------------------------+---------------------+--------+
相关文章推荐
- 如何在 Ubuntu 和其他 Linux 发行版中启动、停止和重启服务
- linux
- openstack kilo-with-dokcer
- 安全帐户管理器初始化失败:目录服务无法启动,错误状态 0xc00002e1 lsass.exe
- 将批处理文件注册成服务在系统启动的时候自动调用
- 全球路由DNS服务器
- 什么是OpenStack 开源的云计算管理平台项目
- 用sc删除mysql服务技巧
- Powershell获取系统中所有可停止的服务
- 在同一台机器上运行多个 MySQL 服务
- C语言实现在windows服务中新建进程的方法
- jQuery Ajax调用WCF服务详细教程
- 深入剖析哪些服务是Oracle 11g必须开启的
- Oracle监听器服务不能启动的解决方法
- VBS实现查询服务的制造商
- Android编程获取系统隐藏服务实现锁屏的方法
- C#检查Windows是否安装了某个服务的方法
- 使用批处理实现启动和停止服务的代码分析(net start&net stop)
- 运行iis提示服务没有及时响应启动或控制请求的解决方法
- windows中允许服务与桌面交互的更改方法示例