unable to see data on the redis cluster but can fetch via redis-adapter client in node js

0

hi, i am connecting to the elasticache redis cluster and setting getting data using below code: pubClient = createClient({host: <redis-cluster-endpoint>,port: 6379,tls: {rejectUnauthorized: false} await pubClient.hGetAll('customHashName') is giving me an object with 2 records. but scan 0 gives me empty array when i connect to the redis cluster via ec2 terminal where i have installed redis-cli. i am using correct values everywhere for connecting but still can't see the data in redis-cli. my redis cluster is serverless.

질문됨 2달 전196회 조회
1개 답변
0

There could be a few reasons why you are not able to see the data in Redis CLI that you are able to retrieve via the Node.js code:

  • The Redis CLI connection is not pointing to the same endpoint as the Node.js client. Make sure the Redis CLI is connecting to the same endpoint as the primary node of the Redis cluster.
  • The data is stored on a different shard/node than where the Redis CLI is connected. Redis cluster partitions the data across multiple nodes/shards. The CLI may be connected to a different node/shard than where the key exists.
  • The Redis CLI is not configured to connect to a Redis cluster. For a cluster setup, Redis CLI needs to be compiled with cluster mode enabled.

Having said that, please check these:

  • Connect Redis CLI to the same endpoint as the primary node using
redis-cli -c -h <redis-cluster-endpoint> -p 6379
  • Use Redis CLI CLUSTER commands like
 CLUSTER NODES

to check cluster configuration and nodes,

 CLUSTER KEYSLOT

to identify shard for the key

  • Recompile Redis CLI with cluster mode enabled if not already done so.
profile picture
전문가
답변함 2달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠