127.0.0.1:6901> CLUSTER ADDSLOTS {0..5460} (error) ERR Invalid or out of range slot When i try to assign the slot to the node it met this error. Does my command error ? But when i use below command it can work . Who can help me to clear it why?
[root@wangshuang1 A]# redis-cli -p 6901 -a 123 cluster addslots {0..5460} Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe. OK
It seems once you enter into the cli you want to addslots only can add one bye one like : cluster addslots 0 1 2 3 4
Comment From: itamarhaber
Hello @Cloud-Zhang
Per the documentation, the CLUSTER ADDSLOTS expects one or more slots, not ranges of slots. That's why you're getting the error when attempting it in the cli's REPL.
When called as an argument for the cli, note that most shells substitute the expression {n..m} with the explicit range of n, n+1, ..., m - which is called Brace Expansion. You can verify that with a:
$ echo {0..5460}
So, after the shell's expansion takes place the actual command to the cli is in the expected format. However, if you use quotes to prevent the expansion, e.g. redis-cli -p 6901 -a 123 cluster addslots "{0..5460}", you will get the same error as from within the REPL.
Comment From: Cloud-Zhang
@itamarhaber Thanks for your reply . Understand it .