我尝试使用Spring Session和Redis Cluster,但得到的错误就像 引起:redis.clients.jedis.exceptions.JedisConnectionException:无法从池中获取资源。
但是,如果我只使用Jedis Client,它会成功连接。同时,哨兵联系也有效。
我的application.yml看起来像:
spring.redis.cluster: --Can not connect
nodes: 10.161.34.185:5000,10.161.34.186:5001,10.161.34.187:5002
#spring.redis.sentinel: --Can connect
# master: master01
# nodes: 10.162.14.121:5000,10.162.14.122:5000
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.3.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>1.3.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>1.7.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session</artifactId>
<version>1.2.0.RC2</version>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.8.1</version>
</dependency>
</dependencies>
Redis Clustser信息:
redis_version:3.0.7
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:270ecdbb5d94abe
redis_mode:cluster
os:Linux 2.6.32-573.7.1.el6.x86_64 x86_64
arch_bits:64
multiplexing_api:epoll
gcc_version:4.4.7
tcp_port:5000
hz:10
lru_clock:2032968
config_file:/apps/redis-essentials/redis-3.0.7/redis-master-01.conf