配置jedis集群,代码如下:
def getJedisCluster(): JedisCluster = { val nodes = new util.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)) nodes.add(new HostAndPort("127.0.0.1", 7006)) new JedisCluster(nodes) }