一、glance介绍:
-
如果要安装的系统多了效率就很低
-
时间长,工作量大
-
安装完还要进行手工配置,比如安装其他的软件,设置 IP 等
-
备份和恢复系统不灵活
-
先手工安装好这么一个虚机
-
然后对虚机执行 snapshot,这样就得到了一个 image
-
当有新员工入职需要办公环境时,立马启动一个或多个该 image 的 instance(虚机)就可以了
-
提供 REST API 让用户能够查询和获取 image 的元数据和 image 本身
-
支持多种方式存储 image,包括普通的文件系统、Swift、Amazon S3 等
-
对 Instance 执行 Snapshot 创建新的 image
glance-api
glance-registry
Database
Store backend
-
A directory on a local file system(这是默认配置)
-
GridFS
-
Ceph RBD
-
Amazon S3
-
Sheepdog
-
OpenStack Block Storage (Cinder)
-
OpenStack Object Storage (Swift)
-
VMware ESX
二、glance创建镜像:
一、建立glance数据库并且给权限设置第三方登录
mysql -uroot -p0330
CREATE DATABASE glance;
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' \ IDENTIFIED BY 'GLANCE_DBPASS';
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' \ IDENTIFIED BY 'GLANCE_DBPASS';
二、部署glance
①宣告环境变量
source openrc或 . openrc
②创建glance用户
openstack user create --domain default --password=glance glance
③将项目service中的用户glance设置为admin角色
openstack role add --project service --user glance admin
④创建glance服务
openstack service create --name glance \ --description "OpenStack Image" image
⑤创建服务端点(RegionOne是一个域)
openstack endpoint create --region RegionOne \ image public http://controller:9292
openstack endpoint create --region RegionOne \ image internal http://controller:9292
openstack endpoint create --region RegionOne \ image admin http://controller:9292
三、安装glance镜像服务,并编辑配置文件
①安装
yum install openstack-glance
②先复制再编辑配置文件(复制和无需更改)
cp /etc/glance/glance-api.conf /etc/glance/glance-api.conf.bak
cp /etc/glance/glance-registry.conf /etc/glance/glance-registry.conf.bak
[DEFAULT] [glance_store] stores = file,http default_store = file filesystem_store_datadir = /var/lib/glance/images/ [image_format] [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 [matchmaker_redis] [oslo_concurrency] [oslo_messaging_amqp] [oslo_messaging_kafka] [oslo_messaging_notifications] [oslo_messaging_rabbit] [oslo_messaging_zmq] [oslo_middleware] [oslo_policy] [paste_deploy] flavor = keystone [profiler] [store_type_location_strategy] [task] [taskflow_executor]
[DEFAULT] [database] connection = mysql+pymysql://glance:GLANCE_DBPASS@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 [matchmaker_redis] [oslo_messaging_amqp] [oslo_messaging_kafka] [oslo_messaging_notifications] [oslo_messaging_rabbit] [oslo_messaging_zmq] [oslo_policy] [paste_deploy] flavor = keystone [profiler]