(3)Glance

1.安装Glance

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

2.Glance数据库配置

Glance-api.conf

[root@linux-node1 ~]# vim /etc/glance/glance-api.conf
[database]
connection= mysql+pymysql://glance:glance@192.168.8.11/glance

glance-registry.conf

[root@linux-node1 ~]# vim /etc/glance/glance-registry.conf
[database]
connection= mysql+pymysql://glance:glance@192.168.8.11/glance

3.同步数据库

[root@linux-node1 ~]# su -s /bin/sh -c "glance-manage db_sync" glance
# mysql -h 192.168.8.11 -uglance -pglance -e 'use glance;show tables;'

4.设置Keystone

[root@linux-node1 ~]# vim /etc/glance/glance-api.conf
[keystone_authtoken]
auth_uri = http://192.168.8.11:5000
auth_url = http://192.168.8.11:35357
memcached_servers = 192.168.8.11:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = glance

[paste_deploy]
flavor=keystone

glance-registry.conf配置

[root@linux-node1 ~]# vim /etc/glance/glance-registry.conf
[keystone_authtoken]
auth_uri = http://192.168.8.11:5000
auth_url = http://192.168.8.11:35357
memcached_servers = 192.168.8.11:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = glance

[paste_deploy]
flavor=keystone

5.设置Glance镜像存储

[root@linux-node1 ~]# vim /etc/glance/glance-api.conf
[glance_store]
stores = file,http
default_store=file
filesystem_store_datadir=/var/lib/glance/images/

6.启动Glance服务

# systemctl enable openstack-glance-api.service openstack-glance-registry.service
# systemctl start openstack-glance-api.service openstack-glance-registry.service

7.Glance服务注册
想要让别的服务可以使用Glance,就需要在Keystone上完成服务的注册。注意需要先source一下admin的环境变量。

source admin-openstack.sh

openstack service create --name glance --description "OpenStack Image service" image
创建一个服务的名称叫做glance,类型是镜像

openstack endpoint create --region RegionOne   image public http://192.168.8.11:9292
openstack endpoint create --region RegionOne   image internal http://192.168.8.11:9292
openstack endpoint create --region RegionOne   image admin http://192.168.8.11:9292
创建glance的API endpoint端点

# openstack service list
查看服务
# openstack endpoint list
查看端点

8.测试Glance状态

[root@linux-node1 ~]# source admin-openstack.sh
[root@linux-node1 ~]# openstack --help | grep images
[root@linux-node1 ~]# openstack image list
[root@linux-node1 ~]# glance image-list

9.Glance镜像
在刚开始实施OpenStack平台阶段,如果没有制作镜像。可以使用一个实验的镜像进行测试,这是一个小的Linux系统。

[root@linux-node1 ~]# cd /usr/local/src
[root@linux-node1 src]# wget http://download.cirros-cloud.n ... k.img

[root@linux-node1 src]# openstack image create "cirros" --disk-format qcow2 \
--container-format bare --file cirros-0.3.5-x86_64-disk.img --public
[root@linux-node1 src]# openstack image list
+--------------------------------------+--------+--------+
| ID                                   | Name   | Status |
+--------------------------------------+--------+--------+
| cf154a84-a73a-451b-bcb3-83c98e7c0d3e | cirros | active |
+--------------------------------------+--------+--------+

 

未经允许不得转载:Linux备忘录 » (3)Glance

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值