MinIO入门(四)——Mysql存储桶通知配置

**!!!中文社区中说的config.json的方式已经打算被废弃了,所以现在最好通过minio客户端的方式进行处理了**

· 在目标mysql创建数据库miniodb(要用默认字符集,不然会报错)

· 在minio client的可执行目录下执行如下命令,查看是否已经存在配置

./mc --insecure admin config get myminio notify_mysql

不存在就会如下打印:

notify_mysql enable=off format=namespace dsn_string= table= queue_dir= queue_limit=0 max_open_connections=2 

· 添加Mysql通知配置

./mc --insecure admin config set myminio notify_mysql:myinstance table="minio_images" dsn_string="root:Centerm&123@tcp(10.17.70.6:3306)/miniodb"

参数说明

KEY:
notify_mysql[:name]  publish bucket notifications to MySQL databases. When multiple MySQL server endpoints are needed, a user specified "name" can be added for each configuration, (e.g."notify_mysql:myinstance").

ARGS:
dsn_string*          (string)             MySQL data-source-name connection string e.g. "<user>:<password>@tcp(<host>:<port>)/<database>"
table*               (string)             DB table name to store/update events, table is auto-created
format*              (namespace*|access)  'namespace' reflects current bucket/object list and 'access' reflects a journal of object operations, defaults to 'namespace'
queue_dir            (path)               staging dir for undelivered messages e.g. '/home/events'
queue_limit          (number)             maximum limit for undelivered messages, defaults to '100000'
max_open_connections (number)             maximum number of open connections to the database, defaults to '2'
comment              (sentence)           optionally add a comment to this setting

添加成功会有成功的提示信息

Setting new key has been successful.
Please restart your server with `mc admin service restart myminio`.

· 在minio client的可执行目录下执行如下命令,查看是否已经存在配置

./mc --insecure admin config get myminio notify_mysql

存在会有如下打印:

notify_mysql:myinstance format=namespace dsn_string=root:Centerm&123@tcp(10.17.70.6:3306)/miniodb table=minio_images queue_dir= queue_limit=0 max_open_connections=2

要能够使用还需要启动服务(集群的话需要重启每个节点服务


版权声明:本文为ErErFei原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。