-
Notifications
You must be signed in to change notification settings - Fork 484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is elasticache cluster mode supported with node-redis? #553
Comments
I am also facing this issue. Have you come across a solution @jlippold ? |
Nah bro, I switched to io-redis instead |
Hi! I was not able to reproduce the issue: Elasticache with cluster mode enabled: Dependencies:
My server: const { createCluster } = require("redis");
const { Server } = require("socket.io");
const { createAdapter } = require("@socket.io/redis-adapter");
async function main() {
const pubClient = createCluster({
rootNodes: [
{
url: "redis://test02-0001-001.jrvb7m.0001.usw1.cache.amazonaws.com:6379",
},
{
url: "redis://test02-0002-001.jrvb7m.0001.usw1.cache.amazonaws.com:6379",
},
{
url: "redis://test02-0003-001.jrvb7m.0001.usw1.cache.amazonaws.com:6379",
},
],
});
const subClient = pubClient.duplicate();
await Promise.all([
pubClient.connect(),
subClient.connect(),
]);
console.log("successful connection");
const io = new Server({
adapter: createAdapter(pubClient, subClient)
});
const io2 = new Server({
adapter: createAdapter(pubClient, subClient)
});
io2.on("hello", (val) => {
console.log("received", val);
});
setTimeout(() => {
io.serverSideEmit("hello", "world");
}, 100);
}
main().catch((err) => {
console.error(err);
}); Output:
The Could you please check? Reference: https://socket.io/docs/v4/redis-adapter/#with-the-redis-package-and-a-redis-cluster |
@jlippold did you ever find a solution? I'm having the same issue using redis elasticache serverless. When using ioredis I can connect but I'm seeing the following error
My code looks like this const pubClient = new IORedis(config.redisUri, {
maxRetriesPerRequest: null,
lazyConnect: true,
});
const subClient = pubClient.duplicate();
await Promise.all([pubClient.connect(), subClient.connect()]);
socketServer.adapter(createAdapter(pubClient, subClient)); |
Sorry, I ended up switching to ioredis |
When using this package with node-redis, I get the following error
The only related issue I can find, is this one which describes switching to io-redis over node-redis when using elasticache for cluster mode. #484
This issue in node-redis says support was added: redis/node-redis#2065 but they don't really give any documention on how to use it.
Does this package support node-redis with Elasticache in AWS? I'm running Redis OSS cluster serverless. Thanks for the help
Here's a code snippet of my current socket implementation which does throws the error
Thanks for the help
The text was updated successfully, but these errors were encountered: