简体   繁体   中英

ElastiCache for Redis - redirections for cluster mode disabled?

Refer to the documentation of ElastiCache for Redis -> Getting Started -> Step 4: Connect to the cluster's mode: https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/GettingStarted.ConnectToCacheNode.html

Under the section Connecting to a cluster mode disabled unencrypted-cluster , the docs ask you to run the following command:

$ src/redis-cli -h cluster-endpoint -c -p port number

Then, it gives an example of some redis commands:

set x Hi
-> Redirected to slot [16287] located at 172.31.28.122:6379
OK
set y Hello
OK
get y
"Hello"
set z Bye
-> Redirected to slot [8157] located at 172.31.9.201:6379
OK
get z
"Bye"
get x
-> Redirected to slot [16287] located at 172.31.28.122:6379
"Hi"

What I don't understand is: when we're talking about a "cluster mode disabled" ElastiCache cluster, it means that there's only one shard, as stated in the docs: Components and Features .

If so, how is it that the requests sent in the example above got redirected to other nodes? If there's only one shard, it means that all the data is written in the primary node. The primary node may be replicated to replica nodes, but that's another thing..

Is it a mistake in the docs or am I missing something?

A Redis cluster is a logical grouping of one or more ElastiCache for Redis shards. In the example it talks about interacting with a "cluster mode disabled" redis, however replication is turned on as you see in the screenshot there are 1 primary node and 2 replicas.

Initially I thought the redirections are due to replica, but I tested on my Redis cluster mode disabled with same replication setup and I do not get the ASK and MOVED redirections. I also tested this against the read only directly. (I connected with --verbose mode and -c )

I was not able to generate the redirection events you see in the documentation.

Therefore I can say with strong certainty that the author of the document has pasted in output from a cluster mode enabled Redis cluster, which is possibly causing you the confusion.

You are right. The title for this section in the documentation is incorrect and it describes how to connect to a cluster mode enabled unecrypted cluster.

You can leave feedback on documentation inaccuracies by clicking on the feedback icon in the navigation pane on the upper right part of the screen or clicking on "Provide feedback" at the bottom left in the footer of the page.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM