CentOS7.1 Liberty云平台之Image篇(4)

这篇博客详细介绍了在CentOS7.1上配置OpenStack Liberty云平台的Image服务过程,包括安装配置数据库、创建glance用户、设置API端点、安装相关软件包、配置配置文件、同步数据库、启动服务,以及通过客户端验证镜像的上传和查看。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

控制节点:

一、安装及配置

1.创建数据库及管理用户

登录数据库

mysql -u root -p

执行以下命令:

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';

2.生效admin变量

source admin-openrc.sh

3.创建glance用户

openstack user create --domain default --password-prompt glance
添加admin角色到glance用户及service项目

openstack role add --project service --user glance admin
创建glance服务实体

openstack service create --name glance --description "OpenStack Image service" image

4.创建服务API端点

openstack endpoint create --region RegionOne image public http://controller:9292
openstack endpoint create --region RegionOne image internal http://controller:9292
openstack endpoint create --region RegionOne image admin http://controller:9292

5.安装glance相关包

yum install openstack-glance python-glance python-glanceclient -y

6.配置/etc/glance/glance-api.conf

[database]
...
connection = mysql://glance:GLANCE_DBPASS@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 = 111111

[paste_deploy]
...
flavor = keystone
[glance_store]
...
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
[DEFAULT]
...
notification_driver = noop
verbose = True

7.配置/etc/glance/glance-registry.conf

[database]
...
connection = mysql://glance:GLANCE_DBPASS@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 = 111111

[paste_deploy]
...
flavor = keystone
[DEFAULT]
...
notification_driver = noop
verbose = True

8.同步glance数据库

su -s /bin/sh -c "glance-manage db_sync" glance

9.开启glance相关服务,并设置开机自启

systemctl enable openstack-glance-api.service openstack-glance-registry.service
systemctl start openstack-glance-api.service openstack-glance-registry.service

二、验证

1.客户端环境变量脚本增加Image服务变量

echo "export OS_IMAGE_API_VERSION=2" | tee -a admin-openrc.sh demo-openrc.sh

2.生效客户端admin环境变量脚本

source admin-openrc.sh

3.下载镜像文件到本地

wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img

4.上传镜像到image服务

glance image-create --name "cirros" --file cirros-0.3.4-x86_64-disk.img --disk-format qcow2 --container-format bare --visibility public --progress

5.查看上载的镜像

glance image-list


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值