首页 > 数据库 >redis-7.4.2哨兵随记

redis-7.4.2哨兵随记

时间:2025-01-10 17:12:34浏览次数:1  
标签:7.4 redis usr conf local ccdt 随记

###########################redis.conf 7.4.2 主从 ################################

http://download.redis.io/releases/redis-7.4.2.tar.gz
tar xf  redis-7.4.2.tar.gz

cd  redis-7.4.2

make

make install  PREFIX=/usr/local/ccdt/redis_7.4.2/redis36379
make install  PREFIX=/usr/local/ccdt/redis_7.4.2/redis36380
make install  PREFIX=/usr/local/ccdt/redis_7.4.2/redis36381

cp redis.conf /usr/local/ccdt/redis_7.4.2/redis36379/conf/
cp redis.conf /usr/local/ccdt/redis_7.4.2/redis36380/conf/
cp redis.conf /usr/local/ccdt/redis_7.4.2/redis36381/conf/

cp sentinel.conf /usr/local/ccdt/redis_7.4.2/redis36379/conf/
cp sentinel.conf /usr/local/ccdt/redis_7.4.2/redis36380/conf/
cp sentinel.conf /usr/local/ccdt/redis_7.4.2/redis36381/conf/

sed -i '88c bind 172.16.135.42' /usr/local/ccdt/redis_7.4.2/redis36379/conf/redis.conf
sed -i '88c bind 172.16.135.42' /usr/local/ccdt/redis_7.4.2/redis36380/conf/redis.conf
sed -i '88c bind 172.16.135.42' /usr/local/ccdt/redis_7.4.2/redis36381/conf/redis.conf

sed -i '139c  port 36379' /usr/local/ccdt/redis_7.4.2/redis36379/conf/redis.conf
sed -i '139c  port 36380' /usr/local/ccdt/redis_7.4.2/redis36380/conf/redis.conf
sed -i '139c  port 36381' /usr/local/ccdt/redis_7.4.2/redis36381/conf/redis.conf


sed -i '310c  daemonize yes' /usr/local/ccdt/redis_7.4.2/redis36379/conf/redis.conf
sed -i '310c  daemonize yes' /usr/local/ccdt/redis_7.4.2/redis36380/conf/redis.conf
sed -i '310c  daemonize yes' /usr/local/ccdt/redis_7.4.2/redis36381/conf/redis.conf


sed -i '356c  logfile "/usr/local/ccdt/redis_7.4.2/redis36379/logs/redis_36379.log"' /usr/local/ccdt/redis_7.4.2/redis36379/conf/redis.conf
sed -i '356c  logfile "/usr/local/ccdt/redis_7.4.2/redis36380/logs/redis_36380.log"' /usr/local/ccdt/redis_7.4.2/redis36380/conf/redis.conf
sed -i '356c  logfile "/usr/local/ccdt/redis_7.4.2/redis36381/logs/redis_36381.log"' /usr/local/ccdt/redis_7.4.2/redis36381/conf/redis.conf


sed -i '460c  stop-writes-on-bgsave-error no' /usr/local/ccdt/redis_7.4.2/redis36379/conf/redis.conf
sed -i '460c  stop-writes-on-bgsave-error no' /usr/local/ccdt/redis_7.4.2/redis36380/conf/redis.conf
sed -i '460c  stop-writes-on-bgsave-error no' /usr/local/ccdt/redis_7.4.2/redis36381/conf/redis.conf



sed -i '516c  dir /usr/local/ccdt/redis_7.4.2/redis36379/data' /usr/local/ccdt/redis_7.4.2/redis36379/conf/redis.conf
sed -i '516c  dir /usr/local/ccdt/redis_7.4.2/redis36380/data' /usr/local/ccdt/redis_7.4.2/redis36380/conf/redis.conf
sed -i '516c  dir /usr/local/ccdt/redis_7.4.2/redis36381/data' /usr/local/ccdt/redis_7.4.2/redis36381/conf/redis.conf


sed -i '1050a  requirepass 4NTJgYwzISCkwxHk' /usr/local/ccdt/redis_7.4.2/redis36379/conf/redis.conf
sed -i '1050a  requirepass 4NTJgYwzISCkwxHk' /usr/local/ccdt/redis_7.4.2/redis36380/conf/redis.conf
sed -i '1050a  requirepass 4NTJgYwzISCkwxHk' /usr/local/ccdt/redis_7.4.2/redis36381/conf/redis.conf



sed -i '539c  replicaof 172.16.135.42 36379' /usr/local/ccdt/redis_7.4.2/redis36380/conf/redis.conf
sed -i '539c  replicaof 172.16.135.42 36379' /usr/local/ccdt/redis_7.4.2/redis36381/conf/redis.conf

sed -i '546c  masterauth 4NTJgYwzISCkwxHk' /usr/local/ccdt/redis_7.4.2/redis36380/conf/redis.conf
sed -i '546c  masterauth 4NTJgYwzISCkwxHk' /usr/local/ccdt/redis_7.4.2/redis36381/conf/redis.conf


sed -i '1399c  appendonly no' /usr/local/ccdt/redis_7.4.2/redis36379/conf/redis.conf
sed -i '1399c  appendonly no' /usr/local/ccdt/redis_7.4.2/redis36380/conf/redis.conf
sed -i '1399c  appendonly no' /usr/local/ccdt/redis_7.4.2/redis36381/conf/redis.conf



mkdir -p /usr/local/ccdt/redis_7.4.2/redis36379/{conf,bin,data,logs,sentinel}
mkdir -p /usr/local/ccdt/redis_7.4.2/redis36380/{conf,bin,data,logs,sentinel}
mkdir -p /usr/local/ccdt/redis_7.4.2/redis36381/{conf,bin,data,logs,sentinel}


####################sentinel.conf配置######################




vim   port xxx    26379 26380  26381


sed -i '2c  bind 172.16.135.42' /usr/local/ccdt/redis_7.4.2/redis36379/conf/sentinel.conf
sed -i '2c  bind 172.16.135.42' /usr/local/ccdt/redis_7.4.2/redis36380/conf/sentinel.conf
sed -i '2c  bind 172.16.135.42' /usr/local/ccdt/redis_7.4.2/redis36381/conf/sentinel.conf

sed -i '6c  protected-mode yes' /usr/local/ccdt/redis_7.4.2/redis36379/conf/sentinel.conf
sed -i '6c  protected-mode yes' /usr/local/ccdt/redis_7.4.2/redis36380/conf/sentinel.conf
sed -i '6c  protected-mode yes' /usr/local/ccdt/redis_7.4.2/redis36381/conf/sentinel.conf

sed -i '15c  daemonize yes' /usr/local/ccdt/redis_7.4.2/redis36379/conf/sentinel.conf
sed -i '15c  daemonize yes' /usr/local/ccdt/redis_7.4.2/redis36380/conf/sentinel.conf
sed -i '15c  daemonize yes' /usr/local/ccdt/redis_7.4.2/redis36381/conf/sentinel.conf


sed -i '34c  logfile "/usr/local/ccdt/redis_7.4.2/redis36379/sentinel/sentinel_26379.log"' /usr/local/ccdt/redis_7.4.2/redis36379/conf/sentinel.conf
sed -i '34c  logfile "/usr/local/ccdt/redis_7.4.2/redis36380/sentinel/sentinel_26380.log"' /usr/local/ccdt/redis_7.4.2/redis36380/conf/sentinel.conf
sed -i '34c  logfile "/usr/local/ccdt/redis_7.4.2/redis36381/sentinel/sentinel_26381.log"' /usr/local/ccdt/redis_7.4.2/redis36381/conf/sentinel.conf



sed -i '47c  sentinel announce-ip 172.16.135.42' /usr/local/ccdt/redis_7.4.2/redis36379/conf/sentinel.conf
sed -i '47c  sentinel announce-ip 172.16.135.42' /usr/local/ccdt/redis_7.4.2/redis36380/conf/sentinel.conf
sed -i '47c  sentinel announce-ip 172.16.135.42' /usr/local/ccdt/redis_7.4.2/redis36381/conf/sentinel.conf



sed -i '73c  dir /usr/local/ccdt/redis_7.4.2/redis36379/sentinel/' /usr/local/ccdt/redis_7.4.2/redis36379/conf/sentinel.conf
sed -i '73c  dir /usr/local/ccdt/redis_7.4.2/redis36380/sentinel/' /usr/local/ccdt/redis_7.4.2/redis36380/conf/sentinel.conf
sed -i '73c  dir /usr/local/ccdt/redis_7.4.2/redis36381/sentinel/' /usr/local/ccdt/redis_7.4.2/redis36381/conf/sentinel.conf

sed -i '92c  sentinel monitor mymaster 172.16.135.42 36379 2' /usr/local/ccdt/redis_7.4.2/redis36379/conf/sentinel.conf
sed -i '92c  sentinel monitor mymaster 172.16.135.42 36379 2' /usr/local/ccdt/redis_7.4.2/redis36380/conf/sentinel.conf
sed -i '92c  sentinel monitor mymaster 172.16.135.42 36379 2' /usr/local/ccdt/redis_7.4.2/redis36381/conf/sentinel.conf

sed -i '93c  sentinel auth-pass mymaster 4NTJgYwzISCkwxHk' /usr/local/ccdt/redis_7.4.2/redis36379/conf/sentinel.conf
sed -i '93c  sentinel auth-pass mymaster 4NTJgYwzISCkwxHk' /usr/local/ccdt/redis_7.4.2/redis36380/conf/sentinel.conf
sed -i '93c  sentinel auth-pass mymaster 4NTJgYwzISCkwxHk' /usr/local/ccdt/redis_7.4.2/redis36381/conf/sentinel.conf

sed -i '171c  requirepass 5NTJgYwzISCkwxHk' /usr/local/ccdt/redis_7.4.2/redis36379/conf/sentinel.conf
sed -i '171c  requirepass 5NTJgYwzISCkwxHk' /usr/local/ccdt/redis_7.4.2/redis36380/conf/sentinel.conf
sed -i '171c  requirepass 5NTJgYwzISCkwxHk' /usr/local/ccdt/redis_7.4.2/redis36381/conf/sentinel.conf


###############################启动###############

/usr/local/ccdt/redis_7.4.2/redis36379/bin/redis-server /usr/local/ccdt/redis_7.4.2/redis36379/conf/redis.conf
/usr/local/ccdt/redis_7.4.2/redis36380/bin/redis-server /usr/local/ccdt/redis_7.4.2/redis36380/conf/redis.conf
/usr/local/ccdt/redis_7.4.2/redis36381/bin/redis-server /usr/local/ccdt/redis_7.4.2/redis36381/conf/redis.conf

/usr/local/ccdt/redis_7.4.2/redis36379/bin/redis-sentinel /usr/local/ccdt/redis_7.4.2/redis36379/conf/sentinel.conf
/usr/local/ccdt/redis_7.4.2/redis36380/bin/redis-sentinel /usr/local/ccdt/redis_7.4.2/redis36380/conf/sentinel.conf
/usr/local/ccdt/redis_7.4.2/redis36381/bin/redis-sentinel /usr/local/ccdt/redis_7.4.2/redis36381/conf/sentinel.conf

 

标签:7.4,redis,usr,conf,local,ccdt,随记
From: https://www.cnblogs.com/zhaojingyu/p/18664295

相关文章

  • Redis数据库——Redis快的原因
    本文详细介绍redis为什么这么快的原因,这里是本系列文章的总结篇(后面会补充一些内容,或者在原文上进行更新迭代),将从各方面出发解释为什么redis快,受欢迎的原因。文章目录内存内存数据库预分配内存数据结构数据结构优化内存优化的编码持久化优化AOF和RDB单线程单线程......
  • SpringBoot3整合Redission
    1.依赖<dependency><groupId>org.redisson</groupId><artifactId>redisson-spring-boot-starter</artifactId><version>3.25.0</version></dependency>2.ymlspring:data:redis:#数据库datab......
  • Redis连接失败:客户端IP不在白名单中的分析与解决(ERR client ip is not in whitelist)
    个人名片......
  • 使用Redis的ZSet实现实时排行榜
    使用Redis的ZSet实现实时排行榜游戏中存在各种各样的排行榜,比如玩家的等级排名、分数排名等。玩家在排行榜中的名次是其实力的象征,位于榜单前列的玩家在虚拟世界中拥有无尚荣耀,所以名次也就成了核心玩家的追求目标。一个典型的游戏排行榜包括以下常见功能:能够记录每个玩家的分......
  • 使用Redis的ZSet实现实时排行榜
    使用Redis的ZSet实现实时排行榜游戏中存在各种各样的排行榜,比如玩家的等级排名、分数排名等。玩家在排行榜中的名次是其实力的象征,位于榜单前列的玩家在虚拟世界中拥有无尚荣耀,所以名次也就成了核心玩家的追求目标。一个典型的游戏排行榜包括以下常见功能:能够记录每个玩家的分......
  • 【Redis】:Redis的数据类型
    【Redis】:Redis的数据类型redis有5种数据类型String可以包含任何数据,比如jpg图片或者序列化的对象,一个键最大能存储512M适用场景:缓存,计数Hash(字典)Hash的数据原理所有的HashKey也是存到数组中,每个数组存一个key/value,这就可以保存多个key减少redis开销,如果有......
  • 关于redisson的一些问题,为什么要用watchDog
    redisson获取不到锁怎么处理1.阻塞等待锁释放:redisson有waitTimeout参数控制锁等待时间,当某线程获取不到锁时,会进入阻塞状态等待锁释放或超过设置的时间2.tryLock会根据参数直接返回或者抛出异常。 tryLock一般有两种:一种是不带参数的,这种不会阻塞,锁可用就返回true,锁不可用就......
  • 分布式锁Redisson详解,Redisson如何解决不可重入,不可重试,超时释放,主从一致问题的分析解
    目录1.Redisson解决不可重入锁导致的死锁问题 2.不可重试问题Pub/Sub的优势锁释放的发布逻辑3.超时释放的问题1.锁的超时释放机制背景2.源码分析2.1锁的获取2.2看门狗机制2.3看门狗续期实现2.4手动设置锁的过期时间总结 4.主从一致性 问题背景......
  • 使用 Redis 构建一个可靠的延迟队列
    本文内容来自开源项目:github.com/hdt3213/delayqueue在现代软件开发中,我们经常会遇到需要在特定时间后执行任务的场景。这些场景包括但不限于订单超时关闭、定时提醒、以及失败后重试机制等。为了满足这些需求,我们需要一个既可靠又灵活的延迟队列系统。本文将介绍如何使用Red......
  • redis安装
    一、Redis安装(Windows环境)https://download.csdn.net/blog/column/10939729/115372992下载地址:https://github.com/microsoftarchive/redis选择Release将zip解压使用redis-serverredis.windows.conf命令启行启动Redis服务,如下图所示为启动成功,默认端口6379关闭cmd窗口,Red......