OpenStack中的Glance是镜像服务,能够提供发现、注册并查询虚拟机镜像,也是Openstack的一个组件或者说项目之一。镜像服务提供了一个Rest API的方式。 OpenStack的Glance镜像可以存放在本地文件系统,也可以存放在OpenStack的对象存储上。默认情况下是本地文件,存放在/var/lib/glance/images/目录下。
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@10.0.0.0.20/glance
glance-registry.conf[root@linux-node1 ~]# vim /etc/glance/glance-registry.conf[database]connection= mysql+pymysql://glance:glance@10.0.0.0.20/glance
3.设置Keystone[root@linux-node1 ~]# vim /etc/glance/glance-api.conf[keystone_authtoken]auth_uri = http://10.0.0.0.20:5000auth_url = http://10.0.0.0.20:35357memcached_servers = 10.0.0.0.20:11211auth_type = passwordproject_domain_name = defaultuser_domain_name = defaultproject_name = serviceusername = glancepassword = glance[paste_deploy]flavor=keystone
glance-registry.conf配置[root@linux-node1 ~]# vim /etc/glance/glance-registry.conf[keystone_authtoken]auth_uri = http://10.0.0.0.20:5000auth_url = http://10.0.0.0.20:35357memcached_servers = 10.0.0.0.20:11211auth_type = passwordproject_domain_name = defaultuser_domain_name = defaultproject_name = serviceusername = glancepassword = glance[paste_deploy]flavor=keystone
4.设置Glance镜像存储[root@linux-node1 ~]# vim /etc/glance/glance-api.conf[glance_store]stores = file,httpdefault_store=filefilesystem_store_datadir=/var/lib/glance/images/
5.同步数据库[root@linux-node1 ~]# su -s /bin/sh -c "glance-manage db_sync" glance
6.启动Glance服务# systemctl enable openstack-glance-api.service# systemctl enable openstack-glance-registry.service# systemctl start openstack-glance-api.service# systemctl start openstack-glance-registry.service
7.Glance服务注册 想要让别的服务可以使用Glance,就需要在Keystone上完成服务的注册。[root@linux-node1 ~]# source admin-openstack.sh# openstack service create --name glance --description "OpenStack Image service" image# openstack endpoint create --region RegionOne image public http://10.0.0.0.20:9292# openstack endpoint create --region RegionOne image internal http://10.0.0.0.20:9292# openstack endpoint create --region RegionOne image admin http://10.0.0.0.20:9292
8.Glance镜像 在刚开始实施OpenStack平台阶段,如果没有制作镜像。可以使用一个实验的镜像进行测试,这是一个小的Linux系统。[root@linux-node1 ~]# cd /usr/local/src[root@linux-node1 src]# wget http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.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 |+--------------------------------------+--------+--------+
继续关注,后续持续更新......
目前10000+人已关注加入我们