예제 #1
0
  @Before
  public void setUp() throws Exception {
    Jedis jedis = new Jedis(redis1.host, redis1.port);
    jedis.auth("foobared");
    jedis.flushAll();
    jedis.disconnect();
    jedis = new Jedis(redis2.host, redis2.port);
    jedis.auth("foobared");
    jedis.flushAll();
    jedis.disconnect();

    List<JedisShardInfo> shards = new ArrayList<JedisShardInfo>();
    JedisShardInfo si1 = new JedisShardInfo(redis1.host, redis1.port);
    si1.setPassword("foobared");
    shards.add(si1);
    JedisShardInfo si2 = new JedisShardInfo(redis2.host, redis2.port);
    si2.setPassword("foobared");
    shards.add(si2);
    this.jedis = new ShardedJedis(shards);
  }