Redis study concluded (seven) - Redis cluster of end customers access

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 javaactually 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 movedoutside the error, there is an askerror, 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 -ccommand 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> 

SpringBoot access

SpringBoot study summary (four) - Integrated Redis

Guess you like

Origin www.cnblogs.com/markLogZhu/p/11418942.html