Openstack的镜像服务-Glance

21/100保存草稿发布文章 博文管理我的博客退出加粗 斜体 标题 删除线 无序 有序 待办 引用 代码块 BashCC++C#CLikeCSSGoHandlebarsJavaJavaScriptKotlinMarkupObjective-CPerlPHPShellPythonRubySQLSwiftVB.NetYAML图片 上传图片实验版,新增正版图库功能 视频 表格 超链接 摘要 导入 导出 保存 填写标题才可自动保存 撤销 重做 目录 帮助

Openstack的镜像服务——Glance

1、 Glance概述

https://docs.openstack.org/glance/rocky/install/install-rdo.html#install-and-configure-components

2、 Glance的安装

2.1 、安装Glance组件

[root@linux-node1~]# yum install -y openstack-glance

2.2、 配置Glance

编辑/etc/glance/glance-api.conf文件,完成以下设置

[database]...connection =mysql+pymysql://glance:GLANCE_DBPASS@Controller/glance

注意:替换GLANCE_DBPASS用在数据库中创建Glance时的密码

1901 connection = mysql+pymysql://glance:glance@192.168.56.104/glance

同时可以编辑/etc/glance/glance-registry.conf

[database]...connection =mysql+pymysql://Glance:GLANCE_DBPASS@Controller/Glance

注意:替换GLANCE_DBPASS用在数据库中创建Glance时的密码

1146 connection = mysql+pymysql://glance:glance@192.168.56.104/glance

然后同步数据库

[root@linux-node1Glance]# su -s /bin/sh -c "glance-manage db_sync" glance

会有一些警告信息,可以忽略。

[root@linux-node1
Glance]# mysql -h 192.168.56.104 -uglance -pglance -e "use glance;show
tables;"

在这里插入图片描述

证明数据库配置正确!!

编辑/etc/glance/glance-api.conf文件

[keystone_authtoken]

...

auth_uri = http://controller:5000

auth_url = http://controller:35357

memcached_servers = controller:11211

auth_type = password

project_domain_name = default

user_domain_name = default

project_name = service

username = glance

password = GLANCE_PASS

注意修改相关内容

auth_uri =http://192.168.56.11:5000

auth_url =http://192.168.56.11:35357

memcached_servers= 192.168.56.11:11211

auth_type =password

project_domain_name= default

user_domain_name =default

project_name =service

username = glance

password = glance


[Glance_store]

...

1941 stores =
file,http

1973 default_store= file

2292
filesystem_store_datadir = /var/lib/Glance/images/



[paste_deploy]
...
4268 flavor = keystone

配置/etc/Glance/Glance-registry.conf

1204
[keystone_authtoken]

auth_uri = http://192.168.56.11:5000

auth_url =
http://192.168.56.11:35357

memcached_servers
= 192.168.56.11:11211

auth_type =
password

project_domain_name
= default

user_domain_name =
default

project_name =
service

username = Glance

password = Glance

 

[paste_deploy]

...

2160 flavor =
keystone

配置完成后我们可以查看一下在这里完成了哪些配置?

[root@linux-node1
Glance]# grep '^[a-Z]' /etc/Glance/Glance-api.conf

connection =
mysql+pymysql://Glance:Glance@192.168.56.11/Glance

stores = file,http

default_store =
file

filesystem_store_datadir
= /var/lib/Glance/images

auth_uri =
http://192.168.56.11:5000

auth_url =
http://192.168.56.11:35357

memcached_servers
= 192.168.56.11:11211

auth_type =
password

project_domain_name
= default

user_domain_name =
default

project_name =
service

username = Glance

password = Glance

flavor = keystone

 

[root@linux-node1
Glance]# grep '^[a-Z]' /etc/Glance/Glance-registry.conf

connection =
mysql+pymysql://Glance:Glance@192.168.56.11/Glance

auth_uri =
http://192.168.56.11:5000

auth_url = http://192.168.56.11:35357

memcached_servers
= 192.168.56.11:11211

auth_type =
password

project_domain_name
= default

user_domain_name =
default

project_name =
service

username = Glance

password = Glance

flavor = keystone

 

2.3 、启动Glance服务

[root@linux-node1
Glance]# systemctl enable openstack-glance-api.service  openstack-glance-registry.service

[root@linux-node1
Glance]# systemctl start openstack-glance-api.service openstack-glance-registry.service

以下内容为10.16日新增

[root@controller Glance]# ps -e|grep Glance

3959 ? 00:00:02 Glance-api

3960 ? 00:00:01 Glance-registry

3977 ? 00:00:00 Glance-registry

3978 ? 00:00:00 Glance-registry

3979 ? 00:00:00 Glance-registry

3980 ? 00:00:00 Glance-registry

3981 ? 00:00:00 Glance-api

3982 ? 00:00:00 Glance-api

3985 ? 00:00:00 Glance-api

3986 ? 00:00:00 Glance-api

在这里插入图片描述

发现端口9191和9292已经被监听,服务启动。

[root@linux-node1~]# ps aux | grep Glance

在这里插入图片描述

日志目录在 /var/log/Glance

[root@linux-node1~]# cd /var/log/Glance

[root@linux-node1Glance]# ll

总用量 28

-rw-r--r-- 1
Glance Glance 22415 7月  23 04:14 api.log

-rw-r--r-- 1
Glance Glance   258 7月  23
04:14 registry.log

[root@linux-node1Glance]#

3、 Glance服务注册与镜像上传

3.1、 创建Glance的服务实体

[root@linux-node1~]# source admin-openrc.sh

[root@linux-node1~]# openstack service create --name glance --description "OpenStack Image"image

在这里插入图片描述

查看一下刚才创建的Glance服务

[root@linux-node1~]# openstack service list

显示结果

在这里插入图片描述

3.2、 创建Image service API endpoints

[root@linux-node1~]# openstack endpoint create --region RegionOne image public
http://192.168.56.104:9292

在这里插入图片描述

[root@linux-node1
~]# openstack endpoint create --region RegionOne image internal
http://192.168.56.104:9292

在这里插入图片描述

[root@linux-node1
~]# openstack endpoint create --region RegionOne image admin
http://192.168.56.104:9292

在这里插入图片描述

[root@linux-node1
~]# openstack endpoint list

查看一下我们新创建的endpoint

在这里插入图片描述

查看一下Glance的镜像

[root@linux-node1
~]# Glance image-list

在这里插入图片描述
还未上传镜像,所以这里是空的,注意此处要是报错的话,那就说明Glance的安装是有问题的。

3.3 镜像上传

(1)下载一个镜像文件wget
http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img

(2)上传镜像文件

openstack image create
“cirros” \

–file cirros-0.3.4-x86_64-disk.img \

–disk-format qcow2 --container-format bare \

–public

在这里插入图片描述

[root@linux-node1~]# openstack image  list

在这里插入图片描述

[root@linux-node1
images]# pwd

/var/lib/Glance/images

[root@linux-node1
images]# ll

总用量 12980

-rw-r----- 1
Glance Glance 13287936 7月  26 23:54 a1ed0cae-705e-4bd7-a143-a4dcea6a66dc

[root@linux-node1
images]# Glance image-list

在这里插入图片描述
Glance服务安装配置完毕

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值