Cant't find a way to work around the errors "TYPE returned an error: MOVED" and "Error: MOVED"

0

I have an AWS Elasticache for Redis configured with cluster mode enabled, using multi az and with 5 shards and 3 nodes (1 primary and 2 replicas). The eviction algorithm is volatile-lfu

From an EC2 instance running the latest Amazon Linux 2023, I'm trying to collect the hotkey and bigkeys data using redis-cli but I'm unable to get the desired results:

  • Using --hotkeys command line parameter
~> redis6-cli -c -h mycluster.cache.amazonaws.com -p 6379 --tls --hotkeys

# Scanning the entire keyspace to find hot keys as well as
# average sizes per key type.  You can use -i 0.1 to sleep 0.1 sec
# per 100 SCAN commands (not usually needed).

Error: MOVED 6787 node.mycluster.cache.amazonaws.com:6379
  • Using --bigkeys command line parameter
~> redis6-cli -c -h mycluster.cache.amazonaws.com -p 6379 --tls --bigkeys

# Scanning the entire keyspace to find hot keys as well as
# average sizes per key type.  You can use -i 0.1 to sleep 0.1 sec
# per 100 SCAN commands (not usually needed).

TYPE returned an error: MOVED 6787 node.mycluster.cache.amazonaws.com:6379

I did a lot of research on the errors above and all i can find is that you should use the -c command line switch to enable redis-cli to follow the MOVED errors/messages, but as can be seen, I'm using it.

The REPL works just fine for get, set and delete keys. I tried to use --scan parameter and it also worked.

asked a year ago426 views
1 Answer
0

Hello,

It looks like redis cli issue. Here are few recommendations for running bigkeys and hotkeys:

  1. Use the latest stable redis cli release: https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/nodes-connecting.html

  2. Use redis-cli connect to the configuration endpoint. Configuration endpoint could be found from cluster details.

  3. Find the **primary nodes **by executing cluster nodes.

$ redis6-cli -c -h <configuration endpoint> -p 6379 --tls

cluster nodes

  1. Run the bigkeys and hotkeys against the node endpoint of individual primary nodes.

$ redis6-cli -c -h <primary node endpoint> -p 6379 --tls --hotkeys

AWS
answered a year ago
  • For all my tests I'm using the configuration endpoint. I will test the primary node endpoint recommendation

  • Well, with the cluster mode enabled, there is no concept of primary node endpoint. Based on the following documentation: Redis (cluster mode enabled) clusters with replicas, because they have multiple shards (API/CLI: node groups), which mean they also have multiple primary nodes, have a different endpoint structure than Redis (cluster mode disabled) clusters. Redis (cluster mode enabled) has a configuration endpoint which "knows" all the primary and node endpoints in the cluster.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions