springboot集成redis集群(带密码并序列化)

pom配置

常用的springboot配置就不贴了,下面只贴redis有关的

<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>

application.properties配置

spring.redis.database=0
spring.redis.cluster.nodes=192.168.248.146:7001,192.168.248.146:7002,192.168.248.146:7003,192.168.248.146:7004,192.168.248.146:7005,192.168.248.146:7006
spring.redis.password=11111
spring.redis.pool.max-active=8  
spring.redis.pool.max-wait=-1  
spring.redis.pool.max-idle=8  
spring.redis.pool.min-idle=0  
spring.redis.timeout=0 

序列化

为什么要序列化?贴个图大家就懂了。这是楼主没有序列化的时候,插入q和t12个key的情况
这里写图片描述
在客户端里面,用命令 get q 或者 get t1 确实可以取出来,但是用代码获取一直为null
当序列化后,插入sjz的情况
这里写图片描述
用代码就可以取出来了哦

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值