Openstack安装与部署:glance安装与配置
Openstack安装与部署:glance安装与配置
该项所有操作都需要在controller0主机上用root进行操作
创建数据库
#mysql -uroot -popenstack
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’;
exit
#mysql -uglance -pGLANCE_DBPASS -e ‘show databases;’
#source /root/admin-poenrc.sh
#kestone user-create --name glance --pass GLANCE_PASS --email [email protected] --enabled true
#keystone user-list
#keystone user-role-add --user glance --tenant service --role admin
#keystone user-role-list --user glance --tenant service
#keystone service-create --type image --name glance --description “OpenStack Glance Image Service”
#keystone service-list
#keystone endpoint-create --service-id $(keystone service-list | awk ‘/ image / {print $2}’) --publicurl http://controller0:9292 --internalurl http://controller0:9292 --adminurl http://controller0:9292 --region regionOne
#keystone endpoint-list
安装glance服务
#yum update 首先yum系统更新
#yum -y install openstack-glance python-glanceclient
配置glance-api服务
配置数据库连接 查看是否修改成功
#openstack-config --set /etc/glance/glance-api.conf database connection mysql://glance:[email protected]/glance
#cat /etc/glance/glance-api.conf |grep connection
此后查看配置是否成功,若没有配置成功便直接进入配置文件中修改即可。
#openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_uri http://controller0:5000/v2.0
#openstack-config --set /etc/glance/glance-api.conf keystone_authtoken identity_uri http://controller0:35357
#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
#more /etc/glance/glance-api.conf
配置image存储位置,使用本地的文件系统存储
#openstack-config --set /etc/glance/glance-api.conf glance_store default_store file
#openstack-config --set /etc/glance/glance-api.conf glance_store filesystem_store_datadir /var/lib/glance/images/
#openstack-config --set /etc/glance/glance-api.conf DEFAULT verbose True
配置glance-registry服务
#openstack-config --set /etc/glance/glance-registry.conf database connection mysql://glance:[email protected]/glance
#openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_uri http://controller0:5000/v2.0
#openstack-config --set /etc/glance/glance-registry.conf kestone_authtoken identity_uri http://controller0:35357
#openstack-config --set /etc/glance/glance-registry.conf kestone_authtoken admin_tenant_name service
#openstack-config --set /etc/glance/glance-registry.conf kestone_authtoken admin_user glance
#openstack-config --set /etc/glance/glance-registry.conf kestone_authtoken admin_password GLANCE_PASS
#openstack-config --set /etc/glance/glance-registry.conf DEFAULT verbose True
建立glance数据库中的所需的表
#su -s /bin/sh -c “glance-manage db_sync” glance
#mysql -uglance -pGLANCE_DBPASS -e “show tables from glance;”
启动并校验glance服务
需要查看的日志文件路径为:/var/log/
#service openstack-glance-api start
#chkconfig openstack-glance-api on
#service openstack-glance-registry start
#chkconfig openstack-glance-registry on
#tail -f /var/log/glance/api.log
#tail -f /var/log/glance/registry.log
校验glance服务 把镜像cirrors-0.3.0-x86上传到/root根目录下
#cd ~
#file cirrors-0.3.0-x86_64-disk.img
#source admin-openrc.sh
#glance image-create --name cirrors --disk qcow2 --container-format bare --file /root/cirrors-0.3.0-x86_64-disk.img --is-public True --is-protected False --human-readable --progress
校验image是否上传成功
#glance image-list
#glance image-show id