python与java中使用redis集群

1.python使用

from rediscluster import StrictRedisCluster

redis_nodes = [{'host':'192.168.78.62','port':"6380"},{'host':'192.168.78.62','port':"6381" }]
redis_passwd = "xxxxx"

Redis_Client = StrictRedisCluster(startup_nodes=redis_nodes,password=redis_passwd)

2.java使用

private static JedisCluster jedisPoolDB = null;

Set<HostAndPort> nodes = new LinkedHashSet<HostAndPort>();

nodes.add(new HostAndPort(Config.REDIS_IP, Config.REDIS_PORT));

jedisPoolDB = new JedisCluster(nodes, 10 * 1000, 10 * 1000, 3, Config.REDIS_PASSWORD, config);

原文地址:https://www.cnblogs.com/lingwang3/p/10229267.html