Open nimishnz opened 2 years ago
Update: Found lPopCount method which pops count of items from queue. So we are good with lPop issue.
I had a similar issue although I was using https://github.com/Grokzen/docker-redis-cluster for the cluster. By looking at the docker logs I saw that unlike elasticache, there are multiple root nodes created, so I needed to both expose those ports in my docker-compose, and then add them to rootNodes
.
in my docker-compose
ports:
- '6379:6379'
- '6380:6380'
- '6381:6381'
and then in code(I had a comma delimited env variable ELASTICACHE_HOST=localhost:6379,localhost:6380,localhost:6381
)..
this.cluster = createCluster({
rootNodes: process.env.ELASTICACHE_HOST.split(',').map((url) => ({ url: `redis://${url}` })),
});
I'm not sure this is exactly the issue you're experiencing but hope it helps! I found this issue because I'm getting the same master of undefined error but in AWS ElastiCache and it happens very sporadically.
I am new to Redis and Node-redis. I have setup local redis using bitnami image. Below is a part of docker-compose.yml
Below is nodejs program to initialise redis cluster and add items to list.
This program work fine if we use createClient instead of createCluster to connect to bitnami redis cluster container. yeah lPop ignores the count and always returns/pops only 1 item from list. aport from that no errors/exceptions as such.
if createCluster is used, rPush, lPop fails with error
**Cannot read property 'master' of undefined**
: This error I can reproduce with my local docker-setup.This exact same code works fine when used against production server (AWS ElastiCache Redis Cluster, Engine Version:6.2.6). So I strongly believe this could be due to my docker-compose setup.
Please suggest me if I am doing anything wrong or way to fix this issue. Complete stack:
sendCommand also seems to fail in case of cluster. Fails against AWS redis server.
Please help me to proceed in this case. Apologies if this is already being discussed, please point me to the same. Thanks for the support.
Environment:
MacOS 12.4, Tests against Bitnami Redis Cluster.
Ubuntu 22.04 LTS, Tests against AWS ElastiCache Redis Cluster.