add password for connecting redis-sentinel

Change-Id: Ic244a3028d9c4c189a58ddc76cd59d9f9d5aeea7
Close-Bug: #1787342
This commit is contained in:
lipan
2018-08-16 15:58:14 +08:00
committed by Tovin Seven
parent e8dc7113ab
commit 98238b48c7

View File

@@ -175,6 +175,7 @@ class RedisSentinel(Redis, base.Driver):
socket_timeout = self.conf.profiler.socket_timeout
parsed_url = parser.urlparse(self.connection_str)
sentinel = Sentinel([(parsed_url.hostname, int(parsed_url.port))],
password=parsed_url.password,
socket_timeout=socket_timeout)
self.db = sentinel.master_for(self.conf.profiler.sentinel_service_name,
socket_timeout=socket_timeout)