How to Solve Redis Cluster Error: (Error) Moved

The solution of data operation error moved with redis cli

Examples of error reporting:

(base) wdh@wdh:~$ redis-cli -h 172.17.0.1 -p 6391
172.17.0.1:6391> get name
(error) MOVED 5798 172.100.0.1:6392
172.17.0.1:6391> 

Cause of error:

No cluster mode connection (connection node command does not add – C parameter)

terms of settlement:

Connect redis cluster nodes with – C parameter: redis cli – C – H 172.17.0.1 – P 6391

(base) wdh@wdh:~$ redis-cli -c -h 172.17.0.1 -p 6391
172.17.0.1:6391> get name
-> Redirected to slot [5798] located at 172.100.0.1:6392
(nil)
172.100.0.1:6392> set name 1
OK
172.100.0.1:6392> get name
"1"
172.100.0.1:6392> 

Read More: