Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redis Cluster MOVED exception #179

Closed
jakejscott opened this issue Mar 23, 2015 · 6 comments
Closed

Redis Cluster MOVED exception #179

jakejscott opened this issue Mar 23, 2015 · 6 comments

Comments

@jakejscott
Copy link
Contributor

I have a 5 node cluster setup, I followed the Redis cluster tutorial here: http://redis.io/topics/cluster-tutorial

I have the following nodes:

10.53.10.193:7000 (master)
10.53.10.193:7001 (master)
10.53.10.193:7002 (master)
10.53.10.193:7003 (slave)
10.53.10.193:7004 (slave)
10.53.10.193:7005 (slave)

I get this exception for one of my keys, but not for the other.

[RedisServerException: MOVED 7789 127.0.0.1:7001]
   StackExchange.Redis.ConnectionMultiplexer.ExecuteSyncImpl(Message message, ResultProcessor`1 processor, ServerEndPoint server) in c:\TeamCity\buildAgent\work\3ae0647004edff78\StackExchange.Redis\StackExchange\Redis\ConnectionMultiplexer.cs:1836
   StackExchange.Redis.RedisBase.ExecuteSync(Message message, ResultProcessor`1 processor, ServerEndPoint server) in c:\TeamCity\buildAgent\work\3ae0647004edff78\StackExchange.Redis\StackExchange\Redis\RedisBase.cs:81
   StackExchange.Redis.RedisDatabase.ScriptEvaluate(String script, RedisKey[] keys, RedisValue[] values, CommandFlags flags) in c:\TeamCity\buildAgent\work\3ae0647004edff78\StackExchange.Redis\StackExchange\Redis\RedisDatabase.cs:873

These are the keys on the different nodes:

It doesn't have any trouble reading this key

127.0.0.1:7000> keys *
1) "{sample_f1mot2n5pbz25zolvd1gayuy}_Data"
2) "{sample_f1mot2n5pbz25zolvd1gayuy}_Internal"

But it has trouble with this key:

127.0.0.1:7001> keys *
1) "{sample_ihowwbhgu523f0vjkefvacbv}_Data"
2) "{sample_ihowwbhgu523f0vjkefvacbv}_Internal"

I think it might have something to do with this issue here:
#57

@peter-myklebust
Copy link

Finally, someone else reporting the same issue :-). I never got around to properly investigate this, but now, with Redis 3.0 imminent, a fix would be most welcome!

Peter Myklebust

@mgravell
Copy link
Collaborator

Can you show the Custer slots or cluster nodes output so I can try to repro
with your setup?
On 23 Mar 2015 07:52, "peter-myklebust" notifications@github.com wrote:

Finally, someone else reporting the same issue :-). I never got around to
properly investigate this, but now, with Redis 3.0 imminent, a fix would be
most welcome!

Peter Myklebust


Reply to this email directly or view it on GitHub
#179 (comment)
.

@jakejscott
Copy link
Contributor Author

Sure, do you need to know the current set of keys on each node too?

127.0.0.1:7000> CLUSTER SLOTS
1) 1) (integer) 5962
   2) (integer) 10922
   3) 1) "127.0.0.1"
      2) (integer) 7001
   4) 1) "127.0.0.1"
      2) (integer) 7004
2) 1) (integer) 11422
   2) (integer) 16383
   3) 1) "127.0.0.1"
      2) (integer) 7002
   4) 1) "127.0.0.1"
      2) (integer) 7005
3) 1) (integer) 0
   2) (integer) 5961
   3) 1) "127.0.0.1"
      2) (integer) 7000
   4) 1) "127.0.0.1"
      2) (integer) 7003
4) 1) (integer) 10923
   2) (integer) 11421
   3) 1) "127.0.0.1"
      2) (integer) 7000
   4) 1) "127.0.0.1"
      2) (integer) 7003
127.0.0.1:7000> 
127.0.0.1:7000> cluster nodes
0f9c187786c9084da838fa32ecf6fe8e8210db80 127.0.0.1:7003 slave eb2380a9e00607f79cf7f9bc336082fab57a980e 0 1427138715311 7 connected
1ada4cbdd442616c0b7990f933c77503d7034a2b 127.0.0.1:7001 master - 0 1427138716325 2 connected 5962-10922
d45748a0071f2bc8cdc1147d0b52895bbea46538 127.0.0.1:7002 master - 1427138717337 1427138714809 3 connected 11422-16383
faf843b055957cccd5d886864042802ff6ac54c7 127.0.0.1:7004 slave 1ada4cbdd442616c0b7990f933c77503d7034a2b 0 1427138715311 5 connected
457cac8fce074c14eb43ef09a07a6c16be4eb46f 127.0.0.1:7005 slave d45748a0071f2bc8cdc1147d0b52895bbea46538 1427138717337 1427138714809 6 connected
eb2380a9e00607f79cf7f9bc336082fab57a980e 127.0.0.1:7000 myself,master - 0 0 7 connected 0-5961 10923-11421
127.0.0.1:7000> 

@jakejscott
Copy link
Contributor Author

I cloned the latest unstable branch of redis and doesn't seem to happening anymore, and I also resetup my cluster using the create-cluster scripts.

@jakejscott
Copy link
Contributor Author

Haha @mgravell you've actually already explained the problem I was running into on your blog!

http://blog.marcgravell.com/2014/02/playing-with-redis-cluster-for-non.html

Now you should be fully setup and configured, ready to follow the tutorial. Note that you probably want to use the non-loopback ip when configuring the cluster, so that external clients don't get confused by MOVED replies:

$ ./redis-trib.rb create --replicas 1 192.168.0.15:7000 192.168.0.15:7001 192.168.0.15:7002 192.168.0.15:7003 192.168.0.15:7004 192.168.0.15:7005

@hadi-mansoori
Copy link

hadi-mansoori commented May 12, 2022

If you use redis-cli you can use this command
redis-cli -c -p ip:port
EX: redis-cli -c -p 127.0.0.1:6379

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants