MinIO 客户端的 mc watch 命令监视指定的 S3 兼容服务存储桶或本地文件系统路径上的事件。对于 S3 服务,使用 mc event 在 S3 兼容服务上配置存储桶事件通知。语法如下:
C:\> mc watch -h
NAME:
mc watch - listen for object notification events
USAGE:
mc watch [FLAGS] PATH
FLAGS:
--events value filter specific types of events; defaults to all events by default (default: "put,delete,get")
--prefix value filter events for a prefix
--suffix value filter events for a suffix
--recursive recursively watch for events
--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)监听本地 MinIO 存储服务中的 images 存储桶。当我们使用 WEB 界面上传图片以及删除图片,均会通知 watch 命令。如下:
D:\server\minio>mc watch local/images
[2021-07-15T05:22:00.169Z] 229 KiB s3:ObjectCreated:Put http://127.0.0.1:9000/images/294528.jpg
[2021-07-15T05:22:14.929Z] 173 KiB s3:ObjectCreated:Put http://127.0.0.1:9000/images/234313.jpg
[2021-07-15T05:22:14.938Z] 232 KiB s3:ObjectCreated:Put http://127.0.0.1:9000/images/234281.jpg
[2021-07-15T05:22:14.943Z] 185 KiB s3:ObjectCreated:Put http://127.0.0.1:9000/images/265270.jpg
[2021-07-15T05:22:14.945Z] 274 KiB s3:ObjectCreated:Put http://127.0.0.1:9000/images/241623.jpg
[2021-07-15T05:22:31.041Z] s3:ObjectRemoved:Delete http://127.0.0.1:9000/images/20210703221135.jpg
[2021-07-15T05:22:31.041Z] s3:ObjectRemoved:Delete http://127.0.0.1:9000/images/0f78ad1e685e9e972e3780ebfbdf2192.jpeg(2)在 MinIO 服务器上观看新的 S3 操作
C:\> mc watch play/testbucket(3)在 MinIO 服务器上观看特定前缀 “output/” 的新事件。
C:\> mc watch --prefix "output/" play/testbucket(4)在 MinIO 服务器上观看特定后缀 “.jpg” 的新事件。
C:\> mc watch --suffix ".jpg" play/testbucket(5)在 MinIO 服务器上观看特定前缀和后缀的新事件。
C:\> mc watch --suffix ".jpg" --prefix "photos/" play/testbucket(6)站点级别监视(运行此命令后创建的新存储桶除外)
C:\> mc watch play/(7)监听本地目录上的事件。
C:\> mc watch /usr/share