redis6.0 哨兵模式安装

一、安装环境

#!/bin/bash
#在centos7 安装reis6.0.8

#升级依赖包包
yum -y install centos-release-scl || exit 2
yum -y install wget devtoolset-9-gcc gcc tcl devtoolset-9-gcc-c++ devtoolset-9-binutils || exit 2
scl enable devtoolset-9 bash
echo "scl enable devtoolset-9 bash" >/etc/rc.local
wget   -q -O  /usr/local/src/redis-6.0.8.tar.gz  http://download.redis.io/releases/redis-6.0.8.tar.gz
tar -zxvf  /usr/local/src/redis-6.0.8.tar.gz -C /usr/local/
cd /usr/local/redis-6.0.8 || exit 3
make
make PREFIX=/usr/local/redis1 install 
make PREFIX=/usr/local/redis2 install 
make PREFIX=/usr/local/redis3 install 

二、添加配置文件

 bind 127.0.0.1
protected-mode no
port 6380
tcp-backlog 511
timeout 0
tcp-keepalive 300
daemonize yes
supervised upstart
pidfile "/var/run/redis_6380.pid"
loglevel notice
logfile "/var/log/redis6380.log"
databases 16
always-show-logo yes
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
requirepass 123456
rdbchecksum yes
dbfilename "dump_6380.rdb"
rdb-del-sync-files no
dir "/usr/local/redis6380/bin"
replica-serve-stale-data yes
replica-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-diskless-load disabled
repl-disable-tcp-nodelay no
replica-priority 100
acllog-max-len 128
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
replica-lazy-flush no
lazyfree-lazy-user-del no
oom-score-adj no
oom-score-adj-values 0 200 800
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
aof-use-rdb-preamble 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
stream-node-max-bytes 4kb
stream-node-max-entries 100
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
dynamic-hz yes
aof-rewrite-incremental-fsync yes
rdb-save-incremental-fsync yes
jemalloc-bg-thread yes

三 、在从机添加

replicaof masterip masterport
masterauth "123456"

四、启动redis服务

./redis-server redis.conf

五、配置哨兵三个都一样

port 26380
daemonize yes
pidfile "/var/run/redis6380-sentinel.pid"
logfile "/var/log/sentinet6380.log"
dir "/tmp/redis6380"
sentinel myid f6894dbb2290d2686497f5a4cbab53db6ad7fa6f
sentinel deny-scripts-reconfig yes
requirepass 123456
sentinel monitor redismaster 127.0.0.1 6380 1
sentinel auth-pass redismaster 123456
sentinel config-epoch redismaster 1
# Generated by CONFIG REWRITE
protected-mode no
sentinel leader-epoch redismaster 1

六 、启动哨兵

./redis-sentinel sentinel.conf

七、查看信息

./redis-cli -h 127.0.0.1 -p 6380 -a passwd -c info replication

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值