This document: https://aws.amazon.com/premiumsupport/knowledge-center/elasticache-crossslot-keys-error-redis/ mentions that "redis-py-cluster" can handle getting and setting keys (mget/mset) from slots located in different shards. Is this not possible with ioredis in cluster mode?
It's not possible with ioredis as it's "too magic"...as you said redis-py-cluster just uses multiple GETs so I afraid that abstract layer may mislead users (ex "MSET" is not atmic in cluster)
const exists = await redis.exists( key );
if ( exists ) {
console.log( `${key} does exists` );
} else {
console.log( `${key} does NOT exists` );
}
Anyone using ioredis with elasticache cluster mode?
I'm trying a failover scenario and my node process crashes (unhandled rejection) with:
Error: Connection is closed.
at close (node_modules/.pnpm/registry.npmjs.org/ioredis/4.17.1/node_modules/ioredis/built/redis/event_handler.js:179:25)
at Socket.<anonymous> (node_modules/.pnpm/registry.npmjs.org/ioredis/4.17.1/node_modules/ioredis/built/redis/event_handler.js:150:20)
at Object.onceWrapper (events.js:418:26)
at Socket.emit (events.js:311:20)
at Socket.EventEmitter.emit (domain.js:482:12)
at TCP.<anonymous> (net.js:668:12)
I'd happily post a debug log but I've exceeded elasticache failover api quota :/
I am facing issue in connecting to a single Elasticsearch instance. My code looks like bellow -
this.instance = new Redis({
host: REDIS_HOST,
port: REDIS_PORT,
tls: {},
connectTimeout: 10000,
maxRetriesPerRequest: 4,
retryStrategy: (times) => Math.min(times * 30, 1000),
reconnectOnError: (error) => {
const targetErrors = [/READONLY/, /ETIMEDOUT/];
targetErrors.forEach((targetError) => {
if (targetError.test(error.message)) {
return true;
}
});
}
});
RedisConnection.instance = this.instance;
I am getting following errors -
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 6379
I have verified that host: REDIS_HOST has correct resource address and it is not passing 127.0.0.1 or localhost.
@400000005f6a655f02387564 [ioredis] Unhandled error event: ClusterAllFailedError: Failed to refresh slots cache.
@400000005f6a655f02387d34 at tryNode (/var/www/api4/node_modules/ioredis/built/cluster/index.js:359:31)
@400000005f6a655f0238811c at /var/www/api4/node_modules/ioredis/built/cluster/index.js:376:21
@400000005f6a655f02388504 at Timeout.duplicatedConnection.cluster.utils_2.timeout (/var/www/api4/node_modules/ioredis/built/cluster/index.js:624:24)
@400000005f6a655f023888ec at Timeout.run (/var/www/api4/node_modules/ioredis/built/utils/index.js:156:22)
@400000005f6a655f0238dedc at listOnTimeout (timers.js:326:17)
@400000005f6a655f0238e2c4 at processTimers (timers.js:268:5)
All keys in the pipeline should belong to the same slots allocation group
when enableAutoPipelining set true