I am working with a cluster and when I use the -c option with Redis CLI it works fine for single commands, i.e. set/get. However if I try to load an AOF with --pipe and the -c option, none of the data is redirected. Is this by design?
Thanks
Comment From: AngusP
Short answer seems to be yes... https://github.com/antirez/redis/blob/46a8cb2d187d830a97c9f9b4735e8ded806bf9c3/src/redis-cli.c#L1068-L1069
For interactive mode, the MOVED response is followed and the command is reissued. In pipe mode, the function pipeMode is instead called and it does not contain any logic for detecting a MOVED error and reissuing commands. So, it seems that to pipe an aof in to a cluster-mode Redis server, you would need to ensure all the keys in the aof are in hash slots served by that server.
Comment From: gaurav
Thank you for documenting this here -- I spent ages trying to work out why the -c flag was being silently ignored in --pipe mode!
- Is there any interest in adding support to
MOVEDresponses in pipe mode? Are there any technical reasons why this couldn't be implemented? - It might be useful to produce a warning if both
-cand--pipeflags are provided to redis-cli to indicate that the-cwill be ignored and that keys not in hash slots served by the server will be rejected.