Skip to content

Commit

Permalink
Makes mandatory dsn_string parameter optional (minio#8931)
Browse files Browse the repository at this point in the history
  • Loading branch information
ebozduman authored Mar 29, 2020
1 parent fa4d627 commit fdda5f9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions cmd/config/notify/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ var (
config.HelpKV{
Key: target.MySQLDSNString,
Description: "MySQL data-source-name connection string",
Optional: true,
Type: "string",
},
config.HelpKV{
Expand Down
10 changes: 7 additions & 3 deletions docs/bucket/notifications/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -979,21 +979,25 @@ MINIO_NOTIFY_MYSQL_QUEUE_LIMIT (number) maximum limit for undeliver
MINIO_NOTIFY_MYSQL_COMMENT (sentence) optionally add a comment to this setting
```

`dsn_string` is optional, if not specified, the connection information specified by the `host`, `port`, `user`, `password` and `database` parameters are used.
`dsn_string` is optional. If not specified, the connection information specified by the `user`, `password`, `host`, `port`, and `database` parameters are used. `dsn_string` is formed as `"<user>:<password>@tcp(<host>:<port>)/<database>"`

MinIO supports persistent event store. The persistent store will backup events if MySQL connection goes offline and then replays the stored events when the broken connection comes back up. The event store can be configured by setting a directory path in `queue_dir` field, and the maximum number of events, which can be stored in a `queue_dir`, in `queue_limit` field. For example, `queue_dir` can be set to `/home/events` and `queue_limit` can be set to `1000`. By default, the `queue_limit` is set to `10000`.

Before updating the configuration, let's start with `mc admin config get` command to get the current configuration.

```sh
$ mc admin config get myminio/ notify_mysql
notify_mysql:myinstance table="" database="" format="namespace" password="" port="" queue_dir="" queue_limit="0" username="" dsn_string="" host=""
notify_mysql:myinstance enable=off format=namespace host= port= username= password= database= dsn_string= table= queue_dir= queue_limit=0
```

Use `mc admin config set` command to update MySQL notification configuration for the deployment.

```sh
$ mc admin config set myminio notify_mysql:myinstance table="minio_images" database="miniodb" format="namespace" password="" port="3306" queue_dir="" queue_limit="0" username="root" dsn_string="" host="172.17.0.1"
$ mc admin config set myminio notify_mysql:myinstance table="minio_images" username="root" password="xxxx" host="172.17.0.1" port="3306" database="miniodb"
```
or with `dsn_string` parameter;
```sh
$ mc admin config set myminio notify_mysql:myinstance table="minio_images" dsn_string="root:xxxx@tcp(172.17.0.1:3306)/miniodb"
```

Note that, you can add as many MySQL server endpoint configurations as needed by providing an identifier (like "myinstance" in the example above) for each MySQL instance desired.
Expand Down

0 comments on commit fdda5f9

Please sign in to comment.