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.56.11/glance
glance-registry.conf
[root@linux-node1 ~]# vim /etc/glance/glance-registry.conf
[database]
connection= mysql+pymysql://glance:glance@192.168.56.11/glance
3.设置Keystone
[root@linux-node1 ~]# vim /etc/glance/glance-api.conf
[keystone_authtoken]
auth_uri = http://192.168.56.11:5000
auth_url = http://192.168.56.11:35357
memcached_servers = 192.168.56.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.56.11:5000
auth_url = http://192.168.56.11:35357
memcached_servers = 192.168.56.11:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = glance
[paste_deploy]
flavor=keystone
4.设置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/
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上完成服务的注册。注意需要先source一下admin的环境变量。
[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://192.168.56.11:9292
# openstack endpoint create --region RegionOne image internal http://192.168.56.11:9292
# openstack endpoint create --region RegionOne image admin http://192.168.56.11:9292
8.测试Glance状态
[root@linux-node1 ~]# source admin-openstack.sh
[root@linux-node1 ~]# openstack 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 |
+--------------------------------------+--------+--------+
转载请注明:IT运维空间 » 虚拟化 » 基于OpenStack构建企业私有云(3)Glance配置搭建
发表评论