https://github.com/leffss/ScrapyRedisBloomFilterBlockCluster
https://pypi.org/project/scrapy-redis-sentinel/ scrapy 使用redis 哨兵
import redis
from redis.sentinel import Sentinel
python 中使用 redis哨兵
class RedisClient(object):
'''初始化Redis数据库'''
def __init__(self,TYPE, host=REDIS_HOST, port=REDIS_PORT, password=REDIS_PASSWORD,db=0):
# self.db = redis.StrictRedis(host=host, port=port, password=password, decode_responses=True, db=db)
self.db = Sentinel([('172.20.0.252', 26079), ('172.20.0.252', 26080),('172.20.0.252', 26081)], socket_timeout=0.5)
if TYPE=='write':
self.db = self.db.master_for('local-mas