Linux redis-Sentinel配置详解

下载

下载地址:https://redis.io/download

在/usr/local/src目录下执行下载。

wget http://download.redis.io/releases/redis-3.2.8.tar.gz

安装

解压到/usr/local/src目录,放源码包。

tar xzf redis-3.2.8.tar.gz

创建目录/usr/local/redis:

make dir /usr/local/redis

进入源码目录:

cd /usr/local/src/redis-3.2.8

然后执行下面make命令编译安装到目录/usr/local/redis/ (放执行文件)。

make PREFIX=/usr/local/redis install

软连接

程序做软连接到bin目录,方便直接执行。

ln -s /usr/local/redis/bin/redis-cli /usr/local/bin/redis-cli
ln -s /usr/local/redis/bin/redis-sentinel /usr/local/bin/redis-sentinel
ln -s /usr/local/redis/bin/redis-server /usr/local/bin/redis-server

配置文件

复制配置文件,在源码包里有sentinel.conf和redis.conf文件,复制到/etc/redis/目录下,如果有多个实例,建议改名,如本实例用的redis端口是7021,sentinel是17021:

mkdir /etc/redis
cp /usr/local/src/redis-3.2.8/redis.conf /etc/redis/redis_6379.conf
cp /usr/local/src/redis-3.2.8/sentinel.conf /etc/redis/sentinel_26379.conf

redis_master_6379.conf配置

修改配置以下参数:

port 6379
daemonize yes
#requirepass 123456
#masterauth 123456

其中,daemonize属性改为yes(后台运行)。

redis_slave_6380.conf 配置

修改配置以下参数:

port 6380
daemonize yes
#requirepass yingjun
slaveof 192.168.248.128 6379
masterauth 123456

其他slave配置同此配置。

sentinel_26379.conf 配置

port 23791
daemonize yes
logfile "/var/log/sentinel_63791.log"
#master-1
sentinel monitor master-1 192.168.248.128 6379 2
#sentinel auth-pass master-1 yingjun

sentinel_26380.conf 配置

port 23780
daemonize yes
logfile "/var/log/sentinel_63780.log"
#master-1
sentinel monitor master-1 192.168.248.128 6379 2
#sentinel auth-pass master-1 yingjun

启动

顺序依次启动服务。

redis-server /etc/redis/redis_master_6379.conf
redis-server /etc/redis/redis_slave_6380.conf
redis-sentinel /etc/redis/sentinel_26379.conf
redis-sentinel /etc/redis/sentinel_26380.conf

查看进程是否都已经启动

[root@iZj6cqZ redis]# ps -ef | grep redis
root  10910  1 0 08:11 ?  00:00:00 redis-server 127.0.0.1:6379
root  10918  1 0 08:11 ?  00:00:00 redis-server 127.0.0.1:6380
root  10939  1 0 08:15 ?  00:00:00 redis-sentinel *:26379 [sentinel]
root  10944  1 0 08:15 ?  00:00:00 redis-sentinel *:26380 [sentinel]
root  10948 10851 0 08:15 pts/1 00:00:00 grep --color=auto redis

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持我们。

(0)

相关推荐

  • Redis Sentinel实现高可用配置的详细步骤

    一般情况下yum安装redis的启动目录在:/usr/sbin :配置目录在/etc/redis/在其目录下会有默认的redis.conf和redis-sentinel.conf redis高可用配置: 配置哨兵(redis-sentinel),我的所有配置文件都放在/etc/redis-cluster/目录下 1.创建redis-sentinel_26379.conf,主要内容如下: #基本配置 port 26379 daemonize yes logfile "/var/log/redis/

  • java客户端Jedis操作Redis Sentinel 连接池的实现方法

    pom.xml配置 <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-redis</artifactId> <version>1.0.2.RELEASE</version> </dependency> <dependency> <groupId>redis.clients<

  • Redis Sentinel实现哨兵模式搭建小结

    Redis哨兵模式,用现在流行的话可以说就是一个"哨兵机器人",给"哨兵机器人"进行相应的配置之后,这个"机器人"可以7*24小时工作,它能能够自动帮助你做一些事情,如监控,提醒,自动处理故障等. Redis-sentinel简介 Redis-sentinel是Redis的作者antirez,因为Redis集群的被各大公司使用,每个公司要写自己的集群管理工具,于是antirez花了几个星期写出了Redis-sentinel. Redis 的 Se

  • Redis Sentinel服务配置流程(详解)

    1.Redis Sentinel服务配置 1.1简介 Redis 的 Sentinel 系统用于管理多个 Redis 服务器(instance), 该系统执行以下三个任务: 监控(Monitoring): Sentinel 会不断地检查你的主服务器和从服务器是否运作正常. 提醒(Notification): 当被监控的某个 Redis 服务器出现问题时, Sentinel 可以通过API 向管理员或者其他应用程序发送通知. 自动故障迁移(Automatic failover): 当一个主服务器不

  • 玩转Redis搭建集群之Sentinel详解

    前言 Redis作为内存数据库,需要具备高可用的特点,不然如果服务器宕机,还在内存里的数据就会丢失.我们最常用的高可用方法就是搭建集群,master机器挂了,可以让slave机器顶上,继续提供服务.但是Redis集群是不会自动进行主从切换的,也就是说,如果主节点非常不争气的在凌晨3点挂了,那么运维同学就要马上起床,把从节点改成主节点,这样的操作是非常繁琐低效的.为此,Redis官方提供了一种解决方案:Redis Sentinel 简介 Redis Sentinel集群通常由3到5个节点组成,如果

  • Springboot项目中使用redis的配置详解

    程序结构: 一.配置 1. 在pom.xml中添加依赖 pom.xml文件如下: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=&q

  • springboot2.5.0和redis整合配置详解

    基本概况 为什么使用缓存 缓存是在内存中存储的数据备份,当数据没有发生本质变化时 就可以直接从内存中查询数据,而不用去数据库查询(在磁盘中) CPU读取内存的速度要比读取磁盘快,可以提高效率 Redis缓存 Remote Dictionnary Server(远程数据服务),是一款内存高速缓存数据库. 五种常用数据类型: String(字符串).List(列表).Set(集合).Hash(散列).ZSet(有序集合) 可持久化:一边运行,一边向硬盘备份一份,防止断电等偶然情况,导致内存中数据丢失

  • Spring Boot Redis 集成配置详解

    spring Boot 熟悉后,集成一个外部扩展是一件很容易的事,集成Redis也很简单,看下面步骤配置: 一.添加pom依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-redis</artifactId> </dependency> 二.创建 RedisClient.java 注意该类存放的pack

  • Linux下Squid配置详解 Squid代理服务器配置第1/3页

    代理服务器的功能是代理网络用户取得网络信息,它是网络信息的中转站.随着代理服务器的广泛使用,随之而来的是一系列的安全问题.由于没有对代理服务器的访问控制策略作全面细致的配置,导致用户可以随意地通过代理服务器访问许多色情.反动的非法站点,而这些行为往往又很难追踪,给管理工作带来极大的不便. Squid是Linux下一个缓存Internet数据的代理服务器软件,其接收用户的下载申请,并自动处理所下载的数据.也就是说,当一个用户想要下载一个主页时,可以向Squid发出一个申请,要Squid代替其进行下

  • sentinel支持的redis高可用集群配置详解

    目录 一.首先配置redis的主从同步集群 二.sentinel高可用 一.首先配置redis的主从同步集群 1.主库的配置文件不用修改,从库的配置文件只需增加一行,说明主库的IP端口.如果需要验证的,也要加多一行,认证密码. slaveof 192.168.20.26 5268 masterauth hodge01 一主多从的话,就启用多个从库.其中,从库都是一样的方案.本次有两个slave. 2.命令检查 /usr/local/redis/bin/redis-cli -p 5257 -a h

  • redis配置文件中常用配置详解

    此次安装的版本为: 5.0.3 [root@localhost local]# redis-server --version Redis server v=5.0.3 sha=00000000:0 malloc=jemalloc-5.1.0 bits=64 build=afabdecde61000c3 打开redis.cof NETWORK # 指定 redis 只接收来自于该IP地址的请求,如果不进行设置,那么将处理所有请求 bind 127.0.0.1 #是否开启保护模式,默认开启.要是配置

  • Redis 对比 Memcached 并在 CentOS 下进行安装配置详解

    Redis 是一个开源.支持网络.基于内存.键值对的 Key-Value 数据库,本篇文章主要介绍了Redis 对比 Memcached 并在 CentOS 下进行安装配置详解,有兴趣的可以了解一下. 了解一下 Redis Redis 是一个开源.支持网络.基于内存.键值对的 Key-Value 数据库,使用 ANSI C 编写,并提供多种语言的 API ,它几乎没有上手难度,只需要几分钟我们就能完成安装工作,并让它开始与应用程序顺畅协作.换句话来说,只需投入一小部分时间与精力,大家就能获得立竿

  • Linux 系统 nginx 服务器安装及负载均衡配置详解

    nginx(engine x) 是一个 高性能 的 HTTP 和 反向代理 服务器.邮件代理服务器以及通用的 TCP/UDP 代理服务器.其特点为轻量级(占用系统资源少).稳定性好.可扩展性(模块化结构).并发能力强.配置简单等. 本文主要介绍在测试环境中通过 nginx 实现基本的 负载均衡 功能. nginx 可以提供 HTTP 服务,包括处理静态文件,支持 SSL 和 TLS SNI.GZIP 网页压缩.虚拟主机.URL 重写等功能,可以搭配 FastCGI.uwsgi 等程序处理动态请求

  • SpringBoot中对应2.0.x版本的Redis配置详解

    properties格式: # REDIS (RedisProperties) # Redis数据库索引(默认为0) spring.redis.database=0 # Redis服务器地址 spring.redis.host=localhost # Redis服务器连接端口 spring.redis.port=6379 # Redis服务器连接密码(默认为空) spring.redis.password= # 连接池最大连接数(使用负值表示没有限制) spring.redis.jedis.po

  • Redis Cluster原理及配置详解

    目录 Redis Cluster 原理说的头头是道,这些配置不懂就是纸上谈兵 cluster-enabled cluster-config-file cluster-node-timeout cluster-port cluster-replica-validity-factor cluster-migration-barrier cluster-require-full-coverage cluster-replica-no-failover cluster-allow-reads-when-

随机推荐