Let's try for data storage
127.0.0.1:7000> set name marklogzhu
OK
127.0.0.1:7000> get name
"marklogzhu"
127.0.0.1:7000> set name1 java
(error) MOVED 12933 127.0.0.1:7002
When we set up name1 java
actually being given, what is the situation?
moved redirection
This is because the clustered Redis stored key calculates a corresponding slot and the node, if the corresponding node is not the current node, then it will report moved 重定向
an error, as shown:
ask redirection
In addition to moved
outside the error, there is an ask
error, it refers to the process of being migrated groove client to access it needs to be redirected to the new node up.
redis-cli -c
Then the cluster to access how to do it, we can use the redis-cli -c
command to access, it prevents moved and ask abnormal, it will automatically jump to the corresponding node Redis commands up to continue, we have to give it a try:
[root@VM_0_15_centos redis4]# ./redis-cli -c -p 7003
127.0.0.1:7003> get name
-> Redirected to slot [5362] located at 127.0.0.1:7000
"marklogzhu"
127.0.0.1:7000>