写点什么

Redis 哨兵配置安装

作者:CAFEBABE
  • 2022-12-05
    河南
  • 本文字数:1052 字

    阅读完需:约 3 分钟

解压安装包

tar -zxvf /opt/redis-5.0.7.tar.gzmv /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.0daemonize yespidfile "/usr/local/redis/redis-server.pid"port 6379tcp-backlog 128timeout 0tcp-keepalive 0loglevel noticelogfile "/usr/local/redis/redis-server.log"databases 16save 900 1save 300 10save 60 10000stop-writes-on-bgsave-error yesrdbcompression yesrdbchecksum yesdbfilename "dump.rdb"dir "/data/redis"masterauth "b5z7ojGWc4"requirepass "b5z7ojGWc4"        #replicaof 166.176.102.171 6379 哨兵模式下开启此参数,ip根据实际情况修改replica-serve-stale-data yesreplica-read-only yesrepl-diskless-sync norepl-diskless-sync-delay 5repl-disable-tcp-nodelay noreplica-priority 100appendonly yesappendfilename "appendonly.aof"appendfsync everysecno-appendfsync-on-rewrite noauto-aof-rewrite-percentage 100auto-aof-rewrite-min-size 64mbaof-load-truncated yeslua-time-limit 5000slowlog-log-slower-than 10000slowlog-max-len 128latency-monitor-threshold 0notify-keyspace-events ""hash-max-ziplist-entries 512hash-max-ziplist-value 64list-max-ziplist-entries 512list-max-ziplist-value 64set-max-intset-entries 512zset-max-ziplist-entries 128zset-max-ziplist-value 64hll-sparse-max-bytes 3000activerehashing yesclient-output-buffer-limit normal 0 0 0client-output-buffer-limit replica 256mb 64mb 60client-output-buffer-limit pubsub 32mb 8mb 60hz 10aof-rewrite-incremental-fsync yesprotected-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 26379pidfile "/usr/local/redis/redis-sentinel.pid"dir "/data/sentinel"daemonize yesprotected-mode nologfile "/usr/local/redis/redis-sentinel.log"
复制代码

启动哨兵

cd /usr/local/redis./bin/redis-sentinel sentinel.conf
复制代码

检查哨兵状态

ps -ef|grep sentinelroot       9734      1  0 Jun29 ?        00:00:43 ./bin/redis-sentinel *:26379 [sentinel]
复制代码


发布于: 刚刚阅读数: 3
用户头像

CAFEBABE

关注

还未添加个人签名 2017-10-18 加入

还未添加个人简介

评论

发布
暂无评论
Redis哨兵配置安装_CAFEBABE_InfoQ写作社区