标签: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
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
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
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_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
标签:hold app eve 集群部署 logfile 认证 truncate cat 进程
原文地址:http://blog.51cto.com/zjunzz/2298944