redis叢集部署

來源:互聯網
上載者:User

標籤:hold   app   eve   叢集部署   logfile   認證   truncate   cat   進程   

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配置
#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配置
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#哨兵監聽認證密碼

172.18.146.182 redis.conf配置
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配置
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配置
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配置
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

伺服器配置
echo 1024 > /proc/sys/net/core/somaxconn
啟動redis叢集
bin/redis-server conf/redis.conf
啟動哨兵叢集
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叢集主從資訊

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叢集部署

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.