package edu.ustc.mix.persistence.redis;

import java.util.HashSet;
import java.util.Set;

import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.JedisCluster;

public class RedisClusterClient {
	
	@SuppressWarnings("resource")
	public static void main(String[] args) {
		
		Set<HostAndPort> nodes = new HashSet<HostAndPort>();
		nodes.add(new HostAndPort("127.0.0.1", 7000));
		nodes.add(new HostAndPort("127.0.0.1", 7001));
		nodes.add(new HostAndPort("127.0.0.1", 7002));
		nodes.add(new HostAndPort("127.0.0.1", 7003));
		nodes.add(new HostAndPort("127.0.0.1", 7004));
		nodes.add(new HostAndPort("127.0.0.1", 7005));
		
		JedisCluster cluster = new JedisCluster(nodes, 5000);
		
		System.out.println(cluster.get("foo"));
		
		cluster.set("test", "6379");
		System.out.println(cluster.get("test"));
	}
}

@@ -55,19 +55,67 @@
 til.Hash
-Set
+Map;%0Aimport java.util.HashSet;%0Aimport java.util.Map
 ;%0Aimport
@@ -855,13 +855,337 @@
 est%22));%0A
+%09%09%0A%09%09Map%3CString, String%3E inviteePhone = new HashMap%3CString, String%3E();%0A%09%09inviteePhone.put(%22inviterID%22, %221001%22);%0A%09%09inviteePhone.put(%22status%22, %220%22);%0A%09%09cluster.hmset(%22inviteePhone%22, inviteePhone);%0A%09%09%0A%09%09System.out.println(cluster.hget(%22inviteePhone%22, %22inviterID%22));%0A%09%09System.out.println(cluster.hget(%22inviteePhone%22, %22status%22));%0A
 %09%7D%0A%7D%0A

test redis hash structure