使用Swift作为Glance后端存储
原文链接 http://thornelabs.net/2014/08/03/use-openstack-swift-as-a-backend-store-for-glance.html
By default, OpenStack Glance saves images and OpenStack Instance snapshots on the local filesystem
in /var/lib/glance/images/.
However, if you have a Swift Cluster, you can just as easily use it to save images and snapshots instead of the
local filesystem where Glance is running.
Begin by logging into the node running the Glance services (probably your controller node also running Keystone)
as root and source your OpenStack credentials (this is typically a file named openrc).
source ~/openrc
Verify the user glance is part of tenant service with role admin.
keystone user-role-list --user glance --tenant service
One of the roles returned should be admin.
Open /etc/glance/glance-api.conf and comment out the following two lines:
##### DEFAULT OPTIONS #####
#default_store = file
#filesystem_store_datadir = /var/lib/glance/images/
With /etc/glance/glance-api.conf still open, append the following lines to the DEFAULT OPTIONS section (be
sure to set the values inside < > to match your environment):
default_store = swift
swift_store_auth_address = http://<IP_OF_KEYSTONE>:35357/v2.0/
swift_store_user = service:glance
swift_store_key = <VALUE OF __admin_password__ ATTRIBUTE IN __/etc/glance/glance-api.conf__>
swift_store_create_container_on_put = True
With the configuration changes in place, restart the Glance services.
If you are running CentOS/RHEL:
service openstack-glance-api restart
service openstack-glance-registry restart
If you are running Ubuntu:
service glance-api restart
service glance-registry restart
Now you should be able to upload an image to Glance through the Horizon Dashboard or using the glance
command and instead of it being saved to /var/lib/glance/images, it will be saved in a Swift Container
called glance in the service account.
Verify nothing is saved in /var/lib/glance/images by simply running ls
/var/lib/glance/images
(if you did not
delete any existing Glance Images, they will still be there).
Once the Horizon Dashboard or the glance image-list
reports
the image is active, you can verify the images
are in Swift by running the following command (be sure to set the values inside < > to match your environment):
swift --os-auth-url http://<IP_OF_KEYSTONE>:5000/v2.0 --os-tenant-name service --os-username glance --os-password <PASSWORD USED IN swift_store_key ABOVE> list glance
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· Ollama——大语言模型本地部署的极速利器
· DeepSeek如何颠覆传统软件测试?测试工程师会被淘汰吗?