1.常用的配置

    1. port 26379
    1. # sentinel announce-ip <ip>
    1. # sentinel announce-port <port>
    1. dir /tmp

    1. ################################# master001 #################################
    1. sentinel monitor master001 192.168.110.101 6379 2
    1. # sentinel auth-pass <master-name> <password>
    1. sentinel down-after-milliseconds master001 30000
    1. sentinel parallel-syncs master001 1
    1. sentinel failover-timeout master001 180000
    1. # sentinel notification-script <master-name> <script-path>
    1. # sentinel client-reconfig-script <master-name> <script-path>

    1. # 可以配置多个master节点
    1. ################################# master002 #################################
配置文件说明:
1. port :当前Sentinel服务运行的端口

2. dir : Sentinel服务运行时使用的临时文件夹

3.sentinel monitor master001 192.168.110.101 6379 2:Sentinel去监视一个名为master001的主redis实例,这个主实例的IP地址为本机地址192.168.110.101,端口号为6379,而将这个主实例判断为失效至少需要2个 Sentinel进程的同意,只要同意Sentinel的数量不达标,自动failover就不会执行

4.sentinel down-after-milliseconds master001 30000:指定了Sentinel认为Redis实例已经失效所需的毫秒数。当实例超过该时间没有返回PING,或者直接返回错误,那么Sentinel将这个实例标记为主观下线。只有一个 Sentinel进程将实例标记为主观下线并不一定会引起实例的自动故障迁移:只有在足够数量的Sentinel都将一个实例标记为主观下线之后,实例才会被标记为客观下线,这时自动故障迁移才会执行

5.sentinel parallel-syncs master001 1:指定了在执行故障转移时,最多可以有多少个从Redis实例在同步新的主实例,在从Redis实例较多的情况下这个数字越小,同步的时间越长,完成故障转移所需的时间就越长

6.sentinel failover-timeout master001 180000:如果在该时间(ms)内未能完成failover操作,则认为该failover失败

7.sentinel notification-script <master-name> <script-path>:指定sentinel检测到该监控的redis实例指向的实例异常时,调用的报警脚本。该配置项可选,但是很常用

2.官方完整的配置

    1. # Example sentinel.conf
    1. # port <sentinel-port>
    1. # The port that this sentinel instance will run on
    1. # sentinel实例运行的端口
    1. port 26379
    1. # sentinel announce-ip <ip>
    1. # sentinel announce-port <port>
    1. #
    1. # The above two configuration directives are useful in environments where,
    1. # because of NAT, Sentinel is reachable from outside via a non-local address.
    1. #
    1. # When announce-ip is provided, the Sentinel will claim the specified IP address
    1. # in HELLO messages used to gossip its presence, instead of auto-detecting the
    1. # local address as it usually does.
    1. #
    1. # Similarly when announce-port is provided and is valid and non-zero, Sentinel
    1. # will announce the specified TCP port.
    1. #
    1. # The two options don't need to be used together, if only announce-ip is
    1. # provided, the Sentinel will announce the specified IP and the server port
    1. # as specified by the "port" option. If only announce-port is provided, the
    1. # Sentinel will announce the auto-detected local IP and the specified port.
    1. #
    1. # Example:
    1. #
    1. # sentinel announce-ip 1.2.3.4
    1. # dir <working-directory>
    1. # Every long running process should have a well-defined working directory.
    1. # For Redis Sentinel to chdir to /tmp at startup is the simplest thing
    1. # for the process to don't interferer with administrative tasks such as
    1. # unmounting filesystems.
    1. dir /tmp
    1. # sentinel monitor <master-name> <ip> <redis-port> <quorum>
    1. # master-name : master Redis Server名称
    1. # ip : master Redis Server的IP地址
    1. # redis-port : master Redis Server的端口号
    1. # quorum : 主实例判断为失效至少需要 quorum 个 Sentinel 进程的同意,只要同意 Sentinel 的数量不达标,自动failover就不会执行
    1. #
    1. # Tells Sentinel to monitor this master, and to consider it in O_DOWN
    1. # (Objectively Down) state only if at least <quorum> sentinels agree.
    1. #
    1. # Note that whatever is the ODOWN quorum, a Sentinel will require to
    1. # be elected by the majority of the known Sentinels in order to
    1. # start a failover, so no failover can be performed in minority.
    1. #
    1. # Slaves are auto-discovered, so you don't need to specify slaves in
    1. # any way. Sentinel itself will rewrite this configuration file adding
    1. # the slaves using additional configuration options.
    1. # Also note that the configuration file is rewritten when a
    1. # slave is promoted to master.
    1. #
    1. # Note: master name should not include special characters or spaces.
    1. # The valid charset is A-z 0-9 and the three characters ".-_".
    1. #
    1. sentinel monitor mymaster 127.0.0.1 6379 2
    1. # sentinel auth-pass <master-name> <password>
    1. #
    1. # Set the password to use to authenticate with the master and slaves.
    1. # Useful if there is a password set in the Redis instances to monitor.
    1. #
    1. # Note that the master password is also used for slaves, so it is not
    1. # possible to set a different password in masters and slaves instances
    1. # if you want to be able to monitor these instances with Sentinel.
    1. #
    1. # However you can have Redis instances without the authentication enabled
    1. # mixed with Redis instances requiring the authentication (as long as the
    1. # password set is the same for all the instances requiring the password) as
    1. # the AUTH command will have no effect in Redis instances with authentication
    1. # switched off.
    1. #
    1. # Example:
    1. #
    1. # sentinel auth-pass mymaster MySUPER--secret-0123passw0rd
    1. # sentinel down-after-milliseconds <master-name> <milliseconds>
    1. #
    1. # Number of milliseconds the master (or any attached slave or sentinel) should
    1. # be unreachable (as in, not acceptable reply to PING, continuously, for the
    1. # specified period) in order to consider it in S_DOWN state (Subjectively
    1. # Down).
    1. # 选项指定了 Sentinel 认为Redis实例已经失效所需的毫秒数。当实例超过该时间没有返回PING,或者直接返回错误, 那么 Sentinel 将这个实例标记为主观下线(subjectively down,简称 SDOWN )
    1. #
    1. # Default is 30 seconds.
    1. sentinel down-after-milliseconds mymaster 30000
    1. # sentinel parallel-syncs <master-name> <numslaves>
    1. #
    1. # How many slaves we can reconfigure to point to the new slave simultaneously
    1. # during the failover. Use a low number if you use the slaves to serve query
    1. # to avoid that all the slaves will be unreachable at about the same
    1. # time while performing the synchronization with the master.
    1. # 选项指定了在执行故障转移时, 最多可以有多少个从Redis实例在同步新的主实例, 在从Redis实例较多的情况下这个数字越小,同步的时间越长,完成故障转移所需的时间就越长。
    1. sentinel parallel-syncs mymaster 1
    1. # sentinel failover-timeout <master-name> <milliseconds>
    1. #
    1. # Specifies the failover timeout in milliseconds. It is used in many ways:
    1. #
    1. # - The time needed to re-start a failover after a previous failover was
    1. # already tried against the same master by a given Sentinel, is two
    1. # times the failover timeout.
    1. #
    1. # - The time needed for a slave replicating to a wrong master according
    1. # to a Sentinel current configuration, to be forced to replicate
    1. # with the right master, is exactly the failover timeout (counting since
    1. # the moment a Sentinel detected the misconfiguration).
    1. #
    1. # - The time needed to cancel a failover that is already in progress but
    1. # did not produced any configuration change (SLAVEOF NO ONE yet not
    1. # acknowledged by the promoted slave).
    1. #
    1. # - The maximum time a failover in progress waits for all the slaves to be
    1. # reconfigured as slaves of the new master. However even after this time
    1. # the slaves will be reconfigured by the Sentinels anyway, but not with
    1. # the exact parallel-syncs progression as specified.
    1. # 如果在该时间(ms)内未能完成failover操作,则认为该failover失败
    1. #
    1. # Default is 3 minutes.
    1. sentinel failover-timeout mymaster 180000
    1. # SCRIPTS EXECUTION
    1. #
    1. # sentinel notification-script and sentinel reconfig-script are used in order
    1. # to configure scripts that are called to notify the system administrator
    1. # or to reconfigure clients after a failover. The scripts are executed
    1. # with the following rules for error handling:
    1. #
    1. # If script exits with "1" the execution is retried later (up to a maximum
    1. # number of times currently set to 10).
    1. #
    1. # If script exits with "2" (or an higher value) the script execution is
    1. # not retried.
    1. #
    1. # If script terminates because it receives a signal the behavior is the same
    1. # as exit code 1.
    1. #
    1. # A script has a maximum running time of 60 seconds. After this limit is
    1. # reached the script is terminated with a SIGKILL and the execution retried.
    1. # NOTIFICATION SCRIPT
    1. #
    1. # sentinel notification-script <master-name> <script-path>
    1. #
    1. # Call the specified notification script for any sentinel event that is
    1. # generated in the WARNING level (for instance -sdown, -odown, and so forth).
    1. # This script should notify the system administrator via email, SMS, or any
    1. # other messaging system, that there is something wrong with the monitored
    1. # Redis systems.
    1. #
    1. # The script is called with just two arguments: the first is the event type
    1. # and the second the event description.
    1. #
    1. # The script must exist and be executable in order for sentinel to start if
    1. # this option is provided.
    1. # 指定sentinel检测到该监控的redis实例指向的实例异常时,调用的报警脚本。该配置项可选,但是很常用。
    1. #
    1. # Example:
    1. #
    1. # sentinel notification-script mymaster /var/redis/notify.sh
    1. # CLIENTS RECONFIGURATION SCRIPT
    1. #
    1. # sentinel client-reconfig-script <master-name> <script-path>
    1. #
    1. # When the master changed because of a failover a script can be called in
    1. # order to perform application-specific tasks to notify the clients that the
    1. # configuration has changed and the master is at a different address.
    1. #
    1. # The following arguments are passed to the script:
    1. #
    1. # <master-name> <role> <state> <from-ip> <from-port> <to-ip> <to-port>
    1. #
    1. # <state> is currently always "failover"
    1. # <role> is either "leader" or "observer"
    1. #
    1. # The arguments from-ip, from-port, to-ip, to-port are used to communicate
    1. # the old address of the master and the new address of the elected slave
    1. # (now a master).
    1. #
    1. # This script should be resistant to multiple invocations.
    1. #
    1. # Example:
    1. #
    1. # sentinel client-reconfig-script mymaster /var/redis/reconfig.sh
-------------------------------------------------------------------------------------------------------------------------------

sentinel.conf配置的更多相关文章

  1. sentinel.conf 配置

    daemonize yes logfile "/home/data/redis/redis_sentinel.log" sentinel monitor mymaster 192. ...

  2. Redis学习笔记--Redis配置文件Sentinel.conf参数配置详解

    redis-sentinel.conf配置项说明如下: 1.port 26379 sentinel监听端口,默认是26379,可以修改. 2.sentinel monitor <master-n ...

  3. 【转载】Redis Sentinel服务配置

    转载地址:http://blog.csdn.net/vtopqx/article/details/49247285 redis官网文档:http://www.redis.cn/topics/senti ...

  4. Redis Sentinel哨兵配置

    概述 Redis-Sentinel是Redis官方推荐的高可用性(HA)解决方案,当用Redis做Master-slave的高可用方案时,假如master宕机了,Redis本身(包括它的很多客户端)都 ...

  5. redis.windows.conf配置详解

    redis.windows.conf配置详解 转自:https://www.cnblogs.com/kreo/p/4423362.html # redis 配置文件示例 # 当你需要为某个配置项指定内 ...

  6. redis.windows.conf 配置注释

    . daemonize no Redis默认不是以守护进程的方式运行,可以通过该配置项修改,使用yes启用守护进程 . pidfile /var/run/redis_6379.pid 当Redis以守 ...

  7. Redis一主二从Sentinel监控配置

    本文基于Redis单实例安装安装.https://gper.club/articles/7e7e7f7ff7g5egc4g6b 开启哨兵模式,至少需要3个Sentinel实例(奇数个,否则无法选举Le ...

  8. sentinel.conf样例

    #禁止用localhost与127.0.0.1# Example sentinel.conf # 哨兵sentinel实例运行的端口 默认26379port 26379 # 哨兵sentinel的工作 ...

  9. CentOS8 下 Redis5.0.7 哨兵Sentinel 模式配置指南

    下载Redis Redis下载链接 解压缩 tar -xzvf redis-5.0.7.tar.gz 编译安装 make和gcc依赖 可通过yum -y install gcc automake au ...

随机推荐

  1. WWDC————苹果全球开发者大会

    WWDC:Apple Worldwide Developers Conference(苹果全球开发者)的简称,每年定期由苹果公司(Apple Inc.)在美国举办.大会主要的目的是让苹果公司向研发者们 ...

  2. [leetcode]_Pascal's Triangle

    题目:题目本身不存在问题,生成Pascal三角. 注意: ArrayList的使用: 1.ArrayList申请二维数组. ArrayList<ArrayList<Integer>& ...

  3. vue.js插件使用(02) vue-router

    概述 vue-router是Vue.js官方的路由插件,它和vue.js是深度集成的,适合用于构建单页面应用.vue的单页面应用是基于路由和组件的,路由用于设定访问路径,并将路径和组件映射起来.传统的 ...

  4. PHP字符串拼接与MySQL语句

    这个部分总是钻牛角尖.总是出错. public function getList($pagesize=25){ $where = '1'; $tableName = $this->getTabl ...

  5. Oracle与SQL Server事务处理的比较

    事务处理是所有大型数据库产品的一个关键问题,各数据库厂商都在这个方面花费了很大精力,不同的事务处理方式会导致数据库性能和功能上的巨大差异.事务处理也是数据库管理员与数据库应用程序开发人员必须深刻理解的 ...

  6. Android VideoView简单播放视频

    给Android VideoView一个文件目录,就可以直接播放智能设备中的视频文件,现在以播放事先用手机拍好并重命名的视频文件test.mp4为例.(1) 需要在布局文件中写一个ViedoView: ...

  7. ASP.NET MVC5学习笔记之Action参数模型绑定基本过程

    当我们在Controller中定义一个Action,通常会定义一个或多个参数,每个参数称为一个模型,ASP.NET MVC框架提供了一种机制称为模型绑定,会尝试自动从请求的信息中实例化每一个模型并赋值 ...

  8. C++基本数据类型解惑

    记得刚学C语言的时候,对那些double,float,long,unsigned int各种混乱,基本是随便用,对数据类型没有一个整体的框架.最近学习<<C++ primer plus&g ...

  9. PIL不能关闭文件的解决方案

    今天写了一个能指定图片尺寸,以及比例 来搜索分类图片的Python脚本.为了读取多个格式的文件的头,采用了Python PIL库. im = PIL.Image.open(imPath) if im的 ...

  10. python之poplib库

    pop3能实现访问远程主机下载新的邮件或者下载后删掉这些邮件.不支持多信箱,也不能提供持久稳定的邮件认证.也就是说不能使用pop3来作为邮件同步协议. poplib支持多个认证方法.最普遍的是基本的用 ...