继安装部署OpenStack(二)
四、配置image(镜像)服务
镜像服务包含以下2个组件
glance-api:接受对镜像发现、检索、存储的API调用
glance-registry:存储,处理,检索镜像的metadate(源数据:大小、类型等)
安装镜像服务(控制节点)
# yum install openstack-glance python-glanceclient
更新2个组件的配置文件中的数据库连接
# openstack-config --set /etc/glance/glance-api.conf database connection mysql://glance:GLANCE_DBPASS@controller/glance # openstack-config --set /etc/glance/glance-registry.conf database \connection mysql:// glance:GLANCE_DBPASS@controller/glance
使用root登陆mysql,创建数据库,赋予glance用户权限
$ mysql -u root -p mysql> CREATE DATABASE glance; mysql> GRANT ALL PRIVILEGES ON glance.* TO ‘glance‘@‘localhost‘ IDENTIFIED BY ‘GLANCE_DBPASS‘; mysql> GRANT ALL PRIVILEGES ON glance.* TO ‘glance‘@‘%‘ IDENTIFIED BY ‘GLANCE_DBPASS‘;
为image服务创建表
# su -s /bin/sh -c "glance-manage db_sync" glance 创建glance用户,赋予service容器和admin角色 $ keystone user-create --name=glance --pass=GLANCE_PASS --email=glance@example.com$ keystone user-role-add --user=glance --tenant=service --role=admin
配置image的配置文件使用keystone验证
# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_uri http://controller:5000 # openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_host controller # 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 glance # openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_password GLANCE_PASS # 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://controller:5000 # openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_host controller # 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 glance # openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_password GLANCE_PASS # openstack-config --set /etc/glance/glance-registry.conf paste_deploy flavor keystone
注:修改里面的glance密码
向keystone注册image服务并创建端点
$ keystone service-create --name=glance --type=image --description="OpenStack Image Service" $ keystone endpoint-create --service-id=$(keystone service-list | awk ‘/ image / {print $2}‘) --publicurl=http://controller:9292 --internalurl=http://controller:9292 --adminurl=http://controller:9292
启动glance-api和glance-register服务
# service openstack-glance-api start # service openstack-glance-registry start # chkconfig openstack-glance-api on # chkconfig openstack-glance-registry on
验证image服务的安装
$ mkdir /tmp/images $ cd /tmp/images/ $ wget http://download.cirros-cloud.net/0.3.2/cirros-0.3.2-x86_64-disk.img
上传这个镜像到image服务
$ 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
使用file命令 可以查看镜像的格式
$ glance image-list +--------------------------------------+--------------------- +-------------+------------------+----------+--------+ | ID | Name | Disk Format | Container Format | Size | Status | +--------------------------------------+--------------------- +-------------+------------------+----------+--------+ | acafc7c0-40aa-4026-9673-b879898e1fc2 | cirros-0.3.2-x86_64 | qcow2 | bare | 13167616 | active | +--------------------------------------+--------------------- +-------------+------------------+----------+--------+
现在你可以删除本地的镜像
$ rm -r /tmp/images
本文出自 “Linux is belong to you” 博客,请务必保留此出处http://jwh5566.blog.51cto.com/7394620/1669928
一步一步跟着官方文档安装部署Openstack(icehouse)三
原文地址:http://jwh5566.blog.51cto.com/7394620/1669928