这篇文章主要介绍“openstack云计算组件glance部署及操作的方法”,在日常操作中,相信很多人在openstack云计算组件glance部署及操作的方法问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”openstack云计算组件glance部署及操作的方法”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
yum install memcached python-memcached
systemctl enable memcached.service
systemctl start memcached.service
mysql -u root -p #登入数据库 CREATE DATABASE glance; #新建库keystone GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' \ IDENTIFIED BY '123'; #新建本地访问glance库的账号 GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' \ IDENTIFIED BY '123'; #新建远程访问glance库的账号
soure admin-openrc #执行管理员脚本 #为glance的使用者创建用户 openstack user create --domain default --password-prompt glance #对glance-service添加role角色,提示:用户glance只有在一个确定的项目service内才有角色的概念,单独的用户或者单独的项目都是无法绑定角色的。 openstack role add --project service --user glance admin #创建glance服务的catalog:service+endpoint openstack service create --name glance \ --description "OpenStack Image" image openstack endpoint create --region RegionOne \ image public http://192.168.31.57:9292 openstack endpoint create --region RegionOne \ image internal http://192.168.31.57:9292 openstack endpoint create --region RegionOne \ image admin http://192.168.31.57:9292
yum -y install openstack-glance
大前提:每一条配置都应该新增到文件中,一定不要打开注释在原有的基础上修改。
创建本地存储:
1.一定要在opesntack-glance-api.service服务启动之前部署好存储设备,因为该服务在启动时会加载存储驱动检索存储设备,如果事先不存在,就意味着该服务没有识别到任何可用的存储设备,即便是后来你又新增了存储,仍然是无效的,最终导致你上传镜像失败;
2.一定要赋予opesntack-glance-api.service服务对存储设备的可写权限。
mkdir -p /var/lib/glance/images chown -R glance.glance /var/lib/glance/images
配置/etc/glance/glance-api.conf
[database] connection = mysql+pymysql://glance:123@192.168.31.57/glance [keystone_authtoken] auth_uri = http://192.168.31.57:5000 auth_url = http://192.168.31.57:35357 memcached_servers = 192.168.31.57:11211 auth_type = password project_domain_name = Default user_domain_name = Default project_name = service username = glance password = 123 [paste_deploy] flavor = keystone [glance_store] stores = file,http default_store = file filesystem_store_datadir = /var/lib/glance/images/
配置/etc/glance/glance-registry.conf
[database] connection = mysql+pymysql://glance:123@192.168.31.57/glance [keystone_authtoken] auth_uri = http://192.168.31.57:5000 auth_url = http://192.168.31.57:35357 memcached_servers = 192.168.31.57:11211 auth_type = password project_domain_name = Default user_domain_name = Default project_name = service username = glance password = 123 [paste_deploy] flavor = keystone
su -s /bin/sh -c "glance-manage db_sync" glance ''' 忽略以下打印,此乃正常性行为: Option "verbose" from group "DEFAULT" is deprecated for removal. Its value may be silently ignored in the future. /usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py:1171:...... oslo_db.sqlalchemy.enginefacade ...... a future release.") result = self._query(query) '''
systemctl enable openstack-glance-api.service \ openstack-glance-registry.service systemctl start openstack-glance-api.service \ openstack-glance-registry.service
source admin-openrc #如果没有wget则必须yum -y install wget wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img openstack image create "cirros" \ --file cirros-0.3.4-x86_64-disk.img \ --disk-format qcow2 --container-format bare \ --public openstack image list
到此,关于“openstack云计算组件glance部署及操作的方法”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注亿速云网站,小编会继续努力为大家带来更多实用的文章!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。