StackExchange.Redis
StackExchange.Redis copied to clipboard
KeyMigrate with authentication
Can the KeyMigrate method be used against the target database with a password?
The migrate command supports AUTH option, but I didn't find it in the library.
Here is the code that I use
var source = ConnectionMultiplexer.Connect("127.0.0.1:6381");
var sourceDatabase = source.GetDatabase(5);
var sourceServer = source.GetServer("127.0.0.1", 6381);
var target = ConnectionMultiplexer.Connect("127.0.0.1:6379,password=my_password");
var targetEndPoint = target.GetEndPoints().Single();
await foreach (var key in sourceServer.KeysAsync(5))
{
await sourceDatabase.KeyMigrateAsync(key, targetEndPoint, 5, 10000, MigrateOptions.Copy | MigrateOptions.Replace)
.ConfigureAwait(false);
}
Indeed we do not support this today, and should. For an immediate workaround, you can use .ExecuteAsync() today.
Tagging this for API addition.