|
@@ -1,7 +1,6 @@
|
|
|
import redis
|
|
|
import rediscluster
|
|
|
from rediscluster import ClusterConnectionPool
|
|
|
-from rediscluster import RedisCluster
|
|
|
from AnsjerPush.config import REDIS_ADDRESS, CONFIG_INFO, CONFIG_US
|
|
|
|
|
|
# 本地调试把注释打开
|
|
@@ -13,9 +12,8 @@ class RedisObject:
|
|
|
def __init__(self, db=0):
|
|
|
if CONFIG_INFO == CONFIG_US:
|
|
|
from AnsjerPush.config import STARTUP_NODES, REDIS_PASSWORD
|
|
|
- # pool = ClusterConnectionPool(startup_nodes=STARTUP_NODES, password=REDIS_PASSWORD, max_connections=100)
|
|
|
- # self.CONN = rediscluster.RedisCluster(connection_pool=pool)
|
|
|
- self.CONN = RedisCluster(startup_nodes=STARTUP_NODES, decode_responses=True, password=REDIS_PASSWORD)
|
|
|
+ pool = ClusterConnectionPool(startup_nodes=STARTUP_NODES, password=REDIS_PASSWORD, max_connections=100)
|
|
|
+ self.CONN = rediscluster.RedisCluster(connection_pool=pool)
|
|
|
else:
|
|
|
pool = redis.ConnectionPool(host=REDIS_ADDRESS, port=6379, db=db)
|
|
|
self.CONN = redis.Redis(connection_pool=pool)
|