![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Redis
TentonStudy
这个作者很懒,什么都没留下…
展开
-
基于Redis的分布式锁Klock的使用
引入依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-klock-starter</artifactId> <version>1.4-release</version> </dependency> application.yml中配置 spring:原创 2021-08-10 17:12:03 · 1822 阅读 · 0 评论 -
com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class org.hib
今天用SpringDataJPA查询数据,往redis中存储时遇到这个问题, 在网页上一搜千篇一律的解决办法都是在实体类上面加上注解 @JsonIgnoreProperties(value = { "hibernateLazyInitializer", "handler" }) 尝试了一下,没能解决,最后发现不是加不加注解的原因,因为SpringDataJPA的getOne()方法查询出来的是一个动态代理对象, 而我需要的是一个实体对象,所有自己在dao层写了一个查询方法,查询出对应的学生实体信息: p原创 2021-02-04 19:32:20 · 156 阅读 · 0 评论 -
Redis连接工具类
public class RedisConnectionUtil { //阿里云公网地址或者本地端口地址 private static String HOST = "xx.xx.xx.xx"; //端口号 private static int PORT = 6379; //最大连接数 private static int MAX_ACTIVE = 1024; //最大空闲连接数 private static int MAX_IDLE = 200原创 2021-01-28 15:11:33 · 392 阅读 · 0 评论 -
redis集群
redis集群 1、一个机器上创建多台服务器 2、在配置文件目录下创建对应服务器的配置文件 cp redis.conf xxx.conf [root@iZ2zegfdgeiy8xeeu1icgeZ ~]# cd /usr/local/bin [root@iZ2zegfdgeiy8xeeu1icgeZ bin]# cd tconfig/ [root@iZ2zegfdgeiy8xeeu1icgeZ tconfig]# cp redis.conf redis79.conf [root@iZ2zegfdgeiy8原创 2020-10-25 16:14:15 · 73 阅读 · 0 评论 -
redis哨兵模式
redis哨兵模式 1、配置哨兵配置文件 在/usr/local/bin/tconfig配置目录下创建sentinel.conf # sentinel monitor 被监控的名称 host port 1 sentinel monitor myredis 127.0.0.1 6379 1 2、启动哨兵 [root@iZ2zegfdgeiy8xeeu1icgeZ bin]# redis-sentinel tconfig/sentinel.conf 如果Master 节点断开了,这个时候就会从从机中随机原创 2020-10-25 20:02:02 · 116 阅读 · 0 评论