Skip to main content

Redis sink connector

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​

NameTypeRequiredDefaultDescription
redisHostsStringtrue" " (empty string)A comma-separated list of Redis hosts to connect to.
redisPasswordStringfalse" " (empty string)The password used to connect to Redis.
redisDatabaseinttrue0The Redis database to connect to.
clientModeStringfalseStandaloneThe client mode when interacting with Redis cluster.

Below are the available options:
  • Standalone
  • Cluster
  • autoReconnectbooleanfalsetrueWhether the Redis client automatically reconnect or not.
    requestQueueintfalse2147483647The maximum number of queued requests to Redis.
    tcpNoDelaybooleanfalsefalseWhether to enable TCP with no delay or not.
    keepAlivebooleanfalsefalseWhether to enable a keepalive to Redis or not.
    connectTimeoutlongfalse10000The time to wait before timing out when connecting in milliseconds.
    operationTimeoutlongfalse10000The time before an operation is marked as timed out in milliseconds .
    batchTimeMsintfalse1000The Redis operation time in milliseconds.
    batchSizeintfalse200The 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
      }