gpt4 book ai didi

java - Redis 复制问题

转载 作者:IT王子 更新时间:2023-10-29 06:16:11 24 4
gpt4 key购买 nike

我计划在我的应用程序中使用 Redis 进行存储和缓存。我在线阅读了大部分文档,但仍然对复制有疑问。

我的用例:

  • Dashboard 应用程序:写入和读取 redis(Master redis 实例)

  • 运行 Redis 客户端且仅进行读取的另一个应用程序的几个实例。

  • 客户端每 X 分钟从 master 复制一次。

问题:- 我知道当客户进行复制时,他们被阻止操作。但是,读取操作是否也被阻止了?

  • 如果读取也被阻塞,那么克服它的好方法是什么,因为我希望能够在没有任何阻塞的情况下进行读取。

提前感谢您的帮助!

最佳答案

这不完全是它 says in the docs ,它实际上说:

replication is blocking on the slave side: while the slave is performing the first synchronization it can't reply to queries.

If you set up a slave, upon connection it sends a SYNC command. And it doesn't matter if it's the first time it has connected or if it's a reconnection.

因此,在正常操作期间,它根本不应该阻塞从站。但是在初始同步期间读取被阻止。

可以通过info命令查看当前是否在同步; master_sync_in_progress:0

复制通过首先发送所有内容( block )来工作然后它发送增量更新(非阻塞,因为它“只是”以正确的顺序修改数据集的已执行命令)

你只能通过连接到不同的 redis 实例来克服它,也许 master 作为后备?

关于java - Redis 复制问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6667663/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com