How to connect to aws elastic cache cluster ? #2768
-
I wonder what is the equivalent of https://github.com/redis/ioredis?tab=readme-ov-file#special-note-aws-elasticache-clusters-with-tls in node-redis? Currently in ioredis we just use and it works fine( the only issue is redis/ioredis#1454): const redisCluster = new Redis.Cluster([{
host:"clustercfg.redis-cluster-name.xiko.euw1.cache.amazonaws.com:6379",
port:6379
}], {
scaleReads: 'all',
dnsLookup: (address, callback) => callback(null, address),
redisOptions: {
password:"token",
tls: {},
},
}) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
I'm not too sure why the createClient({
socket: {
host: 'redis.server',
port: 6379
tls: true
},
password: 'token'
}); and using createCluster({
rootNodes: [{
socket: {
host: 'redis.server',
port: 6379
}
}],
defaults: {
socket: {
tls: true
},
password: 'token'
}
}); please let me know if it works for you, and if and what you think we should update in the documentation edit: |
Beta Was this translation helpful? Give feedback.
I'm not too sure why the
dnsLookup
function is needed, but usingRedisClient
, anything that is under thesocket
option is passed directly tonet.connect
ortls.connect
(see https://github.com/redis/node-redis/blob/master/docs/client-configuration.md), so you can do:and using
RedisCluster
, anything underdefaults
will be passed to all clients created by the cluster (see https://github.com/redis/node-redis/blob/master/docs/clustering.md#createcluster-configuration), so you can do: