Ubuntu搭建Openstack平台(kilo)(三.glance)
2016-05-06 19:25
435 查看
一.Glance环境
参考文档:http://www.aboutyun.com/thread-13080-1-1.html
http://docs.openstack.org/mitaka/install-guide-ubuntu/glance-install.html
1.创建glance的数据库并授权
创建
授权(自己设定密码,连接数据库时用,我的glance)
退出
2.生效admin环境变量
3.创建认证服务
创建glance用户
添加 admin 角色 到 glance 用户 和 service 租户(project)
创建glance的服务实例
创建镜像服务的API endpoint
二.安装Glance
1.安装
2.修改配置
保存退出。
保存退出。
3.同步数据库(同步之后,可以看看数据库中是否存在表,有则成功,没有则表明可能sqlite数据库没删,删除后在同步
4.重启glance服务
三.Glance验证
1.在每一个客户端脚本,配置镜像服务客户端使用 API version 2.0
2.source admin环境变量
3.创建一个临时目录,下载镜像
参考文档:http://www.aboutyun.com/thread-13080-1-1.html
http://docs.openstack.org/mitaka/install-guide-ubuntu/glance-install.html
1.创建glance的数据库并授权
创建
mysql -u root -p CREATE DATABASE glance;
授权(自己设定密码,连接数据库时用,我的glance)
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'GLANCE_PASS'; GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'GLANCE_PASS';
退出
exit
2.生效admin环境变量
source admin-openrc.sh
3.创建认证服务
创建glance用户
openstack user create --password-prompt glance User Password:(我的设置glance) Repeat User Password: +-----------+----------------------------------+ | Field | Value | +-----------+----------------------------------+ | domain_id | e0353a670a9e496da891347c589539e9 | | enabled | True | | id | e38230eeff474607805b596c91fa15d9 | | name | glance | +-----------+----------------------------------+
添加 admin 角色 到 glance 用户 和 service 租户(project)
openstack role add --project service --user glance admin
创建glance的服务实例
opens 4000 tack service create --name glance --description "OpenStack Image" image +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | OpenStack Image | | enabled | True | | id | 8c2c7f1b9b5049ea9e63757b5533e6d2 | | name | glance | | type | image | +-------------+----------------------------------+
创建镜像服务的API endpoint
openstack endpoint create --publicurl http://controller:9292 --internalurl http://controller:9292 --adminurl http://controller:9292 --region RegionOne image +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | adminurl | http://controller:9292 | | id | 340be3625e9b4239a6415d034e98aace | | internalurl | http://controller:9292 | | publicurl | http://controller:9292 | | region_id | RegionOne | | service_id | 8c2c7f1b9b5049ea9e63757b5533e6d2 | | service_name | glance | | service_type | image | +--------------+----------------------------------+
二.安装Glance
1.安装
apt-get install glance python-glanceclient -y
2.修改配置
vim /etc/glance/glance-api.conf [DEFAULT] verbose = True notification_driver = noop [database] connection = mysql://glance:GLANCE_DBPASS(glance数据库密码)@controller/glance [keystone_authtoken] auth_uri = http://controller:5000 auth_url = http://controller:35357 auth_plugin = password project_domain_id = default user_domain_id = default project_name = service username = glance password = GLANCE_PASS(glance密码) [paste_deploy] flavor = keystone [glance_store] #配置本地文件系统存储和image文件路径 default_store = file filesystem_store_datadir = /var/lib/glance/images/
保存退出。
vim /etc/glance/glance-registry.conf [DEFAULT] verbose = True notification_driver = noop [database] connection = mysql://glance:GLANCE_DBPASS(glance数据库密码)@controller/glance [keystone_authtoken] auth_uri = http://controller:5000 auth_url = http://controller:35357 auth_plugin = password project_domain_id = default user_domain_id = default project_name = service username = glance password = GLANCE_PASS(glance密码) [paste_deploy] flavor = keystone
保存退出。
3.同步数据库(同步之后,可以看看数据库中是否存在表,有则成功,没有则表明可能sqlite数据库没删,删除后在同步
rm -f /var/lib/glance/glance.sqlite)
su -s /bin/sh -c "glance-manage db_sync" glance
4.重启glance服务
service glance-registry restart service glance-api restart
三.Glance验证
1.在每一个客户端脚本,配置镜像服务客户端使用 API version 2.0
echo "export OS_IMAGE_API_VERSION=2" | tee -a admin-openrc.sh demo-openrc.sh
2.source admin环境变量
source admin-openrc.sh
3.创建一个临时目录,下载镜像
mkdir /tmp/images wget -P /tmp/images http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img[/code]
4.上传镜像到glance,镜像使用qcow2 格式glance image-create --name "cirros-0.3.4-x86_64" --file /tmp/ cirros-0.3.4-x86_64-disk.img \ --disk-format qcow2 --container-format bare --visibility public progress [=============================>] 100% +------------------+--------------------------------------+ | Property | Value | +------------------+--------------------------------------+ | checksum | 133eae9fb1c98f45894a4e60d8736619 | | container_format | bare | | created_at | 2015-03-26T16:52:10Z | | disk_format | qcow2 | | id | 38047887-61a7-41ea-9b49-27987d5e8bb9 | | min_disk | 0 | | min_ram | 0 | | name | cirros-0.3.4-x86_64 | | owner | ae7a98326b9c455588edd2656d723b9d | | protected | False | | size | 13200896 | | status | active | | tags | [] | | updated_at | 2015-03-26T16:52:10Z | | virtual_size | None | | visibility | public | +------------------+--------------------------------------+
5.验证成功,并移除临时目录glance image-list +--------------------------------------+--------+ | ID | Name | +--------------------------------------+--------+ | 38047887-61a7-41ea-9b49-27987d5e8bb9 | cirros | +--------------------------------------+--------+ rm -r /tmp/images
注意:以前搭建的,可以运行,如果上面写的有一些问题,谢谢指出来。
相关文章推荐
- 爬虫程序定时执行和监控示例
- linux 命令中du 与df 的区别
- bzoj 4582: [Usaco2016 Open]Diamond Collector
- linux的常用命令
- linux命令行下载、配置JDK
- Linux下部署项目
- shell判断磁盘空间删除文件
- shell两文件对比,相同字符取出到另一个文本
- shell删除超过指定时间的文件
- Docker介绍
- shell数组合并
- RunLoop核心原理和机制
- /bin/bash^M: bad interpreter: No such file or directory
- Linux系统下Apache2.4.17的安装过程
- Linux命令(2):free
- nginx身份验证
- linux软件---源码包安装的思考
- linux常用shell命令
- linux常用网络命令
- linux基础之常用命令(4)