Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface ClusterOptions

Options for Cluster constructor

Hierarchy

  • CommanderOptions
    • ClusterOptions

Index

Properties

autoPipeliningIgnoredCommands?: string[]

See Redis class.

default

[]

dnsLookup?: DNSLookupFunction

Hostnames will be resolved to IP addresses via this function. This is needed when the addresses of startup nodes are hostnames instead of IPs.

You may provide a custom lookup function when you want to customize the cache behavior of the default function.

default

require('dns').lookup

enableAutoPipelining?: boolean

See Redis class.

default

false

enableOfflineQueue?: boolean

See Redis class.

default

true

enableReadyCheck?: boolean

When enabled, ioredis only emits "ready" event when CLUSTER INFO command reporting the cluster is ready for handling commands.

default

true

keyPrefix?: string
lazyConnect?: boolean

By default, When a new Cluster instance is created, it will connect to the Redis cluster automatically. If you want to keep the instance disconnected until the first command is called, set this option to true.

default

false

maxRedirections?: number

When a MOVED or ASK error is received, client will redirect the command to another node. This option limits the max redirections allowed to send a command.

default

16

natMap?: NatMap
redisOptions?: Omit<RedisOptions, "port" | "host" | "path" | "retryStrategy" | "readOnly" | "enableOfflineQueue" | "sentinels">

Passed to the constructor of Redis

default

null

SRV records will be resolved via this function.

You may provide a custom resolveSrv function when you want to customize the cache behavior of the default function.

default

require('dns').resolveSrv

retryDelayOnClusterDown?: number

When a CLUSTERDOWN error is received, client will retry if retryDelayOnClusterDown is valid delay time (in ms).

default

100

retryDelayOnFailover?: number

When an error is received when sending a command (e.g. "Connection is closed." when the target Redis node is down), client will retry if retryDelayOnFailover is valid delay time (in ms).

default

100

retryDelayOnMoved?: number

By default, this value is 0, which means when a MOVED error is received, the client will resend the command instantly to the node returned together with the MOVED error. However, sometimes it takes time for a cluster to become state stabilized after a failover, so adding a delay before resending can prevent a ping pong effect.

default

0

retryDelayOnTryAgain?: number

When a TRYAGAIN error is received, client will retry if retryDelayOnTryAgain is valid delay time (in ms).

default

100

scaleReads?: Function | NodeRole

Scale reads to the node with the specified role.

default

"master"

scripts?: Record<string, { lua: string; numberOfKeys?: number; readOnly?: boolean }>

Custom LUA commands

showFriendlyErrorStack?: boolean
slotsRefreshInterval?: number

The milliseconds between every automatic slots refresh.

default

5000

slotsRefreshTimeout?: number

The milliseconds before a timeout occurs while refreshing slots from the cluster.

default

1000

useSRVRecords?: boolean

Discover nodes using SRV records

default

false

Methods

  • clusterRetryStrategy(times: number, reason?: Error): number | void
  • See "Quick Start" section.

    default

    (times) => Math.min(100 + times * 2, 2000)

    Parameters

    • times: number
    • Optional reason: Error

    Returns number | void

Generated using TypeDoc