If you run help migrate
in redis-cli, it gives you better information about how to use the MIGRATE
command than the docs (which tell you how it works). Here's the output I get:
MIGRATE host port key| destination-db timeout [COPY] [REPLACE] [KEYS key]
summary: Atomically transfer a key from a Redis instance to another one.
since: 2.6.0
group: generic
The destination-db
here is referring to the database id within redis. By default, a redis system has 16 databases, numbers 0-15, so where you have destinationserver
in your example, it should be the database id to put the data in. That's why you're getting the error, it needs to be an INT id of the database.
For AUTH, as long as your Redis version is 4.0.7 or higher, MIGRATE
supports an AUTH keyword in the following form:
MIGRATE 127.0.0.2 6379 key 0 5000 AUTH my_password COPY
If you have Redis version 6.0.0 or higher, you can supply a username as well, though there's no information about this in the docs or in the output I have, but I'm not yet running version 6.