OpenStack Ocata 安装(三)安装镜像(Glance)服务

14、安装镜像(Glance)服务:

镜像服务(Glance)使用户能够发现、登记,并检索虚拟机映像。它提供了 REST API,使您可以查询虚拟机映像元数据和检索一个实际的形象。你可以存储虚拟机映像通过图像服务在不同的位置,从简单的 对象存储系统,如OpenStack对象存储文件系统。

 

创建该服务的数据库和数据库管理账户

controller#

mysql-u root -p123

 

CREATEDATABASE glance;

GRANTALL PRIVILEGES ON glance.* TO 'glance'@'localhost' \

IDENTIFIEDBY 'glance';

GRANTALL PRIVILEGES ON glance.* TO 'glance'@'%' \

IDENTIFIEDBY 'glance';

exit

 

创建用户、服务、API

controller#

openstack user create --domain default--password-prompt glance

需要输入密码:

 

openstack role add --project service --userglance admin

 

openstack service create --name glance \

--description "OpenStack Image"image

 

openstack endpoint create --regionRegionOne \

image public http://controller:9292

 

openstack endpoint create --regionRegionOne \

image internal http://controller:9292

 

openstack endpoint create --regionRegionOne \

image admin http://controller:9292

 

编辑配置文件(备份配置文件,删除配置文件里的所有数据,使用提供的配置):

controller#

cp /etc/glance/glance-api.conf/etc/glance/glance-api.conf.bak

vi /etc/glance/glance-api.conf

 

 

[database]

connection =mysql+pymysql://glance:glance@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 = glance

 

[paste_deploy]

flavor = keystone

 

[glance_store]

stores = file,http

default_store = file

filesystem_store_datadir = /var/lib/glance/images/

 

 

cp /etc/glance/glance-registry.conf /etc/glance/glance-registry.conf.bak

vi /etc/glance/glance-registry.conf

 

[database]

connection =mysql+pymysql://glance:glance@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 = glance

 

[paste_deploy]

flavor = keystone

 

 

同步数据库:

controller#

su -s /bin/sh -c "glance-managedb_sync" glance

 

开机自启动和启动服务

controller#

systemctl enableopenstack-glance-api.service \

openstack-glance-registry.service

 

systemctl restartopenstack-glance-api.service \

openstack-glance-registry.service

 

下载镜像(没有wget命令则yum安装):

wgethttp://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img

 

准备镜像且上传:

controller#

mv cirros-0.3.5-x86_64-disk.img/var/lib/glance/images/

 

cd /var/lib/glance/images/

 

openstack image create "cirros" \

--file cirros-0.3.5-x86_64-disk.img \

--disk-format qcow2 --container-format bare\

--public

 

查看已上传的镜像:

controller#

openstack image list

 

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值