1、安装redis 集群,1主1从 也可以是多主多从 redis 详细今后会在以后的文章中写出
配置redis-master 的配置文件 redis.conf
port 6379
daemonize yes
#protected-mode no
dbfilename "1.db"
bind 0.0.0.0
配置 redis-slave 的配置文件 redis.conf
port 6380
daemonize yes
dbfilename "2.db"
bind 0.0.0.0
#这里的IP必需通过程序可以访问到的IP地址
slaveof 10.0.0.12 6379
配置哨兵配置文件
port 6388
#protected-mode no
bind 0.0.0.0
daemonize yes
logfile "/var/log/sentinel_6388.log"
sentinel myid 818ae715a423ace06ab54a81bb4dac66de338377
# 这里的IP,必需是通过程序可以访问的IP
sentinel monitor master 10.0.0.12 6379 1
sentinel down-after-milliseconds master 5000
sentinel failover-timeout master 18000
#如果有密码,这里就需要密码
#sentinel auth-pass master 123456
启动redis
bin/redis-server