Because you didn't specify any key to be migrated.
Since you used the KEYS
option, you need to specify keys after this option:
MIGRATE localhost 6380 "" 2 50000 AUTH my_password COPY KEYS key1 key2 key3 ...
So in order to migrate keys from one db to another, you need to scan these keys from the source db first.
Also, in your case, you don't need MIGRATE
command, but the COPY
command, if you're using Redis 6.2.0 or later.
Try the following one-liner:
redis-cli --scan | xargs -I {} redis-cli copy {} {} DB 2