MinIO 客户端命令 mc event 支持添加、删除和列出存储桶事件通知。MinIO 自动将触发事件发送到配置的通知目标。 MinIO 支持 AMQP (RabbitMQ)、Redis、ElasticSearch、NATS 和 PostgreSQL 等通知目标。语法如下:
C:\> mc event -h NAME: mc event - manage object notifications USAGE: mc event COMMAND [COMMAND FLAGS | -h] [ARGUMENTS...] COMMANDS: add add a new bucket notification remove remove a bucket notification; '--force' removes all bucket notifications list list bucket notifications FLAGS: --config-dir value, -C value path to configuration folder (default: "C:\\Users\\Administrator\\mc") --quiet, -q disable progress bar display --no-color disable color theme --json enable JSON lines formatted output --debug enable debug output --insecure disable SSL certificate verification --help, -h show help
该命令用来列出存储桶通知列表,语法如下:
C:\> mc event list -h NAME: mc event list - list bucket notifications USAGE: mc event list TARGET ARN [FLAGS] FLAGS: --config-dir value, -C value path to configuration folder (default: "C:\\Users\\Administrator\\mc") --quiet, -q disable progress bar display --no-color disable color theme --json enable JSON lines formatted output --debug enable debug output --insecure disable SSL certificate verification --help, -h show help
实例:
(1)列出与特定 arn 关联的通知配置
C:\> mc event list myminio/mybucket arn:aws:sqs:us-west-2:444455556666:your-queue
(2)列出所有通知配置
C:\> mc event list s3/mybucket
该子命令用来为存储桶添加新的通知。语法如下:
C:\> mc event add -h NAME: mc event add - add a new bucket notification USAGE: mc event add TARGET ARN [FLAGS] FLAGS: --event value filter specific type of event. Defaults to all event (default: "put,delete,get") --prefix value filter event associated to the specified prefix --suffix value filter event associated to the specified suffix --ignore-existing, -p ignore if event already exists --config-dir value, -C value path to configuration folder (default: "C:\\Users\\Administrator\\mc") --quiet, -q disable progress bar display --no-color disable color theme --json enable JSON lines formatted output --debug enable debug output --insecure disable SSL certificate verification --help, -h show help
实例:
(1)使用特定 ARN 启用存储桶通知
C:\> mc event add myminio/mybucket arn:aws:sqs:us-west-2:444455556666:your-queue
(2)使用过滤器参数启用存储桶通知
C:\> mc event add s3/mybucket arn:aws:sqs:us-west-2:444455556666:your-queue --event put,delete,get --prefix photos/ --suffix .jpg
(3)使用 -p 标志忽略重复的存储桶通知
C:\> mc event add s3/mybucket arn:aws:sqs:us-west-2:444455556666:your-queue -p --event put,delete,get --prefix photos/ --suffix .jpg
(4)为特定 ARN 的复制和 ILM 转换事件启用存储桶通知
C:\> mc event add myminio/mysourcebucket arn:aws:sqs:us-west-2:444455556666:your-queue --event replica,ilm
该子命令用来删除存储桶通知,'--force' 选项用来删除所有存储桶通知。语法如下:
C:\> mc event remove -h NAME: mc event remove - remove a bucket notification; '--force' removes all bucket notifications USAGE: mc event remove TARGET [ARN] [FLAGS] FLAGS: --force force removing all bucket notifications --event value filter specific type of event. Defaults to all event --prefix value filter event associated to the specified prefix --suffix value filter event associated to the specified suffix --config-dir value, -C value path to configuration folder (default: "C:\\Users\\Administrator\\mc") --quiet, -q disable progress bar display --no-color disable color theme --json enable JSON lines formatted output --debug enable debug output --insecure disable SSL certificate verification --help, -h show help
实例:
(1)删除与特定 arn 关联的存储桶通知
C:\> mc event remove myminio/mybucket arn:aws:sqs:us-west-2:444455556666:your-queue
(2)删除所有存储桶通知。注意:--force 标志在这里是强制性的
C:\> mc event remove myminio/mybucket --force