Redis 高频面试题及答案
目录
1.redis 是什么? ...................................................................................................................................................1
2.redis 怎么使用? ..............................................................................................................................................2
3.应用场景: ............................................................................................................................................................2
String : ............................................................................................................................................................2
list(双向链表) ...............................................................................................................................................2
hash(hashmap) ............................................................................................................................................3
4.为什么 redis 是单线程的都那么快? ........................................................................................................3
5.redis 也可以进行发布订阅消息吗? .........................................................................................................3
6.redis 能否将数据持久化,如何实现?.....................................................................................................4
RDB 持久化原理: .....................................................................................................................................4
AOF 持久化原理: ....................................................................................................................................4
7.主从复制模式下,主挂了怎么办?...........................................................................................................4
8.哨兵模式实现原理?(2.8 版本或更高才有) ......................................................................................5
1.三个定时监控任务: .............................................................................................................................5
2.主客观下线: ...........................................................................................................................................5
3.选举出某一哨兵节点作为领导者 ......................................................................................................5
4.故障转移 ....................................................................................................................................................5
9.redis 集群(采用虚拟槽方式,高可用)原理(和哨兵模式原理类似,3.0 版本或以上才有)?
...................................................................................................................................................................................6
10.缓存更新策略(即如何让缓存和 mysql 保持一致性)? ...............................................................6
10.1 key 过期清除(超时剔除)策略 .................................................................................................6
10.2 Redis 的内存淘汰策略 ....................................................................................................................7
11.缓存粒度控制? ................................................................................................................................
.............8
12.如何防止缓存穿透? ....................................................................................................................................8
13.无底洞优化? ..................................................................................................................................................9
14.雪崩优化 ...........................................................................................................................................................9
15.热点 key 优化 ..................................................................................................................................................9
1.redis 是什么?
redis 是 nosql(也是个巨大的 map) 单线程,但是可处理 1 秒 10w 的并发(数
据都在内存中)
使用 java 对 redis 进行操作类似 jdbc 接口标准对 mysql,有各类实现他的实现
更多JAVA视频资料:https://pan.baidu.com/s/1brJVbjPK4kacncAsQtgrmA
提取码:1234