- redis安装那么简单的就不记录了 随便百度就ok
redis master 的配置
master redis.conf
port 6379
tcp-backlog 100
timeout 0
tcp-keepalive 0
daemonize yes
supervised no
pidfile "/var/run/redis.pid"
loglevel notice
logfile "/tty/dev/data/log/redis/redis01.log"
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename "dump.rdb"
dir "/tty/dev/data/redis"
masterauth "how123"
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
slave-priority 100
requirepass "how123"
rename-command FLUSHALL ""
rename-command FLUSHDB ""
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
lua-time-limit 5000
slowlog-log-slower-than 10
slowlog-max-len 128
latency-monitor-threshold 1
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes
slave redis.conf
port 6378
tcp-backlog 100
timeout 0
tcp-keepalive 0
daemonize yes
supervised no
pidfile "/var/run/redis.pid"
loglevel notice
logfile "/tty/dev/data/log/redis/redis01.log"
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename "dump.rdb"
dir "/tty/dev/data/redis"
masterauth "how123"
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
slave-priority 100
requirepass "how123"
rename-command FLUSHALL ""
rename-command FLUSHDB ""
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
lua-time-limit 5000
slowlog-log-slower-than 10
slowlog-max-len 128
latency-monitor-threshold 1
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes
slaveof 139.105.140.119 6379
master sentinel.conf
port 26379
sentinel myid 10ea243b09fa79b3ab66b1823c3bb6a65e6db64d #当前sentinel地址
dir "/tmp"
sentinel monitor redis_master 139.105.140.119 6379 2 #redis master的地址
sentinel down-after-milliseconds redis_master 10000
sentinel auth-pass redis_master redispassword
sentinel config-epoch redis_master 91
sentinel leader-epoch redis_master 91
bind 0.0.0.0
sentinel known-slave redis_master 139.105.140.119 6378 #redis slave地址
#sentinel known-sentinel redis_master 139.105.140.119 26378 a0123093ee65a6648c246a3e9b8e52011ef66f32 #另一台sentinel的地址+端口
sentinel current-epoch 91
slave sentinel.conf
port 26378
sentinel myid a0123093ee65a6648c246a3e9b8e52011ef66f32 #当前sentinel地址
dir "/tmp"
sentinel monitor redis_master 139.105.140.119 6378 2 #redis slave地址
sentinel down-after-milliseconds redis_master 10000
sentinel auth-pass redis_master redispassword
sentinel config-epoch redis_master 91
sentinel leader-epoch redis_master 91
bind 0.0.0.0
sentinel known-slave redis_master 139.105.140.119 6379 #redis master的地址+端口
sentinel known-sentinel redis_master 139.105.140.119 26379 10ea243b09fa79b3ab66b1823c3bb6a65e6db64d #另一台sentinel的地址+端口
sentinel current-epoch 91
装好后测试:
redis-cli -h 139.105.140.119 -p 26379 -a redispassword