/** * Creates {@link JedisSentinelPool}. * * @return * @since 1.4 */ protected Pool<Jedis> createRedisSentinelPool() { Set<String> hostAndPorts = redisServers .stream() .map(redisNode -> new HostAndPort(redisNode.host, redisNode.port).toString()) .collect(Collectors.toSet()); return new JedisSentinelPool(sentinelMaster, hostAndPorts, poolConfig, getShardInfo().getSoTimeout(), getShardInfo().getPassword()); }
final String master = env.getProperty("compensation.redis.master"); JedisSentinelPool pool = new JedisSentinelPool(master, hostAndPorts, config, password); jedisClient = new JedisClientSentinel(pool);
sentinelPool = new JedisSentinelPool(masterName, sentinelSet, poolConfig, connectionTimeout, soTimeout, null, Protocol.DEFAULT_DATABASE); } else { sentinelPool = new JedisSentinelPool(masterName, sentinelSet, poolConfig, connectionTimeout, soTimeout, password, Protocol.DEFAULT_DATABASE);
final String master = env.getProperty("recover.redis.master"); JedisSentinelPool pool = new JedisSentinelPool(master, hostAndPorts, config, password); jedisClient = new JedisClientSentinel(pool);
final String master = env.getProperty("myth.redis.master"); JedisSentinelPool pool = new JedisSentinelPool(master, hostAndPorts, config, password); jedisClient = new JedisClientSentinel(pool);
@Inject public RedisSentinelJedisProvider(HostSupplier hostSupplier, DynomiteConfiguration configuration) { GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig(); poolConfig.setMinIdle(5); poolConfig.setMaxTotal(1000); logger.info("Starting conductor server using redis_sentinel and cluster " + configuration.getClusterName()); Set<String> sentinels = new HashSet<>(); for (Host host : hostSupplier.getHosts()) { sentinels.add(host.getHostName() + ":" + host.getPort()); } jedisPool = new JedisSentinelPool(configuration.getClusterName(), sentinels, poolConfig); }
jedisPool = new JedisSentinelPool(masterName, sentinelsSet, poolConfig, timeout, password, database, clientName);
new JedisSentinelPool(txRedisConfig.getMasterName(), hostAndPorts, config, txRedisConfig.getTimeOut(), txRedisConfig.getPassword()); jedisClient = new JedisClientSentinel(pool);
/** * Creates {@link JedisSentinelPool}. * * @param config the actual {@link RedisSentinelConfiguration}. Never {@literal null}. * @return the {@link Pool} to use. Never {@literal null}. * @since 1.4 */ protected Pool<Jedis> createRedisSentinelPool(RedisSentinelConfiguration config) { GenericObjectPoolConfig poolConfig = getPoolConfig() != null ? getPoolConfig() : new JedisPoolConfig(); return new JedisSentinelPool(config.getMaster().getName(), convertToJedisSentinelSet(config.getSentinels()), poolConfig, getConnectTimeout(), getReadTimeout(), getPassword(), getDatabase(), getClientName()); }
new JedisSentinelPool(hmilyRedisConfig.getMasterName(), hostAndPorts, config, hmilyRedisConfig.getTimeOut(), hmilyRedisConfig.getPassword()); jedisClient = new JedisClientSentinel(pool);
new JedisSentinelPool(mythRedisConfig.getMasterName(), hostAndPorts, config, mythRedisConfig.getTimeOut(), mythRedisConfig.getPassword()); jedisClient = new JedisClientSentinel(pool);
private void init() { synchronized (this) { if (jedisPool == null) { String[] sentinelHosts = host.split(",\\s*"); Set<String> sentinels = new HashSet<String>(); Collections.addAll(sentinels, sentinelHosts); jedisPool = new JedisSentinelPool(masterName, sentinels, getJedisPoolConfig(), timeout, soTimeout, password, database); } } }
private void init() { synchronized (this) { if (jedisPool == null) { String[] sentinelHosts = host.split(",\\s*"); Set<String> sentinels = new HashSet<String>(); Collections.addAll(sentinels, sentinelHosts); jedisPool = new JedisSentinelPool(masterName, sentinels, getJedisPoolConfig(), timeout, soTimeout, password, database); } } }
@Override public void connect() throws IOException { if(isSentinel) { sentinel = new JedisSentinelPool(masterName, new HashSet<>(Arrays.asList(host.split(",")))); }else { redis = new Jedis(host, port); } }
@Override public RedisExecutor newExecutor() throws RuntimeException { Set<String> sentinels = new HashSet<>(); for (RedisHostDescriptor host : hosts) { sentinels.add(host.name + ":" + host.port); } GenericObjectPoolConfig cfg = new JedisPoolConfig(); Pool<Jedis> sentinel = new JedisSentinelPool(master, sentinels, cfg, timeout, password, database); RedisExecutor base = new RedisPoolExecutor(sentinel); return new RedisFailoverExecutor(failoverTimeout, base); }
public RedisClient(Set<String> masterSet, Set<String> sentinelSet, String pwd) { logger.info("masterSet:" + masterSet + ",sentinelSet:" + sentinelSet + ",pwd:" + pwd); for (String masterName : masterSet) { JedisSentinelPool jsPool = new JedisSentinelPool(masterName, sentinelSet, getConfig(), 2000, pwd); hash.add(masterName, jsPool); } }
public RedisPool build() { JedisSentinelPool pool = new JedisSentinelPool(master, sentinels, getPoolConfig(redisConnections), timeout, password, database); return new RedisPool(pool, null, host, port); } }
/** * 初始化链接池(Sentinel集群版本) */ @Override protected void initJedisPool() { Set<String> sets = new HashSet<>(); sets.addAll(redisConfig.getSentinel().hosts); this.jedisPool = new JedisSentinelPool(redisConfig.getSentinel().master, sets, jedisPoolConfig, redisConfig.getTimeout(), redisConfig.getPasswd()); logger.info("initJedisPool. {}", this.jedisPool); } }
private Pool<Jedis> createSentinelPool() { HashSet<String> hosts = new HashSet<>(); Collections2.addAll(hosts, Strings.split(sentinelHostAndPorts, ',')); return new JedisSentinelPool(sentinelMasterName, hosts, checkPoolConfig(), timeout, password, database); } }
/** * Creates {@link JedisSentinelPool}. * * @param config the actual {@link RedisSentinelConfiguration}. Never {@literal null}. * @return the {@link Pool} to use. Never {@literal null}. * @since 1.4 */ protected Pool<Jedis> createRedisSentinelPool(RedisSentinelConfiguration config) { GenericObjectPoolConfig poolConfig = getPoolConfig() != null ? getPoolConfig() : new JedisPoolConfig(); return new JedisSentinelPool(config.getMaster().getName(), convertToJedisSentinelSet(config.getSentinels()), poolConfig, getConnectTimeout(), getReadTimeout(), getPassword(), getDatabase(), getClientName()); }