在CentOS下部署Openstack-安装Glance组件(提供镜像服务)

安装

1
yum install -y openstack-glance

创建数据库并授权

1
2
3
mysql -uroot –p
CREATE DATABASE glance;
GRANT ALL PRIVILEGES ON glance.* TO'glance'@'192.168.0.0/255.255.0.0' IDENTIFIED BY 'glance';

配置数据库及rabbitmq

修改配置文件:

1
2
openstack-config --set /etc/glance/glance-api.conf database \ connection mysql://glance:glance@192.168.1.103/glance 
openstack-config --set /etc/glance/glance-registry.conf database \ connection mysql://glance:glance@192.168.1.103/glance

导入数据库

1
glance-manage db_sync


导入数据库完成后需要启动api服务,否则可能api服务无法启动

1
service openstack-glance-api start

配置验证信息

修改配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_uri http://192.168.1.103:5000 
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_host openstack
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_port 35357
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_protocol http
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_tenant_name service
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_user admin
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_password admin
openstack-config --set /etc/glance/glance-api.conf paste_deploy flavor keystone
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_uri http://192.168.1.103:5000
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_host openstack openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_port 35357
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_protocol http
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_tenant_name service
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_user admin
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_password admin
openstack-config --set /etc/glance/glance-registry.conf paste_deploy flavor keystone

创建glance标识服务

1
keystone service-create --name=glance --type=image --description="OpenStackImage Service"

创建Glance API接口URL

1
2
3
4
5
keystone endpoint-create \ 
--service-id=$(keystone service-list | awk '/ image / {print$2}') \
--publicurl=http://192.168.1.103:9292 \
--internalurl=http://192.168.1.103:9292 \
--adminurl=http://192.168.1.103:9292

启动glance服务并添加到开机启动项

注意查看有没有报错

1
2
3
4
service openstack-glance-api restart 
service openstack-glance-registry restart
chkconfig openstack-glance-api on
chkconfig openstack-glance-registry on

上传测试镜像

1
2
3
wget http://download.cirros-cloud.net/0.3.2/cirros-0.3.2-x86_64-disk.img
glance image-create --name "cirros-0.3.2-x86_64" --disk-format qcow2 \
--container-format bare --is-public True --progress < cirros-0.3.2-x86_64-disk.img


1
glance index

本文作者:Qiu Qingyu
版权声明:本博客所有文章除特别声明外,均采用CC BY-NC-SA 3.0 CN许可协议。转载请注明出处!
本文永久链接:http://qiuqingyu.cn/2015/12/12/在CentOS下部署Openstack-安装Glance组件(提供镜像服务)/