Redis Sentinel 常见问题

节点运维

节点上下线:主节点,从节点,sentinel 节点
机器下线:例如过保等情况
机器性能不足:CPU,内存等

下线:
主节点:sentinel failover (忽略主客观下线,领导选举)
从节点:临时下线还是永久下线,但是要考虑读写分离情况

上线:
主节点:sentinel failover
从节点:slave of
sentinel 节点:参考其他节点启动即可

高可用读写分离

jedissentinelpool 实现:客户端
###Sentinelpool
jedisSentinelPool(String masterName,Set<String> sentinels,
final  GenericObjectPoolConfig poolconfig, final  int connectionTimeout,
final  int sotimeout,final  String passward,final  int database,final String clientName)

####sentinelpool 中sentinels初始化函数
initSentinels(Set<String> sentinels,final String masterName){
    ...
    for(String sentinel:sentinels){
        final HostAndPort hap = HostAndPort.parseString(Sentinel);
        List<String> masterAddr = jedis.sentinelGetMasterAddrByname(masterName);
        master = toHostAndPort(masterAddr);
    }
    for(String sentinel:sentinels){
        final hostAndPort hap = HostAndPort.parseString(sentinel);
        MasterListener masterListener = new MasterListener(masterName,hap.getHost(),hap.getPort());
        ...
    }


猜你喜欢

转载自blog.csdn.net/jcsyl_mshot/article/details/80321289
今日推荐