1212import redis .clients .jedis .JedisPoolConfig ;
1313import redis .clients .jedis .JedisSentinelPool ;
1414
15- /***
16- * cluster模式 https://cloud.tencent.com/developer/article/1985822
17- */
1815@ Data
1916@ Slf4j
2017public class RedisDataSource {
@@ -45,7 +42,7 @@ public class RedisDataSource {
4542 public void createSingle () {
4643 // 创建Jedis配置对象
4744 String host = "127.0.0.1" ;
48- String password = "root " ;
45+ String password = "" ;
4946 Integer port = 6379 ;
5047 JedisPoolConfig config = new JedisPoolConfig ();
5148 config .setMaxTotal (MAX_TOTAL );
@@ -62,9 +59,9 @@ public void createSingle() {
6259 }
6360
6461 public void createSentinel () {
65- Set <String > sentinels = new HashSet <String >(Arrays .asList ("47.108.49.213 :26379" , "47.108.49.213 :26380" , "47.108.49.213 :26381" ));
62+ Set <String > sentinels = new HashSet <String >(Arrays .asList ("xxx :26379" , "xxx :26380" , "xxx :26381" ));
6663 // 创建Jedis配置对象
67- String password = "redis_pwd " ;
64+ String password = "" ;
6865 Integer port = 6379 ;
6966 JedisPoolConfig poolConfig = new JedisPoolConfig ();
7067 poolConfig .setMaxTotal (MAX_TOTAL );
@@ -84,12 +81,12 @@ public void createSentinel() {
8481 public void createCluster () {
8582 Set <HostAndPort > jedisClusterNode = new HashSet <HostAndPort >();
8683 String password = "ztzh@smart666" ;
87- jedisClusterNode .add (new HostAndPort ("47.108.49.213 " , 6371 ));
88- jedisClusterNode .add (new HostAndPort ("47.108.49.213 " , 6372 ));
89- jedisClusterNode .add (new HostAndPort ("47.108.49.213 " , 6373 ));
90- jedisClusterNode .add (new HostAndPort ("47.108.49.213 " , 6374 ));
91- jedisClusterNode .add (new HostAndPort ("47.108.49.213 " , 6375 ));
92- jedisClusterNode .add (new HostAndPort ("47.108.49.213 " , 6376 ));
84+ jedisClusterNode .add (new HostAndPort ("xxx " , 6371 ));
85+ jedisClusterNode .add (new HostAndPort ("xxx " , 6372 ));
86+ jedisClusterNode .add (new HostAndPort ("xxx " , 6373 ));
87+ jedisClusterNode .add (new HostAndPort ("xxx " , 6374 ));
88+ jedisClusterNode .add (new HostAndPort ("xxx " , 6375 ));
89+ jedisClusterNode .add (new HostAndPort ("xxx " , 6376 ));
9390 JedisPoolConfig poolConfig = new JedisPoolConfig ();
9491 /*
9592 * 注意: 在高版本的jedis jar包,比如本版本2.9.0,JedisPoolConfig没有setMaxActive和setMaxWait属性了
0 commit comments