The Redis sink connector pulls messages from Pulsar topics and persists the messages to a Redis database.

Configuration

The configuration of the Redis sink connector has the following properties.

Property

NameTypeRequiredSensitiveDefaultDescription
redisHostsStringtruefalse” ” (empty string)A comma-separated list of Redis hosts to connect to.
redisPasswordStringfalsetrue” ” (empty string)The password used to connect to Redis.
redisDatabaseinttruefalse0The Redis database to connect to.
clientModeStringfalsefalseStandaloneThe client mode when interacting with Redis cluster.

Below are the available options:
  • Standalone
  • Cluster
  • autoReconnectbooleanfalsefalsetrueWhether the Redis client automatically reconnect or not.
    requestQueueintfalsefalse2147483647The maximum number of queued requests to Redis.
    tcpNoDelaybooleanfalsefalsefalseWhether to enable TCP with no delay or not.
    keepAlivebooleanfalsefalsefalseWhether to enable a keepalive to Redis or not.
    connectTimeoutlongfalsefalse10000The time to wait before timing out when connecting in milliseconds.
    operationTimeoutlongfalsefalse10000The time before an operation is marked as timed out in milliseconds .
    batchTimeMsintfalsefalse1000The Redis operation time in milliseconds.
    batchSizeintfalsefalse200The batch size of writing to Redis database.

    Example

    Before using the Redis sink connector, you need to create a configuration file through one of the following methods.

    • JSON

      {
          "redisHosts": "localhost:6379",
          "redisPassword": "fake@123",
          "redisDatabase": "1",
          "clientMode": "Standalone",
          "operationTimeout": "2000",
          "batchSize": "100",
          "batchTimeMs": "1000",
          "connectTimeout": "3000"
      }
      
    • YAML

      {
          redisHosts: "localhost:6379"
          redisPassword: "fake@123"
          redisDatabase: 1
          clientMode: "Standalone"
          operationTimeout: 2000
          batchSize: 100
          batchTimeMs: 1000
          connectTimeout: 3000
      }