scala-redis icon indicating copy to clipboard operation
scala-redis copied to clipboard

How to add password to RedisClientPool?

Open AthanatiusC opened this issue 3 years ago • 5 comments

Hello, i have a code which uses RedisClientPool, but it does not integrate any kind of authentication yet. But now we need to change it into using authentication. So i wonder can i add password parameter into RedisClientPool? If so, may i get some example?

Thank you!

AthanatiusC avatar Oct 21 '21 09:10 AthanatiusC

RedisClientPool has a constructor parameter called secret which serves as the password parameter.

noahlz avatar Nov 02 '21 12:11 noahlz

@AthanatiusC can you please provide more details? I might be seeing a similar issue where my RedisClientPool is failing with java.lang.Exception: NOAUTH Authentication required.

noahlz avatar Nov 03 '21 15:11 noahlz

I added unit tests in a PR that prove that RedisClientPool supports authentication properly.

There is an issue with RedisClient in the new-added BATCH mode, but that's unrelated to this.

noahlz avatar Nov 03 '21 17:11 noahlz

Hello, Thank you very much for the kind reply. I have not been looking at email for the past few days. Thanks to your help of Secret parameter, i have been successfully use RedisClientPool with password... there was some edge case where authentication failed but it was just my workplace environment failure.

Thank you!

AthanatiusC avatar Nov 04 '21 01:11 AthanatiusC

If anyone were to encounter some difficulties constructing the pool. Here is some code i have been successfully use the pool with

lazy val redisClientPool = new RedisClientPool(redisServerUrl, redisPort, database = redisDatabaseName,secret=Some(redisPassword))

AthanatiusC avatar Nov 04 '21 01:11 AthanatiusC