Skip to content

This is the multi-page printable view of this section. .

Return to the regular view of this page.

Monitoring Bucket and Object Events

Bucket Notifications

MinIO bucket notifications allow administrators to send notifications to supported external services on certain object or bucket events. MinIO supports bucket and object-level S3 events similar to the Amazon S3 Event Notifications.

MinIO supports publishing bucket or object events to the following supported targets on certain supported events.

See Bucket notifications for more complete documentation on MinIO Bucket Notifications.

Deployment Metrics

MinIO provides a Prometheus-compatible endpoint for supporting time-series querying of metrics.

Server Logs

MinIO provides the following interfaces for remotely reading server logs:

1 - Bucket notifications

MinIO bucket notifications allow administrators to send notifications to supported external services on certain object or bucket events. MinIO supports bucket and object-level S3 events similar to the Amazon S3 Event Notifications.

Supported notification targets

MinIO supports publishing event notifications to the following targets:

Target

Description

AMQP (RabbitMQ)

Publish notifications to an AMQP service such as RabbitMQ.

See Publish Events to AMQP (RabbitMQ) for a tutorial.

MQTT

Publish notifications to an MQTT service.

See Publish Events to MQTT for a tutorial.

NATS

Publish notifications to a NATS service.

See Publish Events to NATS for a tutorial.

NSQ

Publish notifications to a NSQ service.

See Publish Events to NSQ for a tutorial

Elasticsearch

Publish notifications to a Elasticsearch service.

See Publish Events to Elasticsearch for a tutorial.

Kafka

Publish notifications to a Kafka service.

See Publish Events to Kafka for a tutorial.

MySQL

Publish notifications to a MySQL service.

See Publish Events to MySQL for a tutorial.

PostgreSQL

Publish notifications to a PostgreSQL service.

See Publish Events to PostgreSQL for a tutorial.

Redis

Publish notifications to a Redis service.

See Publish Events to Redis for a tutorial.

webhook

Publish notifications to a Webhook service.

See Publish Events to Webhook for a tutorial.

Asynchronous vs synchronous bucket notifications

Note

Added: RELEASE.2023-06-23T20-26-00Z

MinIO supports either asynchronous (default) or synchronous bucket notifications for all remote targets.

With asynchronous delivery, MinIO fires the event at the configured remote and does not wait for a response before continuing to the next event. Asynchronous bucket notification prioritizes sending events with the risk of some events being lost if the remote target has a transient issue during transit or processing.

With synchronous delivery, MinIO fires the event at the configured remote and then waits for the remote to confirm a successful receipt before continuing to the next event. Synchronous bucket notification prioritizes delivery of events with the risk of a slower event-send rate and queue fill.

To enable synchronous bucket notifications for all configured remote targets, use either of the following settings:

Note

Note

For synchronous and asynchronous events, MinIO maintains a per-remote queue where it stores unsent and pending events. The queue limit defaults to 100000.

MinIO discards new events when the queue is full.

You can increase the queue size as necessary to better accommodate the rate of event send and processing of the MinIO deployment and remote target. Use the QUEUE_LIMIT environment variable or configuration setting for your notification method to modify this limit.

For asynchronous events, MinIO allows a maximum of 50000 concurrent send calls.

Supported S3 event types

MinIO bucket notifications are compatible with Amazon S3 Event Notifications. This section lists all supported events.

Object events

MinIO supports triggering notifications on the following S3 object events:

s3:ObjectAccessed:Get

data

s3:ObjectAccessed:GetLegalHold

data

s3:ObjectAccessed:GetRetention

data

s3:ObjectAccessed:Head

data

s3:ObjectCreated:CompleteMultipartUpload

data

s3:ObjectCreated:Copy

data

s3:ObjectCreated:DeleteTagging

data

s3:ObjectCreated:Post

data

s3:ObjectCreated:Put

data

s3:ObjectCreated:PutLegalHold

data

s3:ObjectCreated:PutRetention

data

s3:ObjectCreated:PutTagging

data

s3:ObjectRemoved:Delete

data

s3:ObjectRemoved:DeleteMarkerCreated

data

Specify the wildcard * character to select all events related to a prefix:

s3:ObjectAccessed:*

data

Selects all s3:ObjectAccessed -prefixed events.

s3:ObjectCreated:*

data

Selects all s3:ObjectCreated -prefixed events.

s3:ObjectRemoved:*

data

Selects all s3:ObjectRemoved -prefixed events.

Replication events

MinIO supports triggering notifications on the following S3 replication events:

s3:Replication:OperationCompletedReplication

data

s3:Replication:OperationFailedReplication

data

s3:Replication:OperationMissedThreshold

data

s3:Replication:OperationNotTracked

data

s3:Replication:OperationReplicatedAfterThreshold

data

Specify the wildcard * character to select all s3:Replication events:

s3:Replication:*

data

ILM transition events

MinIO supports triggering notifications on the following S3 ILM transition events:

s3:ObjectRestore:Post

data

s3:ObjectRestore:Completed

data

s3:ObjectTransition:Failed

data

s3:ObjectTransition:Complete

data

Specify the wildcard * character to select all events related to a prefix:

s3:ObjectTransition:*

data

Selects all s3:ObjectTransition -prefixed events.

s3:ObjectRestore:*

data

Selects all s3:ObjectRestore -prefixed events.

Scanner events

MinIO supports triggering notifications on the following S3 scanner transition events:

s3:Scanner:ManyVersions

data

Scanner finds objects with more than 1,000 versions.

s3:Scanner:BigPrefix

data

Scanner finds prefixes with more than 50,000 sub-folders.

Global events

MinIO supports triggering notifications on the following global events. You can only listen to these events through the ListenNotification API:

s3:BucketCreated

data

s3:BucketRemoved

data

Payload schema

All notification payloads use the same overall schema. Depending on the type of notification, some fields may be omitted or have null values.

{
    "eventVersion": "string",
    "eventSource": "string",
    "awsRegion": "string",
    "eventTime": "string",
    "eventName": "string",
    "userIdentity": {
        "principalId": "string"
    },
    "requestParameters": {
        "key": "value"
    },
    "responseElements": {
        "key": "value"
    },
    "s3": {
        "s3SchemaVersion": "string",
        "configurationId": "string",
        "bucket": {
            "name": "string",
            "ownerIdentity": {
                "principalId": "string"
            },
            "arn": "string"
        },
        "object": {
            "key": "string",
            "size": 10000,
            "eTag": "string",
            "contentType": "string",
            "userMetadata": {
                "key": "string"
            },
            "versionId": "string",
            "sequencer": "string"
        }
    },
    "source": {
        "host": "string",
        "port": "string",
        "userAgent": "string"
    }
}

Example

The following example is a notification for an s3:ObjectCreated:Put event:

{
  "EventName": "s3:ObjectCreated:Put",
  "Key": "test-bucket/image.jpg",
  "Records": [
    {
      "eventVersion": "2.0",
      "eventSource": "minio:s3",
      "awsRegion": "",
      "eventTime": "2025-02-06T01:04:31.998Z",
      "eventName": "s3:ObjectCreated:Put",
      "userIdentity": {
        "principalId": "access_key"
      },
      "requestParameters": {
        "principalId": "access_key",
        "region": "",
        "sourceIPAddress": "192.168.1.10"
      },
      "responseElements": {
        "x-amz-id-2": "dd9025bab4ad464b049177c95eb6ebf374d3b3fd1af9251148b658df7ac2e3e8",
        "x-amz-request-id": "182178E8B36AC9DF",
        "x-minio-deployment-id": "2369dcb4-348b-4d30-8fc9-61ab089ba4bc",
        "x-minio-origin-endpoint": "https://minio.test.svc.cluster.local"
      },
      "s3": {
        "s3SchemaVersion": "1.0",
        "configurationId": "Config",
        "bucket": {
          "name": "test-bucket",
          "ownerIdentity": {
            "principalId": "access_key"
          },
          "arn": "arn:aws:s3:::test-bucket"
        },
        "object": {
          "key": "image.jpg",
          "size": 84452,
          "eTag": "eb52f8e46f60a27a8a1a704e25757f30",
          "contentType": "image/jpeg",
          "userMetadata": {
            "content-type": "image/jpeg"
          },
          "sequencer": "182178E8B3728CAC"
        }
      },
      "source": {
        "host": "192.168.1.10",
        "port": "",
        "userAgent": "MinIO (linux; amd64) minio-go/v7.0.83"
      }
    }
  ]
}

2 - Publish Events to AMQP (RabbitMQ)

MinIO supports publishing bucket notification events to a AMQP 0-9-1 service endpoint such as RabbitMQ.

MinIO relies on the https://github.com/streadway/amqp project for AMQP connectivity. The project is primarily tested against RabbitMQ deployments, though other AMQP 0-9-1-compatible services may also work. The procedures on this page assume a RabbitMQ deployment using the AMQP 0-9-1 protocol as the service endpoint.

Add an AMQP Endpoint to a MinIO Deployment

The following procedure adds a new AMQP service endpoint for supporting bucket notifications in a MinIO deployment.

Prerequisites

AMQP 0-9-1 Service Endpoint

MinIO relies on the https://github.com/streadway/amqp project for AMQP connectivity. The project is primarily tested against RabbitMQ deployments, though other AMQP 0-9-1-compatible services may also work. This procedure assumes a RabbitMQ deployment using the 0-9-1 protocol as the service endpoint.

If the AMQP service requires authentication, you must provide an appropriate username and password during the configuration process to grant MinIO access to the service.

MinIO mc Command Line Tool

This procedure uses the mc command line tool for certain actions. See the mc Quickstart for installation instructions.

1) Add the AMQP Endpoint to MinIO

You can configure a new AMQP service endpoint using either environment variables or by setting runtime configuration settings.

MinIO supports specifying the AMQP service endpoint and associated configuration settings using environment variables. The minio server process applies the specified settings on its next startup.

The following example code sets all environment variables related to configuring an AMQP service endpoint. The minimum required variables are MINIO_NOTIFY_AMQP_ENABLE and MINIO_NOTIFY_AMQP_URL:

Note

Windows

   set MINIO_NOTIFY_AMQP_ENABLE_<IDENTIFIER>="on"
   set MINIO_NOTIFY_AMQP_URL_<IDENTIFIER>="<ENDPOINT>"
   set MINIO_NOTIFY_AMQP_EXCHANGE_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_AMQP_EXCHANGE_TYPE_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_AMQP_ROUTING_KEY_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_AMQP_MANDATORY_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_AMQP_DURABLE_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_AMQP_NO_WAIT_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_AMQP_INTERNAL_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_AMQP_AUTO_DELETED_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_AMQP_DELIVERY_MODE_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_AMQP_QUEUE_DIR_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_AMQP_QUEUE_LIMIT_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_AMQP_COMMENT_<IDENTIFIER>="<string>"
Note

Linux and macOS

   export MINIO_NOTIFY_AMQP_ENABLE_<IDENTIFIER>="on"
   export MINIO_NOTIFY_AMQP_URL_<IDENTIFIER>="<ENDPOINT>"
   export MINIO_NOTIFY_AMQP_EXCHANGE_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_AMQP_EXCHANGE_TYPE_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_AMQP_ROUTING_KEY_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_AMQP_MANDATORY_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_AMQP_DURABLE_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_AMQP_NO_WAIT_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_AMQP_INTERNAL_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_AMQP_AUTO_DELETED_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_AMQP_DELIVERY_MODE_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_AMQP_QUEUE_DIR_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_AMQP_QUEUE_LIMIT_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_AMQP_COMMENT_<IDENTIFIER>="<string>"
  • Replace <IDENTIFIER> with a unique descriptive string for the AMQP service endpoint. Use the same <IDENTIFIER> value for all environment variables related to the new AMQP service endpoint. The following examples assume an identifier of PRIMARY.

    If the specified <IDENTIFIER> matches an existing AMQP service endpoint on the MinIO deployment, the new settings override any existing settings for that endpoint. Use mc admin config get notify_amqp to review the currently configured AMQP endpoints on the MinIO deployment.

  • Replace <ENDPOINT> with the URL of the AMQP service endpoint. For example:

    amqp://user:password@hostname:port

See AMQP Service for Bucket Notifications for complete documentation on each environment variable.

MinIO supports adding or updating AMQP endpoints on a running minio server process using the mc admin config set command and the notify_amqp configuration key. You must restart the minio server process to apply any new or updated configuration settings.

The following example code sets all settings related to configuring an AMQP service endpoint. The minimum required setting is notify_amqp url:

mc admin config set ALIAS/ notify_amqp:IDENTIFIER \
  url="ENDPOINT" \
  exchange="<string>" \
  exchange_type="<string>" \
  routing_key="<string>" \
  mandatory="<string>" \
  durable="<string>" \
  no_wait="<string>" \
  internal="<string>" \
  auto_deleted="<string>" \
  delivery_mode="<string>" \
  queue_dir="<string>" \
  queue_limit="<string>" \
  comment="<string>"
  • Replace IDENTIFIER with a unique descriptive string for the AMQP service endpoint. The following examples in this procedure assume an identifier of PRIMARY.

    If the specified IDENTIFIER matches an existing AMQP service endpoint on the MinIO deployment, the new settings override any existing settings for that endpoint. Use mc admin config get notify_amqp to review the currently configured AMQP endpoints on the MinIO deployment.

  • Replace ENDPOINT with the URL of the AMQP service endpoint. For example:

    amqp://user:password@hostname:port

See AMQP Bucket Notification Configuration Settings for complete documentation on each setting.

1) Restart the MinIO Deployment

You must restart the MinIO deployment to apply the configuration changes. Use the mc admin service restart command to restart the deployment.

mc admin service restart ALIAS

Replace ALIAS with the alias of the deployment to restart.

The minio server process prints a line on startup for each configured AMQP target similar to the following:

SQS ARNs: arn:minio:sqs::primary:amqp

You must specify the ARN resource when configuring bucket notifications with the associated AMQP deployment as a target.

Note

Identifying the ARN for your bucket notifications

You defined the <IDENTIFIER> to assign to the target ARN for your bucket notifications when creating the endpoint previously. The steps below return the ARNs configured on the deployment. Identify the ARN created previously by looking for the <IDENTIFIER> you specified.

Review the JSON output

  1. Copy and run the following command, replacing ALIAS with the alias of the deployment.

    mc admin info --json ALIAS
  2. In the JSON output, look for the key info.sqsARN.

    The ARN you need is the value of that key that matches the <IDENTIFIER> you specified.

    For example, arn:minio:sqs::primary:amqp.

Use jq to parse the JSON for the value

  1. Install jq

  2. Copy and run the following command, replacing ALIAS with the alias of the deployment.

    mc admin info --json ALIAS | jq  .info.sqsARN

    This returns the ARN to use for notifications, such as arn:minio:sqs::primary:amqp

3) Configure Bucket Notifications using the AMQP Endpoint as a Target

Use the mc event add command to add a new bucket notification event with the configured AMQP service as a target:

mc event add ALIAS/BUCKET arn:minio:sqs::primary:amqp \
  --event EVENTS
  • Replace ALIAS with the alias of a MinIO deployment.
  • Replace BUCKET with the name of the bucket in which to configure the event.
  • Replace EVENTS with a comma-separated list of events for which MinIO triggers notifications.

Use mc event ls to view all configured bucket events for a given notification target:

mc event ls ALIAS/BUCKET arn:minio:sqs::primary:amqp

4) Validate the Configured Events

Perform an action on the bucket for which you configured the new event and check the AMQP service for the notification data. The action required depends on which events were specified when configuring the bucket notification.

For example, if the bucket notification configuration includes the s3:ObjectCreated:Put event, you can use the mc cp command to create a new object in the bucket and trigger a notification.

mc cp ~/data/new-object.txt ALIAS/BUCKET

Update an AMQP Endpoint in a MinIO Deployment

The following procedure updates an existing AMQP service endpoint for supporting bucket notifications in a MinIO deployment.

Prerequisites

AMQP 0-9-1 Service Endpoint

MinIO relies on the https://github.com/streadway/amqp project for AMQP connectivity. The project is primarily tested against RabbitMQ deployments, though other AMQP 0-9-1-compatible services may also work. This procedure assumes a RabbitMQ deployment as the service endpoint.

If the AMQP service requires authentication, you must provide an appropriate username and password during the configuration process to grant MinIO access to the service.

MinIO mc Command Line Tool

This procedure uses the mc command line tool for certain actions. See the mc Quickstart for installation instructions.

1) List Configured AMQP Endpoints In The Deployment

Use the mc admin config get command to list the currently configured AMQP service endpoints in the deployment:

mc admin config get ALIAS/ notify_amqp

Replace ALIAS with the alias of the MinIO deployment.

The command output resembles the following:

notify_amqp:primary delivery_mode="0" exchange_type="" no_wait="off" queue_dir="" queue_limit="0"  url="amqp://user:password@hostname:port" auto_deleted="off" durable="off" exchange="" internal="off" mandatory="off" routing_key=""
notify_amqp:secondary delivery_mode="0" exchange_type="" no_wait="off" queue_dir="" queue_limit="0"  url="amqp://user:password@hostname:port" auto_deleted="off" durable="off" exchange="" internal="off" mandatory="off" routing_key=""

The notify_amqp key is the top-level configuration key for an AMQP Notification Settings. The url key specifies the AMQP service endpoint for the given notify_amqp key. The notify_amqp:<IDENTIFIER> suffix describes the unique identifier for that AMQP service endpoint.

Note the identifier for the AMQP service endpoint you want to update for the next step.

2) Update the AMQP Endpoint

Use the mc admin config set command to set the new configuration for the AMQP service endpoint:

mc admin config set ALIAS/ notify_amqp:<IDENTIFIER> \
   url="amqp://user:password@hostname:port" \
   exchange="<string>" \
   exchange_type="<string>" \
   routing_key="<string>" \
   mandatory="<string>" \
   durable="<string>" \
   no_wait="<string>" \
   internal="<string>" \
   auto_deleted="<string>" \
   delivery_mode="<string>" \
   queue_dir="<string>" \
   queue_limit="<string>" \
   comment="<string>"

The notify_amqp url configuration setting is the minimum required for an AMQP service endpoint. All other configuration settings are optional. See AMQP Notification Settings for a complete list of AMQP configuration settings.

3) Restart the MinIO Deployment

You must restart the MinIO deployment to apply the configuration changes. Use the mc admin service restart command to restart the deployment.

mc admin service restart ALIAS

Replace ALIAS with the alias of the deployment to restart.

The minio server process prints a line on startup for each configured AMQP target similar to the following:

SQS ARNs: arn:minio:sqs::primary:amqp

4) Validate the Changes

Perform an action on a bucket which has an event configuration using the updated AMQP service endpoint and check the AMQP service for the notification data. The action required depends on which events were specified when configuring the bucket notification.

For example, if the bucket notification configuration includes the s3:ObjectCreated:Put event, you can use the mc cp command to create a new object in the bucket and trigger a notification.

mc cp ~/data/new-object.txt ALIAS/BUCKET

3 - Publish Events to MQTT

MinIO supports publishing bucket notification events to MQTT server/broker endpoint.

Add an MQTT Endpoint to a MinIO Deployment

The following procedure adds a new MQTT service endpoint for supporting bucket notifications in a MinIO deployment.

Prerequisites

MQTT 3.1 or 3.1.1 Server/Broker

This procedure assumes an existing MQTT 3.1 or 3.1.1 server/broker to which the MinIO deployment has connectivity. See the mqtt.org software listing for a list of MQTT-compatible server/brokers.

If the MQTT service requires authentication, you must provide an appropriate username and password during the configuration process to grant MinIO access to the service.

MinIO mc Command Line Tool

This procedure uses the mc command line tool for certain actions. See the mc Quickstart for installation instructions.

1) Add the MQTT Endpoint to MinIO

You can configure a new MQTT service endpoint using either environment variables or by setting runtime configuration settings.

MinIO supports specifying the MQTT service endpoint and associated configuration settings using environment variables. The minio server process applies the specified settings on its next startup.

The following example code sets all environment variables related to configuring an MQTT service endpoint. The minimum required variables are:

Note

Windows

   set MINIO_NOTIFY_MQTT_ENABLE_<IDENTIFIER>="on"
   set MINIO_NOTIFY_MQTT_BROKER_<IDENTIFIER>="ENDPOINT"
   set MINIO_NOTIFY_MQTT_TOPIC_<IDENTIFIER>="TOPIC"
   set MINIO_NOTIFY_MQTT_USERNAME_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_MQTT_PASSWORD_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_MQTT_QOS_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_MQTT_KEEP_ALIVE_INTERVAL_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_MQTT_RECONNECT_INTERVAL_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_MQTT_QUEUE_DIR_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_MQTT_QUEUE_LIMIT_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_MQTT_COMMENT_<IDENTIFIER>="<string>"
Note

Linux and macOS

   export MINIO_NOTIFY_MQTT_ENABLE_<IDENTIFIER>="on"
   export MINIO_NOTIFY_MQTT_BROKER_<IDENTIFIER>="ENDPOINT"
   export MINIO_NOTIFY_MQTT_TOPIC_<IDENTIFIER>="TOPIC"
   export MINIO_NOTIFY_MQTT_USERNAME_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_MQTT_PASSWORD_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_MQTT_QOS_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_MQTT_KEEP_ALIVE_INTERVAL_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_MQTT_RECONNECT_INTERVAL_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_MQTT_QUEUE_DIR_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_MQTT_QUEUE_LIMIT_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_MQTT_COMMENT_<IDENTIFIER>="<string>"
  • Replace <IDENTIFIER> with a unique descriptive string for the MQTT service endpoint. Use the same <IDENTIFIER> value for all environment variables related to the new MQTT service endpoint. The following examples assume an identifier of PRIMARY.

    If the specified <IDENTIFIER> matches an existing MQTT service endpoint on the MinIO deployment, the new settings override any existing settings for that endpoint. Use mc admin config get notify_mqtt to review the currently configured MQTT endpoints on the MinIO deployment.

  • Replace <ENDPOINT> with the URL of the MQTT service endpoint. For example:

    tcp://hostname:port

  • Replace TOPIC with the MQTT topic to which MinIO associates events published to the server/broker.

See MQTT Service for Bucket Notifications for complete documentation on each environment variable.

MinIO supports adding or updating MQTT endpoints on a running minio server process using the mc admin config set command and the notify_mqtt configuration key. You must restart the minio server process to apply any new or updated configuration settings.

The following example code sets all settings related to configuring an MQTT service endpoint. The following configuration settings are the minimum required for an MQTT server/broker endpoint:

  • broker
  • topic
  • username Required if the MQTT server/broker enforces authentication/authorization
  • password Required if the MQTT server/broker enforces authentication/authorization
mc admin config set ALIAS/ notify_mqtt:IDENTIFIER \
   broker="ENDPOINT" \
   topic="TOPIC" \
   username="username" \
   password="password" \
   qos="<integer>" \
   keep_alive_interval="60s|m|h|d"
   reconnect_interval="60s|m|h|d"
   queue_dir="<string>" \
   queue_limit="<string>" \
   comment="<string>"
  • Replace IDENTIFIER with a unique descriptive string for the MQTT service endpoint. The following examples in this procedure assume an identifier of PRIMARY.

    If the specified IDENTIFIER matches an existing MQTT service endpoint on the MinIO deployment, the new settings override any existing settings for that endpoint. Use mc admin config get notify_mqtt to review the currently configured MQTT endpoints on the MinIO deployment.

  • Replace ENDPOINT with the URL of the MQTT service endpoint. For example:

    tcp://hostname:port

  • Replace TOPIC with the MQTT topic to which MinIO associates events published to the server/broker.

See MQTT Bucket Notification Configuration Settings for complete documentation on each setting.

1) Restart the MinIO Deployment

You must restart the MinIO deployment to apply the configuration changes. Use the mc admin service restart command to restart the deployment.

mc admin service restart ALIAS

Replace ALIAS with the alias of the deployment to restart.

The minio server process prints a line on startup for each configured MQTT target similar to the following:

SQS ARNs: arn:minio:sqs::primary:mqtt

You must specify the ARN resource when configuring bucket notifications with the associated MQTT deployment as a target.

Note

Identifying the ARN for your bucket notifications

You defined the <IDENTIFIER> to assign to the target ARN for your bucket notifications when creating the endpoint previously. The steps below return the ARNs configured on the deployment. Identify the ARN created previously by looking for the <IDENTIFIER> you specified.

Review the JSON output

  1. Copy and run the following command, replacing ALIAS with the alias of the deployment.

    mc admin info --json ALIAS
  2. In the JSON output, look for the key info.sqsARN.

    The ARN you need is the value of that key that matches the <IDENTIFIER> you specified.

    For example, arn:minio:sqs::primary:mqtt.

Use jq to parse the JSON for the value

  1. Install jq

  2. Copy and run the following command, replacing ALIAS with the alias of the deployment.

    mc admin info --json ALIAS | jq  .info.sqsARN

    This returns the ARN to use for notifications, such as arn:minio:sqs::primary:mqtt

1) Configure Bucket Notifications using the MQTT Endpoint as a Target

Use the mc event add command to add a new bucket notification event with the configured MQTT service as a target:

mc event add ALIAS/BUCKET arn:minio:sqs::primary:mqtt \
  --event EVENTS
  • Replace ALIAS with the alias of a MinIO deployment.
  • Replace BUCKET with the name of the bucket in which to configure the event.
  • Replace EVENTS with a comma-separated list of events for which MinIO triggers notifications.

Use mc event ls to view all configured bucket events for a given notification target:

mc event ls ALIAS/BUCKET arn:minio:sqs::primary:MQTT

4) Validate the Configured Events

Perform an action on the bucket for which you configured the new event and check the MQTT service for the notification data. The action required depends on which events were specified when configuring the bucket notification.

For example, if the bucket notification configuration includes the s3:ObjectCreated:Put event, you can use the mc cp command to create a new object in the bucket and trigger a notification.

mc cp ~/data/new-object.txt ALIAS/BUCKET

Update an MQTT Endpoint in a MinIO Deployment

The following procedure updates an existing MQTT service endpoint for supporting bucket notifications in a MinIO deployment.

Prerequisites

MQTT 3.1 or 3.1.1 Server/Broker Endpoint

This procedure assumes an existing MQTT 3.1 or 3.1.1 server/broker to which the MinIO deployment has connectivity. See the mqtt.org software listing for a list of MQTT-compatible server/brokers.

If the MQTT service requires authentication, you must provide an appropriate username and password during the configuration process to grant MinIO access to the service.

MinIO mc Command Line Tool

This procedure uses the mc command line tool for certain actions. See the mc Quickstart for installation instructions.

1) List Configured MQTT Endpoints In The Deployment

Use the mc admin config get command to list the currently configured MQTT service endpoints in the deployment:

mc admin config get ALIAS/ notify_mqtt

Replace ALIAS with the alias of the MinIO deployment.

The command output resembles the following:

notify_mqtt:primary  broker="tcp://mqtt-primary.example.net:port" password="" queue_dir="" queue_limit="0" reconnect_interval="0s"  keep_alive_interval="0s" qos="0" topic="" username=""
notify_mqtt:secondary  broker="tcp://mqtt-primary.example.net:port" password="" queue_dir="" queue_limit="0" reconnect_interval="0s"  keep_alive_interval="0s" qos="0" topic="" username=""

The notify_mqtt key is the top-level configuration key for an MQTT Notification Settings. The broker key specifies the MQTT server/broker endpoint for the given notify_mqtt key. The notify_mqtt:<IDENTIFIER> suffix describes the unique identifier for that MQTT service endpoint.

Note the identifier for the MQTT service endpoint you want to update for the next step.

2) Update the MQTT Endpoint

Use the mc admin config set command to set the new configuration for the MQTT service endpoint:

mc admin config set ALIAS/ notify_mqtt:<IDENTIFIER> \
   url="MQTT://user:password@hostname:port" \
   exchange="<string>" \
   exchange_type="<string>" \
   routing_key="<string>" \
   mandatory="<string>" \
   durable="<string>" \
   no_wait="<string>" \
   internal="<string>" \
   auto_deleted="<string>" \
   delivery_mode="<string>" \
   queue_dir="<string>" \
   queue_limit="<string>" \
   comment="<string>"

The following configuration settings are the minimum required for an MQTT server/broker endpoint:

  • broker
  • topic
  • username Required if the MQTT server/broker enforces authentication/authorization
  • password Required if the MQTT server/broker enforces authentication/authorization

All other configuration settings are optional. See MQTT Notification Settings for a complete list of MQTT configuration settings.

3) Restart the MinIO Deployment

You must restart the MinIO deployment to apply the configuration changes. Use the mc admin service restart command to restart the deployment.

mc admin service restart ALIAS

Replace ALIAS with the alias of the deployment to restart.

The minio server process prints a line on startup for each configured MQTT target similar to the following:

SQS ARNs: arn:minio:sqs::primary:mqtt

3) Validate the Changes

Perform an action on a bucket which has an event configuration using the updated MQTT service endpoint and check the MQTT service for the notification data. The action required depends on which events were specified when configuring the bucket notification.

For example, if the bucket notification configuration includes the s3:ObjectCreated:Put event, you can use the mc cp command to create a new object in the bucket and trigger a notification.

mc cp ~/data/new-object.txt ALIAS/BUCKET

4 - Publish Events to NATS

MinIO supports publishing bucket notification events to a NATS service endpoint.

Note

NATS Streaming Deprecated

NATS Streaming is deprecated. Migrate to JetStream instead.

The related MinIO configuration options and environment variables are deprecated.

Add a NATS Endpoint to a MinIO Deployment

The following procedure adds a new NATS service endpoint for supporting bucket notifications in a MinIO deployment.

Prerequisites

MinIO mc Command Line Tool

This procedure uses the mc command line tool for certain actions. See the mc Quickstart for installation instructions.

1) Add the NATS Endpoint to MinIO

You can configure a new NATS service endpoint using either environment variables or by setting runtime configuration settings.

MinIO supports specifying the NATS service endpoint and associated configuration settings using environment variables. The minio server process applies the specified settings on its next startup.

The following example code sets all environment variables related to configuring an NATS service endpoint. The minimum required variables are MINIO_NOTIFY_NATS_ADDRESS and MINIO_NOTIFY_NATS_SUBJECT:

Note

Windows

   set MINIO_NOTIFY_NATS_ENABLE_<IDENTIFIER>="on"
   set MINIO_NOTIFY_NATS_ADDRESS_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_NATS_SUBJECT_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_NATS_USERNAME_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_NATS_PASSWORD_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_NATS_TOKEN_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_NATS_TLS_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_NATS_TLS_SKIP_VERIFY_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_NATS_PING_INTERVAL_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_NATS_QUEUE_DIR_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_NATS_QUEUE_LIMIT_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_NATS_CERT_AUTHORITY_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_NATS_CLIENT_CERT_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_NATS_CLIENT_KEY_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_NATS_COMMENT_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_NATS_JETSTREAM_<IDENTIFIER>="<string>"
Note

Linux and macOS

   export MINIO_NOTIFY_NATS_ENABLE_<IDENTIFIER>="on"
   export MINIO_NOTIFY_NATS_ADDRESS_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_NATS_SUBJECT_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_NATS_USERNAME_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_NATS_PASSWORD_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_NATS_TOKEN_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_NATS_TLS_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_NATS_TLS_SKIP_VERIFY_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_NATS_PING_INTERVAL_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_NATS_QUEUE_DIR_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_NATS_QUEUE_LIMIT_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_NATS_CERT_AUTHORITY_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_NATS_CLIENT_CERT_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_NATS_CLIENT_KEY_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_NATS_COMMENT_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_NATS_JETSTREAM_<IDENTIFIER>="<string>"
  • Replace <IDENTIFIER> with a unique descriptive string for the NATS service endpoint. Use the same <IDENTIFIER> value for all environment variables related to the new target service endpoint. The following examples assume an identifier of PRIMARY.

    If the specified <IDENTIFIER> matches an existing NATS service endpoint on the MinIO deployment, the new settings override any existing settings for that endpoint. Use mc admin config get notify_nats to review the currently configured NATS endpoints on the MinIO deployment.

  • Replace <ENDPOINT> with the hostname and port of the NATS service endpoint. For example: nats-endpoint.example.com:4222

See NATS Service for Bucket Notifications for complete documentation on each environment variable.

MinIO supports adding or updating NATS endpoints on a running minio server process using the mc admin config set command and the notify_nats configuration key. You must restart the minio server process to apply any new or updated configuration settings.

The following example code sets all settings related to configuring an NATS service endpoint. The minimum required setting are notify_nats address and notify_nats subject:

mc admin config set ALIAS/ notify_nats:IDENTIFIER \
   address="HOSTNAME" \
   subject="<string>" \
   username="<string>" \
   password="<string>" \
   token="<string>" \
   nats_jetstream="<string>" \
   tls="<string>" \
   tls_skip_verify="<string>" \
   ping_interval="<string>" \
   cert_authority="<string>" \
   client_cert="<string>" \
   client_key="<string>" \
   queue_dir="<string>" \
   queue_limit="<string>" \
   comment="<string>"
  • Replace IDENTIFIER with a unique descriptive string for the NATS service endpoint. The following examples in this procedure assume an identifier of PRIMARY.

    If the specified IDENTIFIER matches an existing NATS service endpoint on the MinIO deployment, the new settings override any existing settings for that endpoint. Use mc admin config get notify_nats to review the currently configured NATS endpoints on the MinIO deployment.

  • Replace ENDPOINT with the hostname and port of the NATS service endpoint. For example: nats-endpoint.example.com:4222.

See NATS Bucket Notification Configuration Settings for complete documentation on each setting.

1) Restart the MinIO Deployment

You must restart the MinIO deployment to apply the configuration changes. Use the mc admin service restart command to restart the deployment.

mc admin service restart ALIAS

Replace ALIAS with the alias of the deployment to restart.

The minio server process prints a line on startup for each configured NATS target similar to the following:

SQS ARNs: arn:minio:sqs::primary:nats

You must specify the ARN resource when configuring bucket notifications with the associated NATS deployment as a target.

Note

Identifying the ARN for your bucket notifications

You defined the <IDENTIFIER> to assign to the target ARN for your bucket notifications when creating the endpoint previously. The steps below return the ARNs configured on the deployment. Identify the ARN created previously by looking for the <IDENTIFIER> you specified.

Review the JSON output

  1. Copy and run the following command, replacing ALIAS with the alias of the deployment.

    mc admin info --json ALIAS
  2. In the JSON output, look for the key info.sqsARN.

    The ARN you need is the value of that key that matches the <IDENTIFIER> you specified.

    For example, arn:minio:sqs::primary:nats.

Use jq to parse the JSON for the value

  1. Install jq

  2. Copy and run the following command, replacing ALIAS with the alias of the deployment.

    mc admin info --json ALIAS | jq  .info.sqsARN

    This returns the ARN to use for notifications, such as arn:minio:sqs::primary:nats

3) Configure Bucket Notifications using the NATS Endpoint as a Target

Use the mc event add command to add a new bucket notification event with the configured NATS service as a target:

mc event add ALIAS/BUCKET arn:minio:sqs::primary:nats \
  --event EVENTS
  • Replace ALIAS with the alias of a MinIO deployment.
  • Replace BUCKET with the name of the bucket in which to configure the event.
  • Replace EVENTS with a comma-separated list of events for which MinIO triggers notifications.

Use mc event ls to view all configured bucket events for a given notification target:

mc event ls ALIAS/BUCKET arn:minio:sqs::primary:nats

4) Validate the Configured Events

Perform an action on the bucket for which you configured the new event and check the NATS service for the notification data. The action required depends on which events were specified when configuring the bucket notification.

For example, if the bucket notification configuration includes the s3:ObjectCreated:Put event, you can use the mc cp command to create a new object in the bucket and trigger a notification.

mc cp ~/data/new-object.txt ALIAS/BUCKET

Update an NATS Endpoint in a MinIO Deployment

The following procedure updates an existing NATS service endpoint for supporting bucket notifications in a MinIO deployment.

Prerequisites

MinIO mc Command Line Tool

This procedure uses the mc command line tool for certain actions. See the mc Quickstart for installation instructions.

1) List Configured NATS Endpoints In The Deployment

Use the mc admin config get command to list the currently configured NATS service endpoints in the deployment:

mc admin config get ALIAS/ notify_nats

Replace ALIAS with the alias of the MinIO deployment.

The command output resembles the following:

notify_nats:primary password="yoursecret" subject="" address="nats-endpoint.example.com:4222"  token="" username="yourusername" ping_interval="0" queue_limit="0" tls="off" tls_skip_verify="off" queue_dir="" streaming_enable="on" nats_jetstream="on"
notify_nats:secondary password="yoursecret" subject="" address="nats-endpoint.example.com:4222"  token="" username="yourusername" ping_interval="0" queue_limit="0" tls="off" tls_skip_verify="off" queue_dir="" streaming_enable="on" nats_jetstream="on"

The notify_nats key is the top-level configuration key for an NATS Notification Settings. The address key specifies the NATS service endpoint for the given notify_nats key. The notify_nats:<IDENTIFIER> suffix describes the unique identifier for that NATS service endpoint.

Note the identifier for the NATS service endpoint you want to update for the next step.

2) Update the NATS Endpoint

Use the mc admin config set command to set the new configuration for the NATS service endpoint:

mc admin config set ALIAS/ notify_nats:IDENTIFIER \
   address="HOSTNAME" \
   subject="<string>" \
   username="<string>" \
   password="<string>" \
   token="<string>" \
   tls="<string>" \
   tls_skip_verify="<string>" \
   ping_interval="<string>" \
   nats_jetstream="<string>" \
   cert_authority="<string>" \
   client_cert="<string>" \
   client_key="<string>" \
   queue_dir="<string>" \
   queue_limit="<string>" \
   comment="<string>"

The notify_nats address configuration setting is the minimum required for an NATS service endpoint. All other configuration settings are optional. See NATS Notification Settings for a complete list of NATS configuration settings.

3) Restart the MinIO Deployment

You must restart the MinIO deployment to apply the configuration changes. Use the mc admin service restart command to restart the deployment.

mc admin service restart ALIAS

Replace ALIAS with the alias of the deployment to restart.

The minio server process prints a line on startup for each configured NATS target similar to the following:

SQS ARNs: arn:minio:sqs::primary:nats

4) Validate the Changes

Perform an action on a bucket which has an event configuration using the updated NATS service endpoint and check the NATS service for the notification data. The action required depends on which events were specified when configuring the bucket notification.

For example, if the bucket notification configuration includes the s3:ObjectCreated:Put event, you can use the mc cp command to create a new object in the bucket and trigger a notification.

mc cp ~/data/new-object.txt ALIAS/BUCKET

5 - Publish Events to NSQ

MinIO supports publishing bucket notification events to NSQ service endpoint.

Add a NSQ Endpoint to a MinIO Deployment

The following procedure adds a new NSQ service endpoint for supporting bucket notifications in a MinIO deployment.

Prerequisites

MinIO mc Command Line Tool

This procedure uses the mc command line tool for certain actions. See the mc Quickstart for installation instructions.

1) Add the NSQ Endpoint to MinIO

You can configure a new NSQ service endpoint using either environment variables or by setting runtime configuration settings.

MinIO supports specifying the NSQ service endpoint and associated configuration settings using environment variables. The minio server process applies the specified settings on its next startup.

The following example code sets all environment variables related to configuring an NSQ service endpoint. The minimum required variables are MINIO_NOTIFY_NSQ_NSQD_ADDRESS and MINIO_NOTIFY_NSQ_TOPIC:

Note

Windows

   set MINIO_NOTIFY_NSQ_ENABLE_<IDENTIFIER>="on"
   set MINIO_NOTIFY_NSQ_NSQD_ADDRESS_<IDENTIFIER>="<ENDPOINT>"
   set MINIO_NOTIFY_NSQ_TOPIC_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_NSQ_TLS_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_NSQ_TLS_SKIP_VERIFY_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_NSQ_QUEUE_DIR_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_NSQ_QUEUE_LIMIT_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_NSQ_COMMENT_<IDENTIFIER>="<string>"
Note

Linux and macOS

   export MINIO_NOTIFY_NSQ_ENABLE_<IDENTIFIER>="on"
   export MINIO_NOTIFY_NSQ_NSQD_ADDRESS_<IDENTIFIER>="<ENDPOINT>"
   export MINIO_NOTIFY_NSQ_TOPIC_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_NSQ_TLS_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_NSQ_TLS_SKIP_VERIFY_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_NSQ_QUEUE_DIR_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_NSQ_QUEUE_LIMIT_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_NSQ_COMMENT_<IDENTIFIER>="<string>"
  • Replace <IDENTIFIER> with a unique descriptive string for the TARGET service endpoint. Use the same <IDENTIFIER> value for all environment variables related to the new target service endpoint. The following examples assume an identifier of PRIMARY.

    If the specified <IDENTIFIER> matches an existing NSQ service endpoint on the MinIO deployment, the new settings override any existing settings for that endpoint. Use mc admin config get notify_nsq to review the currently configured NSQ endpoints on the MinIO deployment.

  • Replace <ENDPOINT> with the URL of the NSQ service endpoint. For example, https://nsq-service.example.com:4150.

See NSQ Service for Bucket Notifications for complete documentation on each environment variable.

MinIO supports adding or updating NSQ endpoints on a running minio server process using the mc admin config set command and the notify_nsq configuration key. You must restart the minio server process to apply any new or updated configuration settings.

The following example code sets all settings related to configuring an NSQ service endpoint. The minimum required setting is notify_nsq nsqd_address and notify_nsq topic:

mc admin config set ALIAS/ notify_nsq:IDENTIFIER \
  nsqd_address="ENDPOINT" \
  topic="<string>" \
  tls="<string>" \
  tls_skip_verify="<string>" \
  queue_dir="<string>" \
  queue_limit="<string>" \
  comment="<string>"
  • Replace IDENTIFIER with a unique descriptive string for the NSQ service endpoint. The following examples in this procedure assume an identifier of PRIMARY.

    If the specified IDENTIFIER matches an existing NSQ service endpoint on the MinIO deployment, the new settings override any existing settings for that endpoint. Use mc admin config get notify_nsq to review the currently configured NSQ endpoints on the MinIO deployment.

  • Replace ENDPOINT with the URL of the NSQ service endpoint. For example:

    NSQ://user:password@hostname:port

See NSQ Bucket Notification Configuration Settings for complete documentation on each setting.

1) Restart the MinIO Deployment

You must restart the MinIO deployment to apply the configuration changes. Use the mc admin service restart command to restart the deployment.

mc admin service restart ALIAS

Replace ALIAS with the alias of the deployment to restart.

The minio server process prints a line on startup for each configured NSQ target similar to the following:

SQS ARNs: |ARN|

You must specify the ARN resource when configuring bucket notifications with the associated NSQ deployment as a target.

Note

Identifying the ARN for your bucket notifications

You defined the <IDENTIFIER> to assign to the target ARN for your bucket notifications when creating the endpoint previously. The steps below return the ARNs configured on the deployment. Identify the ARN created previously by looking for the <IDENTIFIER> you specified.

Review the JSON output

  1. Copy and run the following command, replacing ALIAS with the alias of the deployment.

    mc admin info --json ALIAS
  2. In the JSON output, look for the key info.sqsARN.

    The ARN you need is the value of that key that matches the <IDENTIFIER> you specified.

    For example, arn:minio:sqs::primary:nsq.

Use jq to parse the JSON for the value

  1. Install jq

  2. Copy and run the following command, replacing ALIAS with the alias of the deployment.

    mc admin info --json ALIAS | jq  .info.sqsARN

    This returns the ARN to use for notifications, such as arn:minio:sqs::primary:nsq

3) Configure Bucket Notifications using the NSQ Endpoint as a Target

Use the mc event add command to add a new bucket notification event with the configured NSQ service as a target:

mc event add ALIAS/BUCKET arn:minio:sqs::primary:nsq \
  --event EVENTS
  • Replace ALIAS with the alias of a MinIO deployment.
  • Replace BUCKET with the name of the bucket in which to configure the event.
  • Replace EVENTS with a comma-separated list of events for which MinIO triggers notifications.

Use mc event ls to view all configured bucket events for a given notification target:

mc event ls ALIAS/BUCKET arn:minio:sqs::primary:nsq

4) Validate the Configured Events

Perform an action on the bucket for which you configured the new event and check the NSQ service for the notification data. The action required depends on which events were specified when configuring the bucket notification.

For example, if the bucket notification configuration includes the s3:ObjectCreated:Put event, you can use the mc cp command to create a new object in the bucket and trigger a notification.

mc cp ~/data/new-object.txt ALIAS/BUCKET

Update an NSQ Endpoint in a MinIO Deployment

The following procedure updates an existing NSQ service endpoint for supporting bucket notifications in a MinIO deployment.

Prerequisites

MinIO mc Command Line Tool

This procedure uses the mc command line tool for certain actions. See the mc Quickstart for installation instructions.

1) List Configured NSQ Endpoints In The Deployment

Use the mc admin config get command to list the currently configured NSQ service endpoints in the deployment:

mc admin config get ALIAS/ notify_nsq

Replace ALIAS with the alias of the MinIO deployment.

The command output resembles the following:

notify_nsq:primary nsqd_address="https://nsq.example.com" queue_dir="" queue_limit="0"  tls="off" tls_skip_verify="off" topic=""
notify_nsq:secondary nsqd_address="https://nsq.example.com" queue_dir="" queue_limit="0"  tls="off" tls_skip_verify="off" topic=""

The notify_nsq key is the top-level configuration key for an NSQ Notification Settings. The nsqd_address key specifies the NSQ service endpoint for the given notify_nsq key. The notify_nsq:<IDENTIFIER> suffix describes the unique identifier for that NSQ service endpoint.

Note the identifier for the NSQ service endpoint you want to update for the next step.

2) Update the NSQ Endpoint

Use the mc admin config set command to set the new configuration for the NSQ service endpoint:

mc admin config set ALIAS/ notify_nsq:<IDENTIFIER> \
   nsqd_address="NSQ://user:password@hostname:port" \
   topic="<string>" \
   tls="<string>" \
   tls_skip_verify="<string>" \
   queue_dir="<string>" \
   queue_limit="<string>" \
   comment="<string>"

The notify_nsq nsqd_address configuration setting is the minimum required for an NSQ service endpoint. All other configuration settings are optional. See NSQ Notification Settings for a complete list of NSQ configuration settings.

3) Restart the MinIO Deployment

You must restart the MinIO deployment to apply the configuration changes. Use the mc admin service restart command to restart the deployment.

mc admin service restart ALIAS

Replace ALIAS with the alias of the deployment to restart.

The minio server process prints a line on startup for each configured NSQ target similar to the following:

SQS ARNs: arn:minio:sqs::primary:NSQ

4) Validate the Changes

Perform an action on a bucket which has an event configuration using the updated NSQ service endpoint and check the NSQ service for the notification data. The action required depends on which events were specified when configuring the bucket notification.

For example, if the bucket notification configuration includes the s3:ObjectCreated:Put event, you can use the mc cp command to create a new object in the bucket and trigger a notification.

mc cp ~/data/new-object.txt ALIAS/BUCKET

6 - Publish Events to Elasticsearch

MinIO supports publishing bucket notification events to an Elasticsearch service endpoint.

MinIO relies on the https://github.com/elastic/go-elasticsearch v7 project for Elastic connectivity.

Add a Elasticsearch Endpoint to a MinIO Deployment

The following procedure adds a new Elasticsearch service endpoint for supporting bucket notifications in a MinIO deployment.

Prerequisites

Elasticsearch v7.0 and later

MinIO relies on the https://github.com/olivere/elastic v7 project for Elastic connectivity. The elastic/v7 library specifically targets Elasticsearch v7.0 and is not compatible with earlier Elasticsearch versions.

MinIO mc Command Line Tool

This procedure uses the mc command line tool for certain actions. See the mc Quickstart for installation instructions.

1) Add the Elasticsearch Endpoint to MinIO

You can configure a new Elasticsearch service endpoint using either environment variables or by setting runtime configuration settings.

MinIO supports specifying the Elasticsearch service endpoint and associated configuration settings using environment variables. The minio server process applies the specified settings on its next startup.

The following example code sets all environment variables related to configuring an Elasticsearch service endpoint. The minimum required variables are:

Note

Windows

   set MINIO_NOTIFY_ELASTICSEARCH_ENABLE_<IDENTIFIER>="on"
   set MINIO_NOTIFY_ELASTICSEARCH_URL_<IDENTIFIER>="<ENDPOINT>"
   set MINIO_NOTIFY_ELASTICSEARCH_INDEX_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_ELASTICSEARCH_FORMAT_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_ELASTICSEARCH_USERNAME_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_ELASTICSEARCH_PASSWORD_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_ELASTICSEARCH_QUEUE_DIR_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_ELASTICSEARCH_QUEUE_LIMIT_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_ELASTICSEARCH_COMMENT_<IDENTIFIER>="<string>"
Note

Linux and macOS

   export MINIO_NOTIFY_ELASTICSEARCH_ENABLE_<IDENTIFIER>="on"
   export MINIO_NOTIFY_ELASTICSEARCH_URL_<IDENTIFIER>="<ENDPOINT>"
   export MINIO_NOTIFY_ELASTICSEARCH_INDEX_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_ELASTICSEARCH_FORMAT_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_ELASTICSEARCH_USERNAME_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_ELASTICSEARCH_PASSWORD_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_ELASTICSEARCH_QUEUE_DIR_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_ELASTICSEARCH_QUEUE_LIMIT_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_ELASTICSEARCH_COMMENT_<IDENTIFIER>="<string>"
  • Replace <IDENTIFIER> with a unique descriptive string for the TARGET service endpoint. Use the same <IDENTIFIER> value for all environment variables related to the new target service endpoint. The following examples assume an identifier of PRIMARY.

    If the specified <IDENTIFIER> matches an existing Elasticsearch service endpoint on the MinIO deployment, the new settings override any existing settings for that endpoint. Use mc admin config get notify_elasticsearch to review the currently configured Elasticsearch endpoints on the MinIO deployment.

  • Replace <ENDPOINT> with the URL of the Elasticsearch service endpoint. For example:

See Elasticsearch Service for Bucket Notifications for complete documentation on each environment variable.

MinIO supports adding or updating Elasticsearch endpoints on a running minio server process using the mc admin config set command and the notify_elasticsearch configuration key. You must restart the minio server process to apply any new or updated configuration settings.

The following example code sets all settings related to configuring an Elasticsearch service endpoint. The minimum required settings are:

mc admin config set ALIAS/ notify_elasticsearch:IDENTIFIER \
   url="ENDPOINT" \
   index="<string>" \
   format="<string>" \
   username="<string>" \
   password="<string>" \
   queue_dir="<string>" \
   queue_limit="<string>" \
   comment="<string>"
  • Replace IDENTIFIER with a unique descriptive string for the Elasticsearch service endpoint. The following examples in this procedure assume an identifier of PRIMARY.

    If the specified IDENTIFIER matches an existing Elasticsearch service endpoint on the MinIO deployment, the new settings override any existing settings for that endpoint. Use mc admin config get notify_elasticsearch to review the currently configured Elasticsearch endpoints on the MinIO deployment.

  • Replace ENDPOINT with the URL of the Elasticsearch service endpoint. For example:

    https://user:password@hostname:port

See Elasticsearch Bucket Notification Configuration Settings for complete documentation on each setting.

1) Restart the MinIO Deployment

You must restart the MinIO deployment to apply the configuration changes. Use the mc admin service restart command to restart the deployment.

mc admin service restart ALIAS

Replace ALIAS with the alias of the deployment to restart.

The minio server process prints a line on startup for each configured Elasticsearch target similar to the following:

SQS ARNs: arn:minio:sqs::primary:elasticsearch

You must specify the ARN resource when configuring bucket notifications with the associated Elasticsearch deployment as a target.

Note

Identifying the ARN for your bucket notifications

You defined the <IDENTIFIER> to assign to the target ARN for your bucket notifications when creating the endpoint previously. The steps below return the ARNs configured on the deployment. Identify the ARN created previously by looking for the <IDENTIFIER> you specified.

Review the JSON output

  1. Copy and run the following command, replacing ALIAS with the alias of the deployment.

    mc admin info --json ALIAS
  2. In the JSON output, look for the key info.sqsARN.

    The ARN you need is the value of that key that matches the <IDENTIFIER> you specified.

    For example, arn:minio:sqs::primary:elasticsearch.

Use jq to parse the JSON for the value

  1. Install jq

  2. Copy and run the following command, replacing ALIAS with the alias of the deployment.

    mc admin info --json ALIAS | jq  .info.sqsARN

    This returns the ARN to use for notifications, such as arn:minio:sqs::primary:elasticsearch

3) Configure Bucket Notifications using the Elasticsearch Endpoint as a Target

Use the mc event add command to add a new bucket notification event with the configured Elasticsearch service as a target:

mc event add ALIAS/BUCKET arn:minio:sqs::primary:elasticsearch \
  --event EVENTS
  • Replace ALIAS with the alias of a MinIO deployment.
  • Replace BUCKET with the name of the bucket in which to configure the event.
  • Replace EVENTS with a comma-separated list of events for which MinIO triggers notifications.

Use mc event ls to view all configured bucket events for a given notification target:

mc event ls ALIAS/BUCKET arn:minio:sqs::primary:elasticsearch

4) Validate the Configured Events

Perform an action on the bucket for which you configured the new event and check the Elasticsearch service for the notification data. The action required depends on which events were specified when configuring the bucket notification.

For example, if the bucket notification configuration includes the s3:ObjectCreated:Put event, you can use the mc cp command to create a new object in the bucket and trigger a notification.

mc cp ~/data/new-object.txt ALIAS/BUCKET

Update an Elasticsearch Endpoint in a MinIO Deployment

The following procedure updates an existing Elasticsearch service endpoint for supporting bucket notifications in a MinIO deployment.

Prerequisites

Elasticsearch v7.0 and later

MinIO relies on the https://github.com/olivere/elastic v7 project for Elastic connectivity. The elastic/v7 library specifically targets Elasticsearch v7.0 and is not compatible with earlier Elasticsearch versions.

MinIO mc Command Line Tool

This procedure uses the mc command line tool for certain actions. See the mc Quickstart for installation instructions.

1) List Configured Elasticsearch Endpoints In The Deployment

Use the mc admin config get command to list the currently configured Elasticsearch service endpoints in the deployment:

mc admin config get ALIAS/ notify_elasticsearch

Replace ALIAS with the alias of the MinIO deployment.

The command output resembles the following:

notify_elasticsearch:primary  queue_dir="" queue_limit="0"  url="https://user:password@hostname:port" format="namespace" index=""
notify_elasticsearch:secondary queue_dir="" queue_limit="0"  url="https://user:password@hostname:port" format="namespace" index=""

The notify_elasticsearch key is the top-level configuration key for an Elasticsearch Notification Settings. The url key specifies the Elasticsearch service endpoint for the given notify_elasticsearch key. The notify_elasticsearch:<IDENTIFIER> suffix describes the unique identifier for that Elasticsearch service endpoint.

Note the identifier for the Elasticsearch service endpoint you want to update for the next step.

2) Update the Elasticsearch Endpoint

Use the mc admin config set command to set the new configuration for the Elasticsearch service endpoint:

mc admin config set ALIAS/ notify_elasticsearch:<IDENTIFIER> \
   url="https://user:password@hostname:port" \
   index="<string>" \
   format="<string>" \
   username="<string>" \
   password="<string>" \
   queue_dir="<string>" \
   queue_limit="<string>" \
   comment="<string>"

The notify_elasticsearch url configuration setting is the minimum required for an Elasticsearch service endpoint. All other configuration settings are optional. See Elasticsearch Notification Settings for a complete list of Elasticsearch configuration settings.

3) Restart the MinIO Deployment

You must restart the MinIO deployment to apply the configuration changes. Use the mc admin service restart command to restart the deployment.

mc admin service restart ALIAS

Replace ALIAS with the alias of the deployment to restart.

The minio server process prints a line on startup for each configured Elasticsearch target similar to the following:

SQS ARNs: arn:minio:sqs::primary:elasticsearch

4) Validate the Changes

Perform an action on a bucket which has an event configuration using the updated Elasticsearch service endpoint and check the Elasticsearch service for the notification data. The action required depends on which events were specified when configuring the bucket notification.

For example, if the bucket notification configuration includes the s3:ObjectCreated:Put event, you can use the mc cp command to create a new object in the bucket and trigger a notification.

mc cp ~/data/new-object.txt ALIAS/BUCKET

7 - Publish Events to Kafka

MinIO supports publishing bucket notification events to a Kafka service endpoint.

MinIO relies on the https://github.com/Shopify/sarama project for Kafka connectivity and shares that project’s Kafka support. See the sarama Compatibility and API stability section for more details.

Add a Kafka Endpoint to a MinIO Deployment

The following procedure adds a new Kafka service endpoint for supporting bucket notifications in a MinIO deployment.

Prerequisites

Kafka Minimum Versions and Supported Versions

MinIO relies on the https://github.com/Shopify/sarama project for Kafka connectivity and shares that project’s Kafka support. See the sarama Compatibility and API stability section for more details.

MinIO mc Command Line Tool

This procedure uses the mc command line tool for certain actions. See the mc Quickstart for installation instructions.

1) Add the Kafka Endpoint to MinIO

You can configure a new Kafka service endpoint using either environment variables or by setting runtime configuration settings.

MinIO supports specifying the Kafka service endpoint and associated configuration settings using environment variables. The minio server process applies the specified settings on its next startup.

The following example code sets all environment variables related to configuring a Kafka service endpoint. The minimum required variables are MINIO_NOTIFY_KAFKA_ENABLE and MINIO_NOTIFY_KAFKA_BROKERS:

Note

Windows

   set MINIO_NOTIFY_KAFKA_ENABLE_<IDENTIFIER>="on"
   set MINIO_NOTIFY_KAFKA_BROKERS_<IDENTIFIER>="<ENDPOINT>"
   set MINIO_NOTIFY_KAFKA_TOPIC_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_KAFKA_SASL_USERNAME_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_KAFKA_SASL_PASSWORD_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_KAFKA_SASL_MECHANISM_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_KAFKA_TLS_CLIENT_AUTH_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_KAFKA_SASL_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_KAFKA_TLS_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_KAFKA_TLS_SKIP_VERIFY_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_KAFKA_CLIENT_TLS_CERT_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_KAFKA_CLIENT_TLS_KEY_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_KAFKA_QUEUE_DIR_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_KAFKA_QUEUE_LIMIT_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_KAFKA_VERSION_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_KAFKA_COMMENT_<IDENTIFIER>="<string>"
Note

Linux and macOS

   export MINIO_NOTIFY_KAFKA_ENABLE_<IDENTIFIER>="on"
   export MINIO_NOTIFY_KAFKA_BROKERS_<IDENTIFIER>="<ENDPOINT>"
   export MINIO_NOTIFY_KAFKA_TOPIC_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_KAFKA_SASL_USERNAME_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_KAFKA_SASL_PASSWORD_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_KAFKA_SASL_MECHANISM_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_KAFKA_TLS_CLIENT_AUTH_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_KAFKA_SASL_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_KAFKA_TLS_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_KAFKA_TLS_SKIP_VERIFY_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_KAFKA_CLIENT_TLS_CERT_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_KAFKA_CLIENT_TLS_KEY_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_KAFKA_QUEUE_DIR_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_KAFKA_QUEUE_LIMIT_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_KAFKA_VERSION_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_KAFKA_COMMENT_<IDENTIFIER>="<string>"
  • Replace <IDENTIFIER> with a unique descriptive string for the Kafka service endpoint. Use the same <IDENTIFIER> value for all environment variables related to the new target service endpoint. The following examples assume an identifier of PRIMARY.

    If the specified <IDENTIFIER> matches an existing Kafka service endpoint on the MinIO deployment, the new settings override any existing settings for that endpoint. Use mc admin config get notify_kafka to review the currently configured Kafka endpoints on the MinIO deployment.

  • Replace <ENDPOINT> with a comma-separated list of Kafka brokers. For example:

    "kafka1.example.com:2021,kafka2.example.com:2021"

See Kafka Service for Bucket Notifications for complete documentation on each environment variable.

MinIO supports adding or updating Kafka endpoints on a running minio server process using the mc admin config set command and the notify_kafka configuration key. You must restart the minio server process to apply any new or updated configuration settings.

The following example code sets all settings related to configuring an Kafka service endpoint. The minimum required setting is notify_kafka brokers:

mc admin config set ALIAS/ notify_kafka:IDENTIFIER \
   brokers="<ENDPOINT>" \
   topic="<string>" \
   sasl_username="<string>" \
   sasl_password="<string>" \
   sasl_mechanism="<string>" \
   tls_client_auth="<string>" \
   tls="<string>" \
   tls_skip_verify="<string>" \
   client_tls_cert="<string>" \
   client_tls_key="<string>" \
   version="<string>" \
   queue_dir="<string>" \
   queue_limit="<string>" \
   comment="<string>"
  • Replace IDENTIFIER with a unique descriptive string for the Kafka service endpoint. The following examples in this procedure assume an identifier of PRIMARY.

    If the specified IDENTIFIER matches an existing Kafka service endpoint on the MinIO deployment, the new settings override any existing settings for that endpoint. Use mc admin config get notify_kafka to review the currently configured Kafka endpoints on the MinIO deployment.

  • Replace ENDPOINT with a comma separated list of Kafka brokers. For example:

    "kafka1.example.com:2021,kafka2.example.com:2021"

See Kafka Bucket Notification Configuration Settings for complete documentation on each setting.

1) Restart the MinIO Deployment

You must restart the MinIO deployment to apply the configuration changes. Use the mc admin service restart command to restart the deployment.

mc admin service restart ALIAS

Replace ALIAS with the alias of the deployment to restart.

The minio server process prints a line on startup for each configured Kafka target similar to the following:

SQS ARNs: arn:minio:sqs::primary:kafka

You must specify the ARN resource when configuring bucket notifications with the associated Kafka deployment as a target.

Note

Identifying the ARN for your bucket notifications

You defined the <IDENTIFIER> to assign to the target ARN for your bucket notifications when creating the endpoint previously. The steps below return the ARNs configured on the deployment. Identify the ARN created previously by looking for the <IDENTIFIER> you specified.

Review the JSON output

  1. Copy and run the following command, replacing ALIAS with the alias of the deployment.

    mc admin info --json ALIAS
  2. In the JSON output, look for the key info.sqsARN.

    The ARN you need is the value of that key that matches the <IDENTIFIER> you specified.

    For example, arn:minio:sqs::primary:kafka.

Use jq to parse the JSON for the value

  1. Install jq

  2. Copy and run the following command, replacing ALIAS with the alias of the deployment.

    mc admin info --json ALIAS | jq  .info.sqsARN

    This returns the ARN to use for notifications, such as arn:minio:sqs::primary:kafka

3) Configure Bucket Notifications using the Kafka Endpoint as a Target

Use the mc event add command to add a new bucket notification event with the configured Kafka service as a target:

mc event add ALIAS/BUCKET arn:minio:sqs::primary:kafka \
  --event EVENTS
  • Replace ALIAS with the alias of a MinIO deployment.
  • Replace BUCKET with the name of the bucket in which to configure the event.
  • Replace EVENTS with a comma-separated list of events for which MinIO triggers notifications.

Use mc event ls to view all configured bucket events for a given notification target:

mc event ls ALIAS/BUCKET arn:minio:sqs::primary:kafka

4) Validate the Configured Events

Perform an action on the bucket for which you configured the new event and check the Kafka service for the notification data. The action required depends on which events were specified when configuring the bucket notification.

For example, if the bucket notification configuration includes the s3:ObjectCreated:Put event, you can use the mc cp command to create a new object in the bucket and trigger a notification.

mc cp ~/data/new-object.txt ALIAS/BUCKET

Update a Kafka Endpoint in a MinIO Deployment

The following procedure updates an existing Kafka service endpoint for supporting bucket notifications in a MinIO deployment.

Prerequisites

Kafka Minimum Versions and Supported Versions

MinIO relies on the https://github.com/Shopify/sarama project for Kafka connectivity and shares that project’s Kafka support. See the sarama Compatibility and API stability section for more details.

MinIO mc Command Line Tool

This procedure uses the mc command line tool for certain actions. See the mc Quickstart for installation instructions.

1) List Configured Kafka Endpoints In The Deployment

Use the mc admin config get command to list the currently configured Kafka service endpoints in the deployment:

mc admin config get ALIAS/ notify_kafka

Replace ALIAS with the alias of the MinIO deployment.

The command output resembles the following:

notify_kafka:primary tls_skip_verify="off"  queue_dir="" queue_limit="0" sasl="off" sasl_password="" sasl_username="" tls_client_auth="0" tls="off" brokers="" topic="" client_tls_cert="" client_tls_key="" version=""
notify_kafka:secondary tls_skip_verify="off"  queue_dir="" queue_limit="0" sasl="off" sasl_password="" sasl_username="" tls_client_auth="0" tls="off" brokers="" topic="" client_tls_cert="" client_tls_key="" version=""

The notify_kafka key is the top-level configuration key for an Kafka Notification Settings. The brokers key specifies the Kafka service endpoint for the given notify_kafka key. The notify_kafka:<IDENTIFIER> suffix describes the unique identifier for that Kafka service endpoint.

Note the identifier for the Kafka service endpoint you want to update for the next step.

2) Update the Kafka Endpoint

Use the mc admin config set command to set the new configuration for the Kafka service endpoint:

mc admin config set ALIAS/ notify_kafka:<IDENTIFIER> \
   brokers="https://kafka1.example.net:9200, https://kafka2.example.net:9200" \
   topic="<string>" \
   sasl_username="<string>" \
   sasl_password="<string>" \
   sasl_mechanism="<string>" \
   tls_client_auth="<string>" \
   tls="<string>" \
   tls_skip_verify="<string>" \
   client_tls_cert="<string>" \
   client_tls_key="<string>" \
   version="<string>" \
   queue_dir="<string>" \
   queue_limit="<string>" \
   comment="<string>"

The notify_kafka brokers configuration setting is the minimum required for a Kafka service endpoint. All other configuration settings are optional. See Kafka Notification Settings for a complete list of Kafka configuration settings.

3) Restart the MinIO Deployment

You must restart the MinIO deployment to apply the configuration changes. Use the mc admin service restart command to restart the deployment.

mc admin service restart ALIAS

Replace ALIAS with the alias of the deployment to restart.

The minio server process prints a line on startup for each configured Kafka target similar to the following:

SQS ARNs: arn:minio:sqs::primary:kafka

4) Validate the Changes

Perform an action on a bucket which has an event configuration using the updated Kafka service endpoint and check the Kafka service for the notification data. The action required depends on which events were specified when configuring the bucket notification.

For example, if the bucket notification configuration includes the s3:ObjectCreated:Put event, you can use the mc cp command to create a new object in the bucket and trigger a notification.

mc cp ~/data/new-object.txt ALIAS/BUCKET

8 - Publish Events to MySQL

MinIO supports publishing bucket notification events to a MySQL service endpoint. MinIO supports MySQL 5.7.8 and later only.

Add a MySQL Endpoint to a MinIO Deployment

The following procedure adds a new MySQL service endpoint for supporting bucket notifications in a MinIO deployment.

Prerequisites

MySQL 5.7.8 and later

MinIO relies on features introduced with MySQL 5.7.8.

MinIO mc Command Line Tool

This procedure uses the mc command line tool for certain actions. See the mc Quickstart for installation instructions.

1) Add the MySQL Endpoint to MinIO

You can configure a new MySQL service endpoint using either environment variables or by setting runtime configuration settings.

MinIO supports specifying the MySQL service endpoint and associated configuration settings using environment variables. The minio server process applies the specified settings on its next startup.

The following example code sets all environment variables related to configuring a MySQL service endpoint. The minimum required variables are:

Note

Windows

   set MINIO_NOTIFY_MYSQL_ENABLE_<IDENTIFIER>="on"
   set MINIO_NOTIFY_MYSQL_DSN_STRING_<IDENTIFIER>="user:password@tcp(hostname:port)/database"
   set MINIO_NOTIFY_MYSQL_TABLE_<IDENTIFIER>="minio-events"
   set MINIO_NOTIFY_MYSQL_FORMAT_<IDENTIFIER>="namespace|access"
   set MINIO_NOTIFY_MYSQL_MAX_OPEN_CONNECTIONS_<IDENTIFIER>="2"
   set MINIO_NOTIFY_MYSQL_QUEUE_DIR_<IDENTIFIER>="/opt/minio/events"
   set MINIO_NOTIFY_MYSQL_QUEUE_LIMIT_<IDENTIFIER>="100000"
   set MINIO_NOTIFY_MYSQL_COMMENT_<IDENTIFIER>="MySQL Event Notification Logging for MinIO"
Note

Linux and macOS

   export MINIO_NOTIFY_MYSQL_ENABLE_<IDENTIFIER>="on"
   export MINIO_NOTIFY_MYSQL_DSN_STRING_<IDENTIFIER>="user:password@tcp(hostname:port)/database"
   export MINIO_NOTIFY_MYSQL_TABLE_<IDENTIFIER>="minio-events"
   export MINIO_NOTIFY_MYSQL_FORMAT_<IDENTIFIER>="namespace|access"
   export MINIO_NOTIFY_MYSQL_MAX_OPEN_CONNECTIONS_<IDENTIFIER>="2"
   export MINIO_NOTIFY_MYSQL_QUEUE_DIR_<IDENTIFIER>="/opt/minio/events"
   export MINIO_NOTIFY_MYSQL_QUEUE_LIMIT_<IDENTIFIER>="100000"
   export MINIO_NOTIFY_MYSQL_COMMENT_<IDENTIFIER>="MySQL Event Notification Logging for MinIO"
  • Replace <IDENTIFIER> with a unique descriptive string for the MySQL service endpoint. Use the same <IDENTIFIER> value for all environment variables related to the new target service endpoint. The following examples assume an identifier of PRIMARY.

    If the specified <IDENTIFIER> matches an existing MySQL service endpoint on the MinIO deployment, the new settings override any existing settings for that endpoint. Use mc admin config get notify_mysql to review the currently configured MySQL endpoints on the MinIO deployment.

  • Replace <ENDPOINT> with the DSN of the MySQL service endpoint. MinIO expects the following format:

    <user>:<password>@tcp(<host>:<port>)/<database>

    For example:

    "username:password@tcp(mysql.example.com:3306)/miniodb"

See MySQL Service for Bucket Notifications for complete documentation on each environment variable.

MinIO supports adding or updating MySQL endpoints on a running minio server process using the mc admin config set command and the notify_mysql configuration key. You must restart the minio server process to apply any new or updated configuration settings.

The following example code sets all settings related to configuring an MySQL service endpoint. The minimum required settings are:

mc admin config set ALIAS/ notify_mysql:IDENTIFIER \
   dsn_string="<ENDPOINT>" \
   table="<string>" \
   format="<string>" \
   max_open_connections="<string>" \
   queue_dir="<string>" \
   queue_limit="<string>" \
   comment="<string>"
  • Replace IDENTIFIER with a unique descriptive string for the MySQL service endpoint. The following examples in this procedure assume an identifier of PRIMARY.

    If the specified IDENTIFIER matches an existing MySQL service endpoint on the MinIO deployment, the new settings override any existing settings for that endpoint. Use mc admin config get notify_mysql to review the currently configured MySQL endpoints on the MinIO deployment.

  • Replace <ENDPOINT> with the DSN of the MySQL service endpoint. MinIO expects the following format:

    <user>:<password>@tcp(<host>:<port>)/<database>

    For example:

    "username:password@tcp(mysql.example.com:3306)/miniodb"

See MySQL Bucket Notification Configuration Settings for complete documentation on each setting.

1) Restart the MinIO Deployment

You must restart the MinIO deployment to apply the configuration changes. Use the mc admin service restart command to restart the deployment.

mc admin service restart ALIAS

Replace ALIAS with the alias of the deployment to restart.

The minio server process prints a line on startup for each configured MySQL target similar to the following:

SQS ARNs: arn:minio:sqs::primary:mysql

You must specify the ARN resource when configuring bucket notifications with the associated MySQL deployment as a target.

Note

Identifying the ARN for your bucket notifications

You defined the <IDENTIFIER> to assign to the target ARN for your bucket notifications when creating the endpoint previously. The steps below return the ARNs configured on the deployment. Identify the ARN created previously by looking for the <IDENTIFIER> you specified.

Review the JSON output

  1. Copy and run the following command, replacing ALIAS with the alias of the deployment.

    mc admin info --json ALIAS
  2. In the JSON output, look for the key info.sqsARN.

    The ARN you need is the value of that key that matches the <IDENTIFIER> you specified.

    For example, arn:minio:sqs::primary:mysql.

Use jq to parse the JSON for the value

  1. Install jq

  2. Copy and run the following command, replacing ALIAS with the alias of the deployment.

    mc admin info --json ALIAS | jq  .info.sqsARN

    This returns the ARN to use for notifications, such as arn:minio:sqs::primary:mysql

3) Configure Bucket Notifications using the MySQL Endpoint as a Target

Use the mc event add command to add a new bucket notification event with the configured MySQL service as a target:

mc event add ALIAS/BUCKET arn:minio:sqs::primary:mysql \
  --event EVENTS
  • Replace ALIAS with the alias of a MinIO deployment.
  • Replace BUCKET with the name of the bucket in which to configure the event.
  • Replace EVENTS with a comma-separated list of events for which MinIO triggers notifications.

Use mc event ls to view all configured bucket events for a given notification target:

mc event ls ALIAS/BUCKET arn:minio:sqs::primary:mysql

4) Validate the Configured Events

Perform an action on the bucket for which you configured the new event and check the MySQL service for the notification data. The action required depends on which events were specified when configuring the bucket notification.

For example, if the bucket notification configuration includes the s3:ObjectCreated:Put event, you can use the mc cp command to create a new object in the bucket and trigger a notification.

mc cp ~/data/new-object.txt ALIAS/BUCKET

Update a MySQL Endpoint in a MinIO Deployment

The following procedure updates an existing MySQL service endpoint for supporting bucket notifications in a MinIO deployment.

Prerequisites

MySQL 5.7.8 and later

MinIO relies on features introduced with MySQL 5.7.8.

MinIO mc Command Line Tool

This procedure uses the mc command line tool for certain actions. See the mc Quickstart for installation instructions.

1) List Configured MySQL Endpoints In The Deployment

Use the mc admin config get command to list the currently configured MySQL service endpoints in the deployment:

mc admin config get ALIAS/ notify_mysql

Replace ALIAS with the alias of the MinIO deployment.

The command output resembles the following:

notify_mysql:primary format="namespace" table="minio_images" dsn_string="user:pass@tcp(mysql.example.com:3306)/miniodb"
notify_mysql:secondary format="namespace" table="minio_images" dsn_string="user:pass@tcp(mysql.example.com:3306)/miniodb"

The notify_mysql key is the top-level configuration key for an MySQL Notification Settings. The dsn_string key specifies the MySQL service endpoint for the given notify_mysql key. The notify_mysql:<IDENTIFIER> suffix describes the unique identifier for that MySQL service endpoint.

Note the identifier for the MySQL service endpoint you want to update for the next step.

2) Update the MySQL Endpoint

Use the mc admin config set command to set the new configuration for the MySQL service endpoint:

mc admin config set ALIAS/ notify_mysql:IDENTIFIER \
   dsn_string="<ENDPOINT>" \
   table="<string>" \
   format="<string>" \
   max_open_connections="<string>" \
   queue_dir="<string>" \
   queue_limit="<string>" \
   comment="<string>"

The following configuration settings are the minimum required for a MySQL service endpoint:

All other configuration settings are optional. See MySQL Notification Settings for a complete list of MySQL configuration settings.

3) Restart the MinIO Deployment

You must restart the MinIO deployment to apply the configuration changes. Use the mc admin service restart command to restart the deployment.

mc admin service restart ALIAS

Replace ALIAS with the alias of the deployment to restart.

The minio server process prints a line on startup for each configured MySQL target similar to the following:

SQS ARNs: arn:minio:sqs::primary:mysql

4) Validate the Changes

Perform an action on a bucket which has an event configuration using the updated MySQL service endpoint and check the MySQL service for the notification data. The action required depends on which events were specified when configuring the bucket notification.

For example, if the bucket notification configuration includes the s3:ObjectCreated:Put event, you can use the mc cp command to create a new object in the bucket and trigger a notification.

mc cp ~/data/new-object.txt ALIAS/BUCKET

9 - Publish Events to PostgreSQL

MinIO supports publishing bucket notification events to PostgreSQL. MinIO supports PostgreSQL 9.5 and later only.

Add a PostgreSQL Endpoint to a MinIO Deployment

The following procedure adds a new PostgreSQL service endpoint for supporting bucket notifications in a MinIO deployment.

Prerequisites

PostgreSQL 9.5 and later

MinIO relies on features introduced with PostgreSQL 9.5.

MinIO mc Command Line Tool

This procedure uses the mc command line tool for certain actions. See the mc Quickstart for installation instructions.

1) Add the PostgreSQL Endpoint to MinIO

You can configure a new PostgreSQL service endpoint using either environment variables or by setting runtime configuration settings.

MinIO supports specifying the PostgreSQL service endpoint and associated configuration settings using environment variables. The minio server process applies the specified settings on its next startup.

The following example code sets all environment variables related to configuring a PostgreSQL service endpoint. The minimum required variables are:

Note

Windows

   set MINIO_NOTIFY_POSTGRES_ENABLE_<IDENTIFIER>="on"
   set MINIO_NOTIFY_POSTGRES_CONNECTION_STRING_<IDENTIFIER>="host=postgresql-endpoint.example.net port=4222"
   set MINIO_NOTIFY_POSTGRES_TABLE_<IDENTIFIER>="minioevents"
   set MINIO_NOTIFY_POSTGRES_FORMAT_<IDENTIFIER>="namespace|access"
   set MINIO_NOTIFY_POSTGRES_MAX_OPEN_CONNECTIONS_<IDENTIFIER>="2"
   set MINIO_NOTIFY_POSTGRES_QUEUE_DIR_<IDENTIFIER>="/opt/minio/events"
   set MINIO_NOTIFY_POSTGRES_QUEUE_LIMIT_<IDENTIFIER>="100000"
   set MINIO_NOTIFY_POSTGRES_COMMENT_<IDENTIFIER>="PostgreSQL Notification Event Logging for MinIO"
Note

Linux and macOS

   export MINIO_NOTIFY_POSTGRES_ENABLE_<IDENTIFIER>="on"
   export MINIO_NOTIFY_POSTGRES_CONNECTION_STRING_<IDENTIFIER>="host=postgresql-endpoint.example.net port=4222"
   export MINIO_NOTIFY_POSTGRES_TABLE_<IDENTIFIER>="minioevents"
   export MINIO_NOTIFY_POSTGRES_FORMAT_<IDENTIFIER>="namespace|access"
   export MINIO_NOTIFY_POSTGRES_MAX_OPEN_CONNECTIONS_<IDENTIFIER>="2"
   export MINIO_NOTIFY_POSTGRES_QUEUE_DIR_<IDENTIFIER>="/opt/minio/events"
   export MINIO_NOTIFY_POSTGRES_QUEUE_LIMIT_<IDENTIFIER>="100000"
   export MINIO_NOTIFY_POSTGRES_COMMENT_<IDENTIFIER>="PostgreSQL Notification Event Logging for MinIO"
  • Replace <IDENTIFIER> with a unique descriptive string for the PostgreSQL service endpoint. Use the same <IDENTIFIER> value for all environment variables related to the new target service endpoint. The following examples assume an identifier of PRIMARY.

    If the specified <IDENTIFIER> matches an existing PostgreSQL service endpoint on the MinIO deployment, the new settings override any existing settings for that endpoint. Use mc admin config get notify_postgres to review the currently configured PostgreSQL endpoints on the MinIO deployment.

  • Replace <ENDPOINT> with the PostgreSQL Connection String for PostgreSQL service endpoint. MinIO supports key=value format for the connection string. For example:

    "host=https://postgresql.example.com port=5432 ..."

    For more complete documentation on supported PostgreSQL connection string parameters, see PostgreSQL Connection String.

See PostgreSQL Service for Bucket Notifications for complete documentation on each environment variable.

MinIO supports adding or updating PostgreSQL endpoints on a running minio server process using the mc admin config set command and the notify_postgres configuration key. You must restart the minio server process to apply any new or updated configuration settings.

The following example code sets all settings related to configuring an PostgreSQL service endpoint. The minimum required setting are:

mc admin config set ALIAS/ notify_postgres:IDENTIFIER \
   connection_string="ENDPOINT" \
   table="<string>" \
   format="<string>" \
   max_open_connections="<string>" \
   queue_dir="<string>" \
   queue_limit="<string>" \
   comment="<string>"
  • Replace IDENTIFIER with a unique descriptive string for the PostgreSQL service endpoint. The following examples in this procedure assume an identifier of PRIMARY.

    If the specified IDENTIFIER matches an existing PostgreSQL service endpoint on the MinIO deployment, the new settings override any existing settings for that endpoint. Use mc admin config get notify_postgres to review the currently configured PostgreSQL endpoints on the MinIO deployment.

  • Replace <ENDPOINT> with the PostgreSQL URI connection string of the PostgreSQL service endpoint. MinIO supports key=value format for the PostgreSQL connection string. For example:

    "host=https://postgresql.example.com port=5432 ..."

    For more complete documentation on supported PostgreSQL connection string parameters, see PostgreSQL Connection String.

See PostgreSQL Bucket Notification Configuration Settings for complete documentation on each setting.

1) Restart the MinIO Deployment

You must restart the MinIO deployment to apply the configuration changes. Use the mc admin service restart command to restart the deployment.

mc admin service restart ALIAS

Replace ALIAS with the alias of the deployment to restart.

The minio server process prints a line on startup for each configured PostgreSQL target similar to the following:

SQS ARNs: arn:minio:sqs::primary:postgresql

You must specify the ARN resource when configuring bucket notifications with the associated PostgreSQL deployment as a target.

Note

Identifying the ARN for your bucket notifications

You defined the <IDENTIFIER> to assign to the target ARN for your bucket notifications when creating the endpoint previously. The steps below return the ARNs configured on the deployment. Identify the ARN created previously by looking for the <IDENTIFIER> you specified.

Review the JSON output

  1. Copy and run the following command, replacing ALIAS with the alias of the deployment.

    mc admin info --json ALIAS
  2. In the JSON output, look for the key info.sqsARN.

    The ARN you need is the value of that key that matches the <IDENTIFIER> you specified.

    For example, arn:minio:sqs::primary:postgresql.

Use jq to parse the JSON for the value

  1. Install jq

  2. Copy and run the following command, replacing ALIAS with the alias of the deployment.

    mc admin info --json ALIAS | jq  .info.sqsARN

    This returns the ARN to use for notifications, such as arn:minio:sqs::primary:postgresql

3) Configure Bucket Notifications using the PostgreSQL Endpoint as a Target

Use the mc event add command to add a new bucket notification event with the configured PostgreSQL service as a target:

mc event add ALIAS/BUCKET arn:minio:sqs::primary:postgresql \
  --event EVENTS
  • Replace ALIAS with the alias of a MinIO deployment.
  • Replace BUCKET with the name of the bucket in which to configure the ßevent.
  • Replace EVENTS with a comma-separated list of events for which MinIO triggers notifications.

Use mc event ls to view all configured bucket events for a given notification target:

mc event ls ALIAS/BUCKET arn:minio:sqs::primary:postgresql

4) Validate the Configured Events

Perform an action on the bucket for which you configured the new event and check the PostgreSQL service for the notification data. The action required depends on which events were specified when configuring the bucket notification.

For example, if the bucket notification configuration includes the s3:ObjectCreated:Put event, you can use the mc cp command to create a new object in the bucket and trigger a notification.

mc cp ~/data/new-object.txt ALIAS/BUCKET

Update a PostgreSQL Endpoint in a MinIO Deployment

The following procedure updates an existing PostgreSQL service endpoint for supporting bucket notifications in a MinIO deployment.

Prerequisites

PostgreSQL 9.5 and later

MinIO relies on features introduced with PostgreSQL 9.5.

MinIO mc Command Line Tool

This procedure uses the mc command line tool for certain actions. See the mc Quickstart for installation instructions.

1) List Configured PostgreSQL Endpoints In The Deployment

Use the mc admin config get command to list the currently configured PostgreSQL service endpoints in the deployment:

mc admin config get ALIAS/ notify_postgres

Replace ALIAS with the alias of the MinIO deployment.

The command output resembles the following:

notify_postgres:primary queue_dir="" connection_string="postgresql://" queue_limit="0"  table="" format="namespace"
notify_postgres:secondary queue_dir="" connection_string="" queue_limit="0"  table="" format="namespace"

The notify_postgres key is the top-level configuration key for an PostgreSQL Notification Settings. The connection_string key specifies the PostgreSQL service endpoint for the given notify_postgres key. The notify_postgres:<IDENTIFIER> suffix describes the unique identifier for that PostgreSQL service endpoint.

Note the identifier for the PostgreSQL service endpoint you want to update for the next step.

2) Update the PostgreSQL Endpoint

Use the mc admin config set command to set the new configuration for the PostgreSQL service endpoint:

mc admin config set ALIAS/ notify_postgres:IDENTIFIER \
   connection_string="ENDPOINT" \
   table="<string>" \
   format="<string>" \
   max_open_connections="<string>" \
   queue_dir="<string>" \
   queue_limit="<string>" \
   comment="<string>"

The following configuration settings are the minimum required for a PostgreSQL service endpoint:

All other configuration settings are optional. See PostgreSQL Notification Settings for a complete list of PostgreSQL configuration settings.

3) Restart the MinIO Deployment

You must restart the MinIO deployment to apply the configuration changes. Use the mc admin service restart command to restart the deployment.

mc admin service restart ALIAS

Replace ALIAS with the alias of the deployment to restart.

The minio server process prints a line on startup for each configured PostgreSQL target similar to the following:

SQS ARNs: arn:minio:sqs::primary:postgresql

4) Validate the Changes

Perform an action on a bucket which has an event configuration using the updated PostgreSQL service endpoint and check the PostgreSQL service for the notification data. The action required depends on which events were specified when configuring the bucket notification.

For example, if the bucket notification configuration includes the s3:ObjectCreated:Put event, you can use the mc cp command to create a new object in the bucket and trigger a notification.

mc cp ~/data/new-object.txt ALIAS/BUCKET

10 - Publish Events to Redis

MinIO supports publishing bucket notification events to a Redis service endpoint.

Add a Redis Endpoint to a MinIO Deployment

The following procedure adds a new Redis service endpoint for supporting bucket notifications in a MinIO deployment.

Prerequisites

MinIO mc Command Line Tool

This procedure uses the mc command line tool for certain actions. See the mc Quickstart for installation instructions.

1) Add the Redis Endpoint to MinIO

You can configure a new Redis service endpoint using either environment variables or by setting runtime configuration settings.

MinIO supports specifying the Redis service endpoint and associated configuration settings using environment variables. The minio server process applies the specified settings on its next startup.

The following example code sets all environment variables related to configuring an Redis service endpoint. The minimum required variables are:

Note

Windows

   set MINIO_NOTIFY_REDIS_ENABLE_<IDENTIFIER>="on"
   set MINIO_NOTIFY_REDIS_ADDRESS_<IDENTIFIER>="<ENDPOINT>"
   set MINIO_NOTIFY_REDIS_KEY_<IDENTIFIER>="<STRING>"
   set MINIO_NOTIFY_REDIS_FORMAT_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_REDIS_PASSWORD_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_REDIS_QUEUE_DIR_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_REDIS_QUEUE_LIMIT_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_REDIS_COMMENT_<IDENTIFIER>="<string>"
Note

Linux and macOS

   export MINIO_NOTIFY_REDIS_ENABLE_<IDENTIFIER>="on"
   export MINIO_NOTIFY_REDIS_ADDRESS_<IDENTIFIER>="<ENDPOINT>"
   export MINIO_NOTIFY_REDIS_KEY_<IDENTIFIER>="<STRING>"
   export MINIO_NOTIFY_REDIS_FORMAT_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_REDIS_PASSWORD_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_REDIS_QUEUE_DIR_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_REDIS_QUEUE_LIMIT_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_REDIS_COMMENT_<IDENTIFIER>="<string>"
  • Replace <IDENTIFIER> with a unique descriptive string for the TARGET service endpoint. Use the same <IDENTIFIER> value for all environment variables related to the new target service endpoint. The following examples assume an identifier of PRIMARY.

    If the specified <IDENTIFIER> matches an existing Redis service endpoint on the MinIO deployment, the new settings override any existing settings for that endpoint. Use mc admin config get notify_redis to review the currently configured Redis endpoints on the MinIO deployment.

  • Replace <ENDPOINT> with the URL of the Redis service endpoint. For example: https://redis.example.com:6369

See Redis Service for Bucket Notifications for complete documentation on each environment variable.

MinIO supports adding or updating Redis endpoints on a running minio server process using the mc admin config set command and the notify_redis configuration key. You must restart the minio server process to apply any new or updated configuration settings.

The following example code sets all settings related to configuring an Redis service endpoint. The minimum required settings are:

mc admin config set ALIAS/ notify_redis:IDENTIFIER \
  address="ENDPOINT" \
  key="<string>" \
  format="<string>" \
  password="<string>" \
  queue_dir="<string>" \
  queue_limit="<string>" \
  comment="<string>"
  • Replace IDENTIFIER with a unique descriptive string for the Redis service endpoint. The following examples in this procedure assume an identifier of PRIMARY.

    If the specified IDENTIFIER matches an existing Redis service endpoint on the MinIO deployment, the new settings override any existing settings for that endpoint. Use mc admin config get notify_redis to review the currently configured Redis endpoints on the MinIO deployment.

  • Replace ENDPOINT with the URL of the Redis service endpoint. For example: https://redis.example.com:6369

See Redis Bucket Notification Configuration Settings for complete documentation on each setting.

1) Restart the MinIO Deployment

You must restart the MinIO deployment to apply the configuration changes. Use the mc admin service restart command to restart the deployment.

mc admin service restart ALIAS

Replace ALIAS with the alias of the deployment to restart.

The minio server process prints a line on startup for each configured Redis target similar to the following:

SQS ARNs: arn:minio:sqs::primary:redis

You must specify the ARN resource when configuring bucket notifications with the associated Redis deployment as a target.

Note

Identifying the ARN for your bucket notifications

You defined the <IDENTIFIER> to assign to the target ARN for your bucket notifications when creating the endpoint previously. The steps below return the ARNs configured on the deployment. Identify the ARN created previously by looking for the <IDENTIFIER> you specified.

Review the JSON output

  1. Copy and run the following command, replacing ALIAS with the alias of the deployment.

    mc admin info --json ALIAS
  2. In the JSON output, look for the key info.sqsARN.

    The ARN you need is the value of that key that matches the <IDENTIFIER> you specified.

    For example, arn:minio:sqs::primary:redis.

Use jq to parse the JSON for the value

  1. Install jq

  2. Copy and run the following command, replacing ALIAS with the alias of the deployment.

    mc admin info --json ALIAS | jq  .info.sqsARN

    This returns the ARN to use for notifications, such as arn:minio:sqs::primary:redis

3) Configure Bucket Notifications using the Redis Endpoint as a Target

Use the mc event add command to add a new bucket notification event with the configured Redis service as a target:

mc event add ALIAS/BUCKET arn:minio:sqs::primary:redis \
  --event EVENTS
  • Replace ALIAS with the alias of a MinIO deployment.
  • Replace BUCKET with the name of the bucket in which to configure the event.
  • Replace EVENTS with a comma-separated list of events for which MinIO triggers notifications.

Use mc event ls to view all configured bucket events for a given notification target:

mc event ls ALIAS/BUCKET arn:minio:sqs::primary:redis

4) Validate the Configured Events

Perform an action on the bucket for which you configured the new event and check the Redis service for the notification data. The action required depends on which events were specified when configuring the bucket notification.

For example, if the bucket notification configuration includes the s3:ObjectCreated:Put event, you can use the mc cp command to create a new object in the bucket and trigger a notification.

mc cp ~/data/new-object.txt ALIAS/BUCKET

Update an Redis Endpoint in a MinIO Deployment

The following procedure updates an existing Redis service endpoint for supporting bucket notifications in a MinIO deployment.

Prerequisites

MinIO mc Command Line Tool

This procedure uses the mc command line tool for certain actions. See the mc Quickstart for installation instructions.

1) List Configured Redis Endpoints In The Deployment

Use the mc admin config get command to list the currently configured Redis service endpoints in the deployment:

mc admin config get ALIAS/ notify_redis

Replace ALIAS with the alias of the MinIO deployment.

The command output resembles the following:

notify_redis:primary address="https://redis.example.com:6369" format="namespace" key="minioevent" password="" queue_dir="" queue_limit="0"
notify_redis:secondary address="https://redis.example.com:6369" format="namespace" key="minioevent" password="" queue_dir="" queue_limit="0"

The notify_redis key is the top-level configuration key for an Redis Notification Settings. The address key specifies the Redis service endpoint for the given notify_redis key. The notify_redis:<IDENTIFIER> suffix describes the unique identifier for that Redis service endpoint.

Note the identifier for the Redis service endpoint you want to update for the next step.

2) Update the Redis Endpoint

Use the mc admin config set command to set the new configuration for the Redis service endpoint:

mc admin config set ALIAS/ notify_redis:IDENTIFIER \
   address="ENDPOINT" \
   key="<string>" \
   format="<string>" \
   password="<string>" \
   queue_dir="<string>" \
   queue_limit="<string>" \
   comment="<string>"

The notify_redis address configuration setting is the minimum required for an Redis service endpoint. All other configuration settings are optional. See Redis Notification Settings for a complete list of Redis configuration settings.

3) Restart the MinIO Deployment

You must restart the MinIO deployment to apply the configuration changes. Use the mc admin service restart command to restart the deployment.

mc admin service restart ALIAS

Replace ALIAS with the alias of the deployment to restart.

The minio server process prints a line on startup for each configured Redis target similar to the following:

SQS ARNs: arn:minio:sqs::primary:redis

4) Validate the Changes

Perform an action on a bucket which has an event configuration using the updated Redis service endpoint and check the Redis service for the notification data. The action required depends on which events were specified when configuring the bucket notification.

For example, if the bucket notification configuration includes the s3:ObjectCreated:Put event, you can use the mc cp command to create a new object in the bucket and trigger a notification.

mc cp ~/data/new-object.txt ALIAS/BUCKET

11 - Publish Events to Webhook

MinIO supports publishing bucket notification events to a Webhook service endpoint.

Add a Webhook Endpoint to a MinIO Deployment

The following procedure adds a new Webhook service endpoint for supporting bucket notifications in a MinIO deployment.

Prerequisites

MinIO mc Command Line Tool

This procedure uses the mc command line tool for certain actions. See the mc Quickstart for installation instructions.

1) Add the Webhook Endpoint to MinIO

You can configure a new Webhook service endpoint using either environment variables or by setting runtime configuration settings.

MinIO supports specifying the Webhook service endpoint and associated configuration settings using environment variables. The minio server process applies the specified settings on its next startup.

The following example code sets all environment variables related to configuring an Webhook service endpoint. The minimum required variables are MINIO_NOTIFY_WEBHOOK_ENABLE and MINIO_NOTIFY_WEBHOOK_ENDPOINT:

Note

Windows

   set MINIO_NOTIFY_WEBHOOK_ENABLE_<IDENTIFIER>="on"
   set MINIO_NOTIFY_WEBHOOK_ENDPOINT_<IDENTIFIER>="ENDPOINT"
   set MINIO_NOTIFY_WEBHOOK_AUTH_TOKEN_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_WEBHOOK_QUEUE_DIR_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_WEBHOOK_QUEUE_LIMIT_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_WEBHOOK_CLIENT_CERT_<IDENTIFIER>="<string>"
   set MINIO_NOTIFY_WEBHOOK_CLIENT_KEY_<IDENTIFIER>="<string>"
Note

Linux and macOS

   export MINIO_NOTIFY_WEBHOOK_ENABLE_<IDENTIFIER>="on"
   export MINIO_NOTIFY_WEBHOOK_ENDPOINT_<IDENTIFIER>="ENDPOINT"
   export MINIO_NOTIFY_WEBHOOK_AUTH_TOKEN_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_WEBHOOK_QUEUE_DIR_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_WEBHOOK_QUEUE_LIMIT_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_WEBHOOK_CLIENT_CERT_<IDENTIFIER>="<string>"
   export MINIO_NOTIFY_WEBHOOK_CLIENT_KEY_<IDENTIFIER>="<string>"
  • Replace <IDENTIFIER> with a unique descriptive string for the Webhook service endpoint. Use the same <IDENTIFIER> value for all environment variables related to the new target service endpoint. The following examples assume an identifier of PRIMARY.

    If the specified <IDENTIFIER> matches an existing Webhook service endpoint on the MinIO deployment, the new settings override any existing settings for that endpoint. Use mc admin config get notify_webhook to review the currently configured Webhook endpoints on the MinIO deployment.

  • Replace <ENDPOINT> with the URL of the Webhook service endpoint. For example:

    https://webhook.example.com

See Webhook Service for Bucket Notifications for complete documentation on each environment variable.

MinIO supports adding or updating Webhook endpoints on a running minio server process using the mc admin config set command and the notify_webhook configuration key. You must restart the minio server process to apply any new or updated configuration settings.

The following example code sets all settings related to configuring an Webhook service endpoint. The minimum required setting is notify_webhook endpoint:

mc admin config set ALIAS/ notify_webhook:IDENTIFIER \
   endpoint="<ENDPOINT>" \
   auth_token="<string>" \
   queue_dir="<string>" \
   queue_limit="<string>" \
   client_cert="<string>" \
   client_key="<string>"
  • Replace IDENTIFIER with a unique descriptive string for the Webhook service endpoint. The following examples in this procedure assume an identifier of PRIMARY.

    If the specified IDENTIFIER matches an existing Webhook service endpoint on the MinIO deployment, the new settings override any existing settings for that endpoint. Use mc admin config get notify_webhook to review the currently configured Webhook endpoints on the MinIO deployment.

  • Replace ENDPOINT with the URL of the Webhook service endpoint. For example:

    https://webhook.example.com

See Webhook Bucket Notification Configuration Settings for complete documentation on each setting.

1) Restart the MinIO Deployment

You must restart the MinIO deployment to apply the configuration changes. Use the mc admin service restart command to restart the deployment.

mc admin service restart ALIAS

Replace ALIAS with the alias of the deployment to restart.

The minio server process prints a line on startup for each configured Webhook target similar to the following:

SQS ARNs: arn:minio:sqs::primary:webhook

You must specify the ARN resource when configuring bucket notifications with the associated Webhook deployment as a target.

Note

Identifying the ARN for your bucket notifications

You defined the <IDENTIFIER> to assign to the target ARN for your bucket notifications when creating the endpoint previously. The steps below return the ARNs configured on the deployment. Identify the ARN created previously by looking for the <IDENTIFIER> you specified.

Review the JSON output

  1. Copy and run the following command, replacing ALIAS with the alias of the deployment.

    mc admin info --json ALIAS
  2. In the JSON output, look for the key info.sqsARN.

    The ARN you need is the value of that key that matches the <IDENTIFIER> you specified.

    For example, arn:minio:sqs::primary:webhook.

Use jq to parse the JSON for the value

  1. Install jq

  2. Copy and run the following command, replacing ALIAS with the alias of the deployment.

    mc admin info --json ALIAS | jq  .info.sqsARN

    This returns the ARN to use for notifications, such as arn:minio:sqs::primary:webhook

3) Configure Bucket Notifications using the Webhook Endpoint as a Target

Use the mc event add command to add a new bucket notification event with the configured Webhook service as a target:

mc event add ALIAS/BUCKET arn:minio:sqs::primary:webhook \
  --event EVENTS
  • Replace ALIAS with the alias of a MinIO deployment.
  • Replace BUCKET with the name of the bucket in which to configure the event.
  • Replace EVENTS with a comma-separated list of events for which MinIO triggers notifications.

Use mc event ls to view all configured bucket events for a given notification target:

mc event ls ALIAS/BUCKET arn:minio:sqs::primary:webhook

4) Validate the Configured Events

Perform an action on the bucket for which you configured the new event and check the Webhook service for the notification data. The action required depends on which events were specified when configuring the bucket notification.

For example, if the bucket notification configuration includes the s3:ObjectCreated:Put event, you can use the mc cp command to create a new object in the bucket and trigger a notification.

mc cp ~/data/new-object.txt ALIAS/BUCKET

Update an Webhook Endpoint in a MinIO Deployment

The following procedure updates an existing Webhook service endpoint for supporting bucket notifications in a MinIO deployment.

Prerequisites

MinIO mc Command Line Tool

This procedure uses the mc command line tool for certain actions. See the mc Quickstart for installation instructions.

1) List Configured Webhook Endpoints In The Deployment

Use the mc admin config get command to list the currently configured Webhook service endpoints in the deployment:

mc admin config get ALIAS/ notify_webhook

Replace ALIAS with the alias of the MinIO deployment.

The command output resembles the following:

notify_webhook:primary endpoint="https://webhook.example.com" auth_token="" queue_limit="0" queue_dir="" client_cert="" client_key=""
notify_webhook:secondary endpoint="https://webhook.example.com" auth_token="" queue_limit="0" queue_dir="" client_cert="" client_key=""

The notify_webhook key is the top-level configuration key for an Webhook Service Notification Settings. The endpoint key specifies the Webhook service endpoint for the given notify_webhook key. The notify_webhook:<IDENTIFIER> suffix describes the unique identifier for that Webhook service endpoint.

Note the identifier for the Webhook service endpoint you want to update for the next step.

2) Update the Webhook Endpoint

Use the mc admin config set command to set the new configuration for the Webhook service endpoint:

mc admin config set ALIAS/ notify_webhook:IDENTIFIER \
   endpoint="<ENDPOINT>" \
   auth_token="<string>" \
   queue_dir="<string>" \
   queue_limit="<string>" \
   client_cert="<string>" \
   client_key="<string>"

The notify_webhook endpoint configuration setting is the minimum required for an Webhook service endpoint. All other configuration settings are optional. See Webhook Service Notification Settings for a complete list of Webhook configuration settings.

3) Restart the MinIO Deployment

You must restart the MinIO deployment to apply the configuration changes. Use the mc admin service restart command to restart the deployment.

mc admin service restart ALIAS

Replace ALIAS with the alias of the deployment to restart.

The minio server process prints a line on startup for each configured Webhook target similar to the following:

SQS ARNs: arn:minio:sqs::primary:webhook

4) Validate the Changes

Perform an action on a bucket which has an event configuration using the updated Webhook service endpoint and check the Webhook service for the notification data. The action required depends on which events were specified when configuring the bucket notification.

For example, if the bucket notification configuration includes the s3:ObjectCreated:Put event, you can use the mc cp command to create a new object in the bucket and trigger a notification.

mc cp ~/data/new-object.txt ALIAS/BUCKET