Redis Sentinel 集群部署方案


相关文章传送门

docker-compose部署Redis服务器


Redis Sentinel 集群部署方案

概述

Redis集群可以在一组Redis节点之间实现高可用性和sharding,在集群中会有1个master和多个slave节点。当master节点失效时,应选举出一个slave节点作为新的master。然而Redis本身(包括它的很多客户端)没有实现自动故障发现并进行主备切换的能力,需要外部的监控方案来实现自动故障恢复,Redis集群如下图所示。


Redis Sentinel 核心配置

参考
# Example sentinel.conf

# *** IMPORTANT ***
#
# By default Sentinel will not be reachable from interfaces different than
# localhost, either use the 'bind' directive to bind to a list of network
# interfaces, or disable protected mode with "protected-mode no" by
# adding it to this configuration file.
# 默认情况下,从不同于的接口将无法访问标记
# 本地主机,可以使用'bind'指令绑定到网络列表
# 接口,或禁用“受保护模式no”的受保护模式
# 将其添加到此配置文件中。
#
# Before doing that MAKE SURE the instance is protected from the outside
# world via firewalling or other means.
# 在此之前,请确保实例受外部保护
# 世界通过防火墙或其他方式
# 
# For example you may use one of the following:
# 例如,你可以使用以下其中一种: 
#
# bind 127.0.0.1 192.168.1.1
#
# protected-mode no

# port <sentinel-port>
# The port that this sentinel instance will run on
# 此标记实例将在其上运行的端口
port 26379

# sentinel announce-ip <ip>
# sentinel announce-port <port>
#
# The above two configuration directives are useful in environments where,
# because of NAT, Sentinel is reachable from outside via a non-local address.
# 以上两个配置指令在以下环境中非常有用:
# 由于NAT的原因,哨兵可以从外部通过一个非本地地址到达。
#
# When announce-ip is provided, the Sentinel will claim the specified IP address
# in HELLO messages used to gossip its presence, instead of auto-detecting the
# local address as it usually does.
# 当提供了通知IP时,标记将声明指定的IP地址
# 在HELLO消息中用来八卦它的存在,而不是自动检测
# 本地地址通常是这样的。
#
# Similarly when announce-port is provided and is valid and non-zero, Sentinel
# will announce the specified TCP port.
# 类似地,当提供了通知端口,且该端口有效且非0时,进行标记
# 将宣布指定的TCP端口。
#
# The two options don't need to be used together, if only announce-ip is
# provided, the Sentinel will announce the specified IP and the server port
# as specified by the "port" option. If only announce-port is provided, the
# Sentinel will announce the auto-detected local IP and the specified port.
# 如果只使用announcement -ip,则不需要同时使用这两个选项
# 提供,哨兵将宣布指定的IP和服务器端口
# 由“端口”选项指定。如果只提供通知端口,则
# Sentinel会通知自动侦测到的本地IP和指定的端口。
#
# Example:例子
#
# sentinel announce-ip 1.2.3.4

# dir <working-directory>
# Every long running process should have a well-defined working directory.
# For Redis Sentinel to chdir to /tmp at startup is the simplest thing
# for the process to don't interfere with administrative tasks such as
# unmounting filesystems.
dir /tmp

# sentinel monitor <master-name> <ip> <redis-port> <quorum&g
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

一个巨大的怪兽

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值