Home  >  Article  >  Database  >  Error when connecting to redis cluster: (error) Solution to MOVED

Error when connecting to redis cluster: (error) Solution to MOVED

尚
forward
2020-05-29 09:02:339384browse

Error when connecting to redis cluster: (error) Solution to MOVED

When using redis-cli to connect to the redis cluster and perform data operations, an error is reported

./redis-cli -h 192.24.54.1 -p 6379 -a '123456'
192.24.54.1:6379> get name
(error) MOVED 5798 192.24.54.2:6379

Solution:

This situation is generally due to Caused by not setting the cluster mode when starting redis-cli.

Use the -c parameter to start the cluster mode when starting. The command is as follows:

./redis-cli -h 192.24.54.1 -p 6379 -a '123456' -c
192.24.54.1:6379> get name
-> Redirected to slot [5798] located at 192.24.54.2:6379
"yayun"

For more redis knowledge, please pay attention to the redis introductory tutorial column.

The above is the detailed content of Error when connecting to redis cluster: (error) Solution to MOVED. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:jianshu.com. If there is any infringement, please contact admin@php.cn delete