Redis 哨兵配置安装
作者:CAFEBABE
- 2022-12-05 河南
本文字数:1052 字
阅读完需:约 3 分钟
解压安装包
tar -zxvf /opt/redis-5.0.7.tar.gz
mv /opt/redis-5.0.7 /usr/local/redis
复制代码
安装 gcc
yum -y install gcc
复制代码
编译安装
make MALLOC=libc && make PREFIX=/usr/local/redis install
复制代码
编辑参数文件
bind 0.0.0.0
daemonize yes
pidfile "/usr/local/redis/redis-server.pid"
port 6379
tcp-backlog 128
timeout 0
tcp-keepalive 0
loglevel notice
logfile "/usr/local/redis/redis-server.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"
dir "/data/redis"
masterauth "b5z7ojGWc4"
requirepass "b5z7ojGWc4"
#replicaof 166.176.102.171 6379 哨兵模式下开启此参数,ip根据实际情况修改
replica-serve-stale-data yes
replica-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
replica-priority 100
appendonly yes
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-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 replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes
protected-mode no
复制代码
创建目录
mkdir -p /data/{redis,sentinel}
复制代码
启动 redis
cd /usr/local/redis
./bin/redis-server redis.conf
复制代码
检测 redis 进程
ps -ef|grep redis
root 9900 1 0 Jun29 ? 00:00:38 ./bin/redis-server 0.0.0.0:6379
复制代码
配置哨兵参数文件
port 26379
pidfile "/usr/local/redis/redis-sentinel.pid"
dir "/data/sentinel"
daemonize yes
protected-mode no
logfile "/usr/local/redis/redis-sentinel.log"
复制代码
启动哨兵
cd /usr/local/redis
./bin/redis-sentinel sentinel.conf
复制代码
检查哨兵状态
ps -ef|grep sentinel
root 9734 1 0 Jun29 ? 00:00:43 ./bin/redis-sentinel *:26379 [sentinel]
复制代码
划线
评论
复制
发布于: 刚刚阅读数: 3
版权声明: 本文为 InfoQ 作者【CAFEBABE】的原创文章。
原文链接:【http://xie.infoq.cn/article/d7477e2cc6f1e278794ead9a3】。
本文遵守【CC BY-NC】协议,转载请保留原文出处及本版权声明。
CAFEBABE
关注
还未添加个人签名 2017-10-18 加入
还未添加个人简介
评论