问题标签 [redis-sentinel]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
5910 浏览

java - Correct @EnableRedisHttpSession configuration with Redis Sentinel

I have a Spring Cloud based application with multiple backend Spring-Boot servers. The servers are all sharing their session with a Redis server via @EnableRedisHttpSession.

I'm trying to configure the application with master-slave configuration and Redis Sentinel. My setup is 1 master, two slaves, and 3 sentinels.

I keep getting issues with the environment. At first, I was getting an error saying that my slave it READONLY. So I had to set all slaves to READWRITE. Then, I still got this error. Turns out that when a slave was promoted to master, the old master was turned into slave, with the default READONLY setting. So I had to set the master to READWRITE as well. These are my commands to boot the redis servers (I know it makes no sense to use the same machine, it's for testing purposes at this stage):

Boot master:

Boot slaves:

application.properties/yml config per spring-boot server participating in the session:

Redis sentinel config:

The conf files are:

For the other two sentinels it's port 5001 and 5002

Now, as long as everything is normal and there are no issues, everything works fine.

However, once I kill the master redis server, things stop working. First, I get the following error:

What's worse, when I restart my application, things stop working as well. There are no real errors per say, but the application simply won't work. For example, instead of serving me content, I get a page with just some text (no javascript/css/images). This is usually an indication that it cannot find the session id it needs to use. And this happens even after logout.

I noticed that when I kill the master server, redis sentinel rewrites my config files. For example, after killing the master redis server, the sentinel.conf now appears like this:

And now these settings remain as is even after restarting all servers/redis nodes. I can only get the application working again by manually fixing the config files.

Clearly I can't use this solution at the moment. Any help would be greatly appreciated.

Here is the full stacktrace:

Also, here is the output of one of the sentinels log:

Here is the log of the Redis master (with the sigterm notification):

And here is the log of the two Redis slaves:

Second:

Thanks.

0 投票
1 回答
5068 浏览

linux - Redis sentinel - 如何使服务器脱离循环?

我有以下哨兵部署 - 不同服务器上的 3 个 redis 实例,每台服务器上的 3 个哨兵。

现在,我意识到当前的master没有太多内存,所以我在这个特定的服务器上停止了sentinel和redis实例。并在新机器上做了同样的设置。所以,我仍然有相同的部署,3 个 redis 实例和 3 个哨兵。

问题是,现在哨兵说,主服务器已关闭,因为他们认为主服务器是我删除的服务器。我应该怎么做才能告诉哨兵它不需要在循环中包含该服务器。

0 投票
1 回答
185 浏览

redis - Redis-Sentinel 与 CONFIG 命令重命名的 Redis

CONFIG命令重命名为CONFIG_2267bccb973c432d96a26e96ca50860a

据我所知,Redis-sentinel 依赖于这个命令,是吗?如何配置 redis-sentinel 使用重命名的命令?

0 投票
1 回答
746 浏览

redis - 如何使用 Sentinel 运行 redis 集群

由于扩展和高可用性通常是不同的概念(除非您选择负载平衡容错方案),我希望 Redis 能够同时支持这两者。但是据我了解,我们不能将 Redis 集群与 Sentinel 混合使用吗?如果是这样,我如何创建一个具有多个分区并且也由 Sentinel 管理的部署?是否有描述如何完成此操作的指南?

0 投票
1 回答
285 浏览

javascript - 如何在redis中将JS对象传递给它自己的事件参数 - 连接事件

在 redis sentinel 客户端程序 - 第一个程序中,当我保留要创建的 redis sentinel 对象并且设置 KEY 工作正常时。但是当你观察第二个程序时,client.on('connect', runSample(client)); 我正在传递客户端对象(redis sentinel client),它的连接参数 runSample。为此,我收到以下错误..

错误详情

https://github.com/DocuSignDev/node-redis-sentinel-client/blob/master/index.js

第一个工作程序..

第二个程序,不起作用

谢谢

0 投票
2 回答
4699 浏览

redis - 如何在哨兵配置中切换redis master

我有一个 redis 哨兵配置,其中一个主服务器、两个从服务器和 3 个哨兵在运行。我注意到,在某些时候,哨兵可能会切换主人,选择其中一个奴隶作为主人。这会导致作为独立客户端连接到主节点的应用程序出现问题(我正在努力更改代码以使用哨兵)。我想知道是否可以通过连接到哨兵客户端来切换主控,即通过' redis-cli'

有人可以告诉我是否有可以用来切换主 IP 的命令吗?

0 投票
1 回答
3340 浏览

redis - Redis 哨兵配置不起作用

我正在尝试使用两个 redis 节点设置哨兵。请找到内联的conf文件。

端口 16371

目录“C:\Program Files\Redis\16371\”

日志级别通知

日志文件“C:\Program Files\Redis\logs\16371.log”

哨兵监视器 ExampleMaster 127.0.0.1 6371 1

毫秒后哨兵下降 ExampleMaster 3000

哨兵故障转移超时 ExampleMaster 6000

当我尝试使用此配置运行服务器时,出现以下错误:

* FATAL CONFIG FILE ERROR * 读取配置文件,第 5 行

有人可以帮我解决这个问题。蒂亚:)

0 投票
1 回答
300 浏览

redis - Redis Sentinel 是否应该监控集群中的每个 Master?

是否需要 sentinel 使用不同的服务名称来监控集群中的每个 master,或者只监控集群中的 3 个 master 之一?

我当前的配置是 3 个主实例、3 个从属实例和 3 个哨兵实例。每个哨兵实例都在监视每个主节点。大师1,大师2,大师3。我还没有看到任何文档有多个 master,redis 文档也不是很清楚。

0 投票
1 回答
677 浏览

logstash - 带有redis哨兵的logstash是可能的吗?

我想用redis搭建一个高可用ELK监控系统,但是对于如何制作redis HA有点困惑。
Redis Sentinel 为 Redis 提供高可用性。但我在文档上没有找到任何配置。https://www.elastic.co/guide/en/logstash/current/plugins-inputs-redis.html 那么我可以将它用于logstash作为输入和输出吗?有人有这方面的经验吗?

0 投票
0 回答
780 浏览

c# - 如何订阅 Sentinel 以在我的应用程序故障转移期间监控 Redis 主服务器切换?

我一直在寻找这个答案,但没有人证明如何成功地做到这一点。因此,我使用C# 中的 StackExchange / Sentinel 从 Redis 故障转移中获取了一些代码,并创建了一个简单的代码块:

在这里,Failover()方法在应用程序启动时被调用。在这种方法中,我只是创建与部署到当前服务器的 Sentinel 服务器的连接。然后我尝试订阅 Sentinel 的“+switch-master”事件。事件处理程序WriteToConsole是一个简单的方法,它只是告诉我我的应用程序实际上正在监听事件。

我希望最终能够在WriteToConsole占位符方法中添加逻辑,以切换到新的主 Redis 服务器。

但是这个设置不起作用。当我停止由相关 Sentinel 监控的主 Redis 服务器时,我没有看到对应用程序的任何影响或弹出控制台对话框。我究竟做错了什么?我在正确的方向吗?