Skip to content
This repository was archived by the owner on Feb 20, 2021. It is now read-only.

Redis in Cluster mode, CLUSTER ADDSLOTS fails always with (error) ERR Invalid or out of range slot #331

Closed
tellan55 opened this issue Oct 4, 2015 · 7 comments

Comments

@tellan55
Copy link

tellan55 commented Oct 4, 2015

Hi there

I am starting using Redis in Cluster mode.

I follow-up all that I have found here, many web sites on Internet, including Redis.io, however I can't distribute the Hash Slots. (http://redis.io/commands/cluster-addslots)

I have tried bash, DOS commands, power shell and directly inside the server in a console with the redis-cli and always the same error.

This Master doesn't know yet about the other Masters and/or slaves. This is the command I am using to connect to the Master:

redis-cli -c -p 6379 -h 127.0.0.1

After successful connection run cluster info:

127.0.0.1:6379> cluster info
cluster_state:fail
cluster_slots_assigned:0
cluster_slots_ok:0
cluster_slots_pfail:0
cluster_slots_fail:0
cluster_known_nodes:1
cluster_size:0
cluster_current_epoch:0
cluster_my_epoch:0
cluster_stats_messages_sent:0
cluster_stats_messages_received:0

Then when running the command:

127.0.0.1:6379> CLUSTER ADDSLOTS {0..5460}
(error) ERR Invalid or out of range slot

I can add hash slots when I use the command CLUSTER ADSDSLOTS 1 2 3 4

But not when using CLUSTER ADDSLOTS {0..5460}.

Is this command supported in the Windows ported version to do this?

Thanks

@enricogior
Copy link

Hi @tellan55
as far as I know CLUSTER ADDSLOTS {0..5460} is not a supported syntax by Redis on Linux, correct me if I'm wrong.

@tellan55
Copy link
Author

tellan55 commented Oct 5, 2015

Hi @enricogior

I found it as a comment in this link, (http://redis.io/commands/cluster-addslots)

Also it might be an error but it is in the recent book "Redis Essentials" by Silva, Maxwell Dayvson... in the section about Redis Cluster.

If not supported how can we distributed the Hash Slots?

Thanks

@enricogior
Copy link

@tellan55
I tried on a Linux box and it doesn't work. I also checked the source code and I haven't found any indication that it is supported.
Also, given is not present in the official documentation I guess it's safe to say it's not supported.

@tellan55
Copy link
Author

tellan55 commented Oct 6, 2015

@enricogior

Thanks Enrico,

I will see how to programmatically inject those hash slots.
I will also drop a note to the editorial and the author of that book.

@tellan55
Copy link
Author

I decided to use Windows command instead any other programmatically language.

Based on that, here is the command you will need to run as *.bat file inside each cluster node and in the folder that contains redis-cli.exe changing those 3 initial values (0,1,5461) to the correspondent values per cluster node and adapting it the topology you decide to deploy:

0 = initial cluster slots value
1= Increment value
5461 = Max, cluster slot value

for /L %%n in (0,1,5461) do redis-cli.exe -c -h 127.0.0.1 -p 6379 cluster addslots %%n

@enricogior
Copy link

@tellan55
thanks for the feedback I've added it to the wiki page.

@LongStockingPipi
Copy link

how do you finished? i am chinese ,my english is bad,so could you tell me easyly ? thank you!

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

No branches or pull requests

3 participants