【问题标题】:Redis master and slave issueRedis主从问题
【发布时间】:2021-01-28 12:35:36
【问题描述】:

我们在生产环境中使用 keepalived 设置了主从设置,所以问题是我的主从变成了从属,所以这个问题的原因是什么,如果有网络波动或任何其他原因,我该如何查找。

【问题讨论】:

  • 我们必须提供RCA,所以我在哪里找到了这个问题的原因,如果有任何日志文件?

标签: database redis master slave keepalived


【解决方案1】:

这与 ulimit 有关。基本上linux系统对打开文件描述符的数量有一个硬性限制,默认为256,请在/etc/limits.conf中添加以下行

*         hard    nofile      500000
*         soft    nofile      500000
root      hard    nofile      500000
root      soft    nofile      500000

【讨论】:

  • 我找不到 sentinel.conf 文件,你能分享一下路径吗?
【解决方案2】:

您可以检查日志文件中的哨兵。日志文件的路径在 sentinel.conf 中定义,如下所示。

# Specify the log file name. Also the empty string can be used to force
# Sentinel to log on the standard output. Note that if you use standard
# output for logging but daemonize, logs will be sent to /dev/null
logfile ""

在您的情况下,会发生网络问题,Sentinel 会将从节点提升为新的主节点。然后稍后当旧主服务器可用时,哨兵会将其作为从服务器带入,因为新主服务器已经在运行。您必须配置日志文件,以便将来您可以在日志中看到这种转换的证据。

【讨论】:

    猜你喜欢
    • 2021-01-24
    • 2018-04-05
    • 2021-09-08
    • 1970-01-01
    • 1970-01-01
    • 2015-12-08
    • 2021-12-22
    • 2012-01-09
    相关资源
    最近更新 更多