RedLock.net icon indicating copy to clipboard operation
RedLock.net copied to clipboard

Is there a way to configure a username in addition to a password?

Open odahcam opened this issue 4 months ago • 1 comments

It seems in newer redis it is possible to configure a username and in Amazon ElastiCache, which I intend to use, does require a username for connection. So I'd like to know if it is possible to setup the connection with a username, is ti?

Thanks in advance!

odahcam avatar Aug 20 '25 00:08 odahcam

If you let RedLock.net manage the Redis connections itself (by creating the RedLockFactory with a list of EndPoint or RedLockEndPoint objects) then specifying a username isn't currently supported (although it would be pretty straightforward to add).

However, you can instantiate the StackExchange.Redis.ConnectionMultiplexer objects yourself (specifying the user and password in the connection string or ConfigurationOptions) and pass those to the RedLockFactory then you should be able to achieve what you're after. If you go this route, you should also set abortConnect=false in the connection string (or AbortOnConnectFail = false in the ConfigurationOptions config) btw.

See https://github.com/samcook/RedLock.net#to-have-redlock-use-existing-redis-connections for an example.

samcook avatar Sep 03 '25 04:09 samcook