Redis Cluster deployment

Source: Internet
Author: User
Tags failover redis cluster

host 角色 port

172.18.146.183 Master redis:6379;sentinel:26379
172.18.146.182 slave01 redis:6379;sentinel:26379
172.18.146.187 SLAVE02 redis:6379;sentinel:26379

172.18.146.183 redis.conf Configuration
#bind 127.0.0.1
Bind 127.0.0.1 172.18.146.183
Protected-mode Yes
Port 6379
#tcp-backlog 511
Tcp-backlog 1024
Timeout 0
Tcp-keepalive 300
#daemonize No
Daemonize Yes #以后台进程模式运行
Supervised no
Pidfile "/var/run/redis_6379.pid"
LogLevel Notice
LogFile "/workspace/log/redis/redis.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
Dbfilename "Dump_6379.rdb"
Masterauth "wanbit.2013"
#dir./
Dir "/workspace/data/redis"
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 "wanbit.2013"
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 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-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

Generated by CONFIG REWRITE

Slaveof 172.18.146.187 6379

172.18.146.183 sentinel.conf Configuration
Daemonize Yes
Port 26379
Protected-mode No
LogFile "/workspace/log/redis/sentinel.log"
Dir "/workspace/data/redis/sentinel"

Sentinel Monitor Master 172.18.146.187 6379 2
Sentinel Down-after-milliseconds Master 5000
Sentinel Failover-timeout Master 9000
Sentinel Parallel-syncs Master 2
Sentinel Auth-pass Master wanbit.2013# Sentinel monitor authentication password

172.18.146.182 redis.conf Configuration
Bind 127.0.0.1 172.18.146.182
Protected-mode Yes
Port 6379
Tcp-backlog 1024
Timeout 0
Tcp-keepalive 300
Daemonize Yes
Supervised no
Pidfile "/var/run/redis_6379.pid"
LogLevel Notice
LogFile "/workspace/log/redis/redis.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
Dbfilename "Dump_6379.rdb"
Masterauth "wanbit.2013"
#dir./
Dir "/workspace/data/redis"
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 90
Requirepass "wanbit.2013"
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 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-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 172.18.146.187 6379

172.18.146.182 sentinel.conf Configuration
Daemonize Yes
Port 26379
Protected-mode No
LogFile "/workspace/log/redis/sentinel.log"
Dir "/workspace/data/redis/sentinel"
Sentinel myID E402d8e08dcbb0ca18f25ca4ace131d395199afe
Sentinel Monitor Master 172.18.146.187 6379 2
Sentinel Down-after-milliseconds Master 5000
Sentinel Failover-timeout Master 9000
Sentinel Auth-pass Master wanbit.2013
Sentinel Config-epoch Master 17

Generated by CONFIG REWRITE

Sentinel Leader-epoch Master 17
Sentinel Known-slave Master 172.18.146.182 6379
Sentinel Known-slave Master 172.18.146.183 6379
Sentinel Known-sentinel Master 172.18.146.183 26379 67826b1ea35fd0d94cc5d5ad581d5f143f9b42d1
Sentinel Known-sentinel Master 172.18.146.187 26379 a6f40883cc94a90aa81bfbcebfb57422ada6cd6c
Sentinel Current-epoch 17

172.18.146.187 redis.conf Configuration
Bind 127.0.0.1 172.18.146.187
Protected-mode Yes
Port 6379
Tcp-backlog 1024
Timeout 0
Tcp-keepalive 300
#daemonize No
Daemonize Yes
Supervised no
Pidfile "/var/run/redis_6379.pid"
LogLevel Notice
LogFile "/workspace/log/redis/redis.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
Dbfilename "Dump_6379.rdb"
Masterauth "wanbit.2013"
#dir./
Dir "/workspace/data/redis"
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 90
Requirepass "wanbit.2013"
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 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-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

172.18.146.187 sentinel.conf Configuration
Daemonize Yes
Port 26379
Protected-mode No
LogFile "/workspace/log/redis/sentinel.log"
Dir "/workspace/data/redis/sentinel"
Sentinel myID a6f40883cc94a90aa81bfbcebfb57422ada6cd6c
Sentinel Monitor Master 172.18.146.187 6379 2
Sentinel Down-after-milliseconds Master 5000
Sentinel Failover-timeout Master 9000
Sentinel Auth-pass Master wanbit.2013
Sentinel Config-epoch Master 17

Generated by CONFIG REWRITE

Sentinel Leader-epoch Master 17
Sentinel Known-slave Master 172.18.146.182 6379
Sentinel Known-slave Master 172.18.146.183 6379
Sentinel Known-sentinel Master 172.18.146.183 26379 67826b1ea35fd0d94cc5d5ad581d5f143f9b42d1
Sentinel Known-sentinel Master 172.18.146.182 26379 E402d8e08dcbb0ca18f25ca4ace131d395199afe
Sentinel Current-epoch 17

Server Configuration
echo 1024x768 >/proc/sys/net/core/somaxconn
Starting a Redis cluster
Bin/redis-server conf/redis.conf
Launch Sentinel Cluster
Bin/redis-sentinel conf/sentinel.conf
#查看redis信息
Bin/redis-cli-p 6379-h 127.0.0.1-a wanbit.2013 Info
#关闭redis数据库
Bin/redis-cli-p 6379-h 127.0.0.1-a wanbit.2013 shutdown
#查看sentinel哨兵集群信息
Bin/redis-cli-p 26379-h 127.0.0.1-a wanbit.2013 Info
Redis Cluster Master-slave information

Sentinel

Sentinel_masters:1
sentinel_tilt:0
sentinel_running_scripts:0
sentinel_scripts_queue_length:0
sentinel_simulate_failure_flags:0
Master0:name=master,status=ok,address=172.18.146.187:6379,slaves=2,sentinels=3

Redis Cluster deployment

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.