|
@@ -1,7 +1,6 @@
|
|
import redis
|
|
import redis
|
|
from redis.connection import SSLConnection
|
|
from redis.connection import SSLConnection
|
|
-
|
|
|
|
-from AnsjerPush.config import REDIS_ADDRESS, CONFIG_INFO, CONFIG_US
|
|
|
|
|
|
+from AnsjerPush.config import REDIS_ADDRESS, OCI_REDIS_NODE_PRIMARY, OCI_REDIS_NODE_READ, CONFIG_INFO, CONFIG_US
|
|
|
|
|
|
# 本地调试把注释打开
|
|
# 本地调试把注释打开
|
|
# REDIS_ADDRESS = '127.0.0.1'
|
|
# REDIS_ADDRESS = '127.0.0.1'
|
|
@@ -10,16 +9,14 @@ from AnsjerPush.config import REDIS_ADDRESS, CONFIG_INFO, CONFIG_US
|
|
class RedisObject:
|
|
class RedisObject:
|
|
|
|
|
|
def __init__(self, mode='w', db=0):
|
|
def __init__(self, mode='w', db=0):
|
|
- # self.POOL = redis.ConnectionPool(host=REDIS_ADDRESS, port=6379, db=db)
|
|
|
|
- # self.CONN = redis.Redis(connection_pool=self.POOL)
|
|
|
|
if CONFIG_INFO != CONFIG_US:
|
|
if CONFIG_INFO != CONFIG_US:
|
|
self.POOL = redis.ConnectionPool(host=REDIS_ADDRESS, port=6379, db=db)
|
|
self.POOL = redis.ConnectionPool(host=REDIS_ADDRESS, port=6379, db=db)
|
|
self.CONN = redis.Redis(connection_pool=self.POOL)
|
|
self.CONN = redis.Redis(connection_pool=self.POOL)
|
|
else:
|
|
else:
|
|
if mode == 'w':
|
|
if mode == 'w':
|
|
- host = REDIS_ADDRESS
|
|
|
|
|
|
+ host = OCI_REDIS_NODE_PRIMARY
|
|
else:
|
|
else:
|
|
- host = 'amaaaaaayszequiamxr7cdpparig3ptmytvde5vvnz6n7gceo4232sbhhlsa-r.redis.us-phoenix-1.oci.oraclecloud.com'
|
|
|
|
|
|
+ host = OCI_REDIS_NODE_READ
|
|
self.POOL = redis.ConnectionPool(connection_class=SSLConnection, host=host, port=6379, db=db)
|
|
self.POOL = redis.ConnectionPool(connection_class=SSLConnection, host=host, port=6379, db=db)
|
|
self.CONN = redis.StrictRedis(
|
|
self.CONN = redis.StrictRedis(
|
|
connection_pool=self.POOL,
|
|
connection_pool=self.POOL,
|