1、主节点master的配置文件redis_master_6301.config:
daemonize yes
pidfile ./run/redis_slaver1_6315.pid
port 6301
tcp-backlog 511
timeout 0
tcp-keepalive 0
loglevel notice
logfile "./run/logs/log_master_6301.log"
databases 16
save ""
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum no
dbfilename dump_6301.rdb
dir ./run/data
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
appendonly no
appendfilename "appendonly_6301.aof"
appendfsync no
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 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
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
2、从节点slave1的配置文件redis_slave_6315.config:
daemonize yes
pidfile ./run/redis_slaver1_6315.pid
port 6315
tcp-backlog 511
timeout 0
tcp-keepalive 0
loglevel notice
logfile "./run/logs/log_slaver1_6315.log"
databases 16
save ""
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum no
dbfilename dump_6315.rdb
dir ./run/data
slaveof 192.168.0.12 6301
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 80
appendonly no
appendfilename "appendonly_6315.aof"
appendfsync no
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 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
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
3、从节点slave2的配置文件redis_slave_6316.config:
与上面slave1配置文件需要修改的地方
pidfile ./run/redis_slaver1_6316.pid
port 6316
logfile "./run/logs/log_slaver1_6316.log"
dbfilename dump_6316.rdb
appendfilename "appendonly_6316.aof"
4、从节点slave3的配置文件redis_slave_6317.config:
与上面slave1配置文件需要修改的地方
pidfile ./run/redis_slaver1_6317.pid
port 6317
logfile "./run/logs/log_slaver1_6317.log"
dbfilename dump_6317.rdb
appendfilename "appendonly_6317.aof"
5、哨兵sentinel1的配置文件sentinel_26301.config:
port 26301
dir ./run/tmp
sentinel monitor master1 192.168.0.12 6301 2
sentinel down-after-milliseconds master1 30000
sentinel parallel-syncs master1 1
sentinel failover-timeout master1 180000
logfile "/redis-3.0.0/run/logs/sentinellog_m1_26301.log"
6、哨兵sentinel2的配置文件sentinel_26302.config:
port 26302
dir ./run/tmp
sentinel monitor master1 192.168.0.12 6301 2
sentinel down-after-milliseconds master1 30000
sentinel parallel-syncs master1 1
sentinel failover-timeout master1 180000
logfile "/redis-3.0.0/run/logs/sentinellog_m1_26302.log"
7、哨兵sentinel3的配置文件sentinel_26303.config:
port 26303
dir ./run/tmp
sentinel monitor master1 192.168.0.12 6301 2
sentinel down-after-milliseconds master1 30000
sentinel parallel-syncs master1 1
sentinel failover-timeout master1 180000
logfile "/redis-3.0.0/run/logs/sentinellog_m1_26303.log"
````
```yaml
注意:第一次要先启动redis主服务、从服务,然后才能启动哨兵服务
1、进入redis安装目录的根目录
2、启动redis主节点
[root@localhost redis-3.0.0]
3、启动redis从节点
[root@localhost redis-3.0.0]
[root@localhost redis-3.0.0]
[root@localhost redis-3.0.0]
4、启动哨兵
[root@localhost redis-3.0.0]
[root@localhost redis-3.0.0]
[root@localhost redis-3.0.0]
到目前为止整个redis+sentinel的安装搭建环境就算完成
`