Commit 9fdc8277 authored by 胡凯旋's avatar 胡凯旋

redis auth

parent 28b4574d
...@@ -12,10 +12,10 @@ import settings ...@@ -12,10 +12,10 @@ import settings
class Monitor(object): class Monitor(object):
def __init__(self): def __init__(self):
self.rs = {redis_url: redis.StrictRedis(*redis_url.split(':')) for redis_url in settings.REDIS_URL} self.rs = {"{}:{}/{}".format(r['host'], r['port'], r['db']): redis.StrictRedis(**r) for r in settings.REDIS}
self.keyprefix_queue = '_kombu.binding.' self.keyprefix_queue = '_kombu.binding.'
self.sep = '\x06\x16' self.sep = '\x06\x16'
self.redis_queue_map = {redis_url: [] for redis_url in settings.REDIS_URL} self.redis_queue_map = {"{}:{}/{}".format(r['host'], r['port'], r['db']): [] for r in settings.REDIS}
def refresh_redis_queue_map(self): def refresh_redis_queue_map(self):
for url, r in self.rs.items(): for url, r in self.rs.items():
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
""" """
# redis URL # redis URL
REDIS_URL = [ REDIS = [
'localhost', {'host':'localhost', 'port': 6379, 'db': 2, 'password':'secret'},
] ]
# pushgateway URL # pushgateway URL
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment