MinIO存储桶通知 - Kafka小测

概述

公司的某个项目需要用上这玩意,所以在本地搭建测试环境,经过一番折腾,测试通过,博文记录,用以备忘

MinIO安装

该节不做说明,网络有很多现成的帖子,自行搜索去

配置步骤

控制台添加事件通知



将具体存储桶和事件通知关联起来

点击"Save"保存即可。

注意:

  1. evtest是我预先创建的存储桶,具体你们根据实际场景变更
  2. 填写了桶文件的前后缀,当桶路径匹配不上的时候,不会发送事件通知

事件通知内容样例

PUT

bash 复制代码
{
	"EventName": "s3:ObjectCreated:Put",
	"Key": "evtest/111.conf",
	"Records": [
		{
			"eventVersion": "2.0",
			"eventSource": "minio:s3",
			"awsRegion": "",
			"eventTime": "2024-07-22T01:31:23.190Z",
			"eventName": "s3:ObjectCreated:Put",
			"userIdentity": {
				"principalId": "admin"
			},
			"requestParameters": {
				"principalId": "admin",
				"region": "",
				"sourceIPAddress": "192.168.64.1"
			},
			"responseElements": {
				"x-amz-id-2": "dd9025bab4ad464b049177c95eb6ebf374d3b3fd1af9251148b658df7ac2e3e8",
				"x-amz-request-id": "17E464E2E26B8A25",
				"x-minio-deployment-id": "3f95da32-9ae8-4983-9622-df88df89410d",
				"x-minio-origin-endpoint": "http://192.168.64.136:9000"
			},
			"s3": {
				"s3SchemaVersion": "1.0",
				"configurationId": "Config",
				"bucket": {
					"name": "evtest",
					"ownerIdentity": {
						"principalId": "admin"
					},
					"arn": "arn:aws:s3:::evtest"
				},
				"object": {
					"key": "111.conf",
					"size": 4763,
					"eTag": "15c4659f418b62e001f7d597dedaf51c",
					"contentType": "application/octet-stream",
					"userMetadata": {
						"content-type": "application/octet-stream"
					},
					"sequencer": "17E464E2E272AAA7"
				}
			},
			"source": {
				"host": "192.168.64.1",
				"port": "",
				"userAgent": "MinIO (linux; amd64) minio-go/v7.0.73 MinIO Console/(dev)"
			}
		}
	]
}

DELETE

bash 复制代码
{
	"EventName": "s3:ObjectRemoved:Delete",
	"Key": "evtest/111.conf",
	"Records": [
		{
			"eventVersion": "2.0",
			"eventSource": "minio:s3",
			"awsRegion": "",
			"eventTime": "2024-07-22T01:56:53.672Z",
			"eventName": "s3:ObjectRemoved:Delete",
			"userIdentity": {
				"principalId": "admin"
			},
			"requestParameters": {
				"principalId": "admin",
				"region": "",
				"sourceIPAddress": "192.168.64.1"
			},
			"responseElements": {
				"content-length": "154",
				"x-amz-id-2": "dd9025bab4ad464b049177c95eb6ebf374d3b3fd1af9251148b658df7ac2e3e8",
				"x-amz-request-id": "17E466473A6E11BB",
				"x-minio-deployment-id": "3f95da32-9ae8-4983-9622-df88df89410d",
				"x-minio-origin-endpoint": "http://192.168.64.136:9000"
			},
			"s3": {
				"s3SchemaVersion": "1.0",
				"configurationId": "Config",
				"bucket": {
					"name": "evtest",
					"ownerIdentity": {
						"principalId": "admin"
					},
					"arn": "arn:aws:s3:::evtest"
				},
				"object": {
					"key": "111.conf",
					"sequencer": "17E466473A7E072B"
				}
			},
			"source": {
				"host": "192.168.64.1",
				"port": "",
				"userAgent": "MinIO (linux; amd64) minio-go/v7.0.73 MinIO Console/(dev)"
			}
		}
	]
}
bash 复制代码
{
	"EventName": "s3:ObjectAccessed:Head",
	"Key": "evtest/111.conf",
	"Records": [
		{
			"eventVersion": "2.0",
			"eventSource": "minio:s3",
			"awsRegion": "",
			"eventTime": "2024-07-22T01:56:46.230Z",
			"eventName": "s3:ObjectAccessed:Head",
			"userIdentity": {
				"principalId": "admin"
			},
			"requestParameters": {
				"principalId": "admin",
				"region": "",
				"sourceIPAddress": "192.168.64.1"
			},
			"responseElements": {
				"content-length": "4763",
				"x-amz-id-2": "dd9025bab4ad464b049177c95eb6ebf374d3b3fd1af9251148b658df7ac2e3e8",
				"x-amz-request-id": "17E466457ED88843",
				"x-minio-deployment-id": "3f95da32-9ae8-4983-9622-df88df89410d",
				"x-minio-origin-endpoint": "http://192.168.64.136:9000"
			},
			"s3": {
				"s3SchemaVersion": "1.0",
				"configurationId": "Config",
				"bucket": {
					"name": "evtest",
					"ownerIdentity": {
						"principalId": "admin"
					},
					"arn": "arn:aws:s3:::evtest"
				},
				"object": {
					"key": "111.conf",
					"size": 4763,
					"eTag": "15c4659f418b62e001f7d597dedaf51c",
					"contentType": "application/octet-stream",
					"userMetadata": {
						"content-type": "application/octet-stream"
					},
					"sequencer": "17E464E2E272AAA7"
				}
			},
			"source": {
				"host": "192.168.64.1",
				"port": "",
				"userAgent": "MinIO (linux; amd64) minio-go/v7.0.73 MinIO Console/(dev)"
			}
		}
	]
}

以上通知样例都是通过MinIO Console操作,然后从Kafka接收到的具体内容

参考链接

Minio Bucket 通知试用&&说明
MinIO存储桶通知指南
发布事件到Kafka

相关推荐
Mr.Demo.16 分钟前
[RabbitMQ] 保证消息可靠性的三大机制------消息确认,持久化,发送方确认
分布式·rabbitmq
小扳27 分钟前
微服务篇-深入了解使用 RestTemplate 远程调用、Nacos 注册中心基本原理与使用、OpenFeign 的基本使用
java·运维·分布式·后端·spring·微服务·架构
LightOfNight1 小时前
Redis设计与实现第14章 -- 服务器 总结(命令执行器 serverCron函数 初始化)
服务器·数据库·redis·分布式·后端·缓存·中间件
cnsxjean10 小时前
SpringBoot集成Minio实现上传凭证、分片上传、秒传和断点续传
java·前端·spring boot·分布式·后端·中间件·架构
桃园码工16 小时前
3-测试go-redis+redsync实现分布式锁 --开源项目obtain_data测试
redis·分布式·golang
sx_170616 小时前
Spark面试题
大数据·分布式·spark
wclass-zhengge18 小时前
02微服务系统与设计(D1_走出微服务误区:避免从单体到分布式单体)
分布式·微服务·架构
ZOMI酱19 小时前
【AI系统】分布式通信与 NVLink
人工智能·分布式
scc214021 小时前
kafka学习-02
分布式·学习·kafka
lzhlizihang21 小时前
使用Java代码操作Kafka(五):Kafka消费 offset API,包含指定 Offset 消费以及指定时间消费
java·kafka·offset