redis 主从模式,sentinel 模式配置

编辑 sentinel.xml 和 redis.conf

redis.conf 中核心是配置

bash 复制代码
bind 192.168.64.144
daemonize yes
protected-mode no
dbfilename redis-6379.rdb #默认dump.rdb
replica-read-only yes # 自动2.6副本默认只读,也就是slave只有只读权限
replicationOf  myapplication  192.168.64.144 6379 2 #有些版本是slaveOf
appendonly yes #开启aof
appendfilename "appendonly-6379.aof"
appendfsync always  #数据同步时间
save 3600 1 #每1小时有1个key 改变
save 300 100 #每5分钟有 100个key改变
save 60 10000 # 每1分钟有10000个key改变
logfile "redis.log"
dir $REDIS_HOME/data

sentinel.conf 核心配置

bash 复制代码
port 26381
daemonize yes
sentinel monitor mymaster  192.168.64.144 6379 2
sentinel down-after-milliseconds mymaster 30000 #下线是30s
sentinel auth-pass mymaster 123456 #这个学习的时候完全没有必要配置
sentinel failover-timeout mymaster 30000

bin/redis-server config/redis.conf

bin/redis-sentinel config/sentinel.conf

配置完成后 bin/redis-cli -h 192.168.64.144 执行info 命令

相关推荐
陌上丨10 小时前
Redis的Key和Value的设计原则有哪些?
数据库·redis·缓存
曹牧10 小时前
Spring Boot:如何测试Java Controller中的POST请求?
java·开发语言
爬山算法11 小时前
Hibernate(90)如何在故障注入测试中使用Hibernate?
java·后端·hibernate
kfyty72511 小时前
集成 spring-ai 2.x 实践中遇到的一些问题及解决方案
java·人工智能·spring-ai
猫头虎11 小时前
如何排查并解决项目启动时报错Error encountered while processing: java.io.IOException: closed 的问题
java·开发语言·jvm·spring boot·python·开源·maven
李少兄11 小时前
在 IntelliJ IDEA 中修改 Git 远程仓库地址
java·git·intellij-idea
忆~遂愿11 小时前
ops-cv 算子库深度解析:面向视觉任务的硬件优化与数据布局(NCHW/NHWC)策略
java·大数据·linux·人工智能
小韩学长yyds11 小时前
Java序列化避坑指南:明确这4种场景,再也不盲目实现Serializable
java·序列化
仟濹11 小时前
【Java基础】多态 | 打卡day2
java·开发语言
Re.不晚11 小时前
JAVA进阶之路——无奖问答挑战2
java·开发语言