From 6c776198219d7c71e6e3d756e58e8c7f4fb644cd Mon Sep 17 00:00:00 2001 From: Felix Mann Date: Mon, 29 May 2017 14:01:07 +0200 Subject: [PATCH] Add password and db to SentinelMonitoredRedisClientMasterSlaves --- src/main/scala/redis/RedisPool.scala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/scala/redis/RedisPool.scala b/src/main/scala/redis/RedisPool.scala index fe0a0df7..509bab13 100644 --- a/src/main/scala/redis/RedisPool.scala +++ b/src/main/scala/redis/RedisPool.scala @@ -177,20 +177,20 @@ case class RedisClientMasterSlaves(master: RedisServer, case class SentinelMonitoredRedisClientMasterSlaves( - sentinels: Seq[(String, Int)] = Seq(("localhost", 26379)), master: String) + sentinels: Seq[(String, Int)] = Seq(("localhost", 26379)), master: String, password: Option[String] = None, db: Option[Int] = None) (implicit _system: ActorSystem, redisDispatcher: RedisDispatcher = Redis.dispatcher) extends SentinelMonitored(_system, redisDispatcher) with ActorRequest with RedisCommands with Transactions { val masterClient: RedisClient = withMasterAddr( (ip, port) => { - new RedisClient(ip, port, name = "SMRedisClient") + new RedisClient(ip, port, name = "SMRedisClient", password = password, db = db) }) val slavesClients: RedisClientMutablePool = withSlavesAddr( slavesHostPort => { val slaves = slavesHostPort.map { case (ip, port) => - new RedisServer(ip, port) + new RedisServer(ip, port, password = password, db = db) } new RedisClientMutablePool(slaves, name = "SMRedisClient") }) @@ -198,12 +198,12 @@ case class SentinelMonitoredRedisClientMasterSlaves( val onNewSlave = (ip: String, port: Int) => { log.info(s"onNewSlave $ip:$port") - slavesClients.addServer(RedisServer(ip, port)) + slavesClients.addServer(RedisServer(ip, port, password = password, db = db)) } val onSlaveDown = (ip: String, port: Int) => { log.info(s"onSlaveDown $ip:$port") - slavesClients.removeServer(RedisServer(ip, port)) + slavesClients.removeServer(RedisServer(ip, port, password = password, db = db)) } val onMasterChange = (ip: String, port: Int) => {