如何在两个Elasticache Redis实例之间同步数据

发布于 2025-01-18 19:24:00 字数 1966 浏览 0 评论 0原文

我有两个AWS Elasticache实例,其中一个实例(假设实例A)具有非常重要的数据集和连接,停机时间是不可接受的。由于这种情况,而不是进行正常迁移(例如,在新写入中防止源数据,在其上进行转储并将其还原到新的迁移),我正在尝试同步实例a的数据到另一个Elasticache实例(假设实例B)。正如我所说,此过程应为无停机时间。为此,我尝试了 redisshake ,但是因为AWS限制了用户运行某些命令bgsave> configreplicaof从属sync etc),redisshake不与AWS Elasticache一起使用。它在下面给出错误。

2022/04/04 11:58:42 [PANIC] invalid psync response, continue, ERR unknown command `psync`, with args beginning with: `?`, `-1`, 
[stack]: 
    2   github.com/alibaba/RedisShake/redis-shake/common/utils.go:252
            github.com/alibaba/RedisShake/redis-shake/common.SendPSyncContinue
    1   github.com/alibaba/RedisShake/redis-shake/dbSync/syncBegin.go:51
            github.com/alibaba/RedisShake/redis-shake/dbSync.(*DbSyncer).sendPSyncCmd
    0   github.com/alibaba/RedisShake/redis-shake/dbSync/dbSyncer.go:113
            github.com/alibaba/RedisShake/redis-shake/dbSync.(*DbSyncer).Sync
        ... ...

我已经尝试过 rump 为此,但它没有足够的稳定性来处理任何重要的过程。首先,它不能用作背景过程,当第一个同步完成后,它将使用信号:退出完成,因此在第一个完成后将不会进行持续的更改。 其次,它是在每次运行中识别创建/修改的键/值,例如,在第一次运行键Apple等于pear,它是按原样同步到目标,但是当我删除键apple及其在源中的值并再次运行rump再次同步脚本时,它并未在目标中删除。因此,基本上,它并不是从字面上同步源和目的地。另外,最后一次提交rump github repo大约在3年前。对我来说,似乎有点过时的项目。

在所有这些信息和尝试之后,我的问题是,是否有一种方法可以同步两个elasticache for redis实例,正如我所说,在我的情况下,没有停机时间。如果您有这种经验有防弹性建议,我将不胜感激。我尝试过,但不幸没有找到任何。

非常感谢您,

最好的问候。

I have two AWS Elasticache instances, One of the instances (lets say instance A) has very important data sets and connections on it, downtime is unacceptable. Because of this situation, instead of doing normal migration (like preventing source data from new writes, getting dump on it, and restore it to the new one) I'm trying to sync instance A's data to another Elasticache instance (lets say instance B). As I said, this process should be downtime-free. In order to do that, I tried RedisShake, but because AWS restrict users to run certain commands (bgsave, config, replicaof,slaveof,sync etc), RedisShake is not working with AWS Elasticache. It's giving the error below.

2022/04/04 11:58:42 [PANIC] invalid psync response, continue, ERR unknown command `psync`, with args beginning with: `?`, `-1`, 
[stack]: 
    2   github.com/alibaba/RedisShake/redis-shake/common/utils.go:252
            github.com/alibaba/RedisShake/redis-shake/common.SendPSyncContinue
    1   github.com/alibaba/RedisShake/redis-shake/dbSync/syncBegin.go:51
            github.com/alibaba/RedisShake/redis-shake/dbSync.(*DbSyncer).sendPSyncCmd
    0   github.com/alibaba/RedisShake/redis-shake/dbSync/dbSyncer.go:113
            github.com/alibaba/RedisShake/redis-shake/dbSync.(*DbSyncer).Sync
        ... ...

I've tried rump for that matter, But it doesn't have enough stability to handle any important processes. First of all, it's not working as a background process, when the first sync finished, it's being closed with signal: exit done, so it will not be getting ongoing changes after the first finish.
Second of all, it's recognizing created/modified key/values in each run, for example, in first run key apple equals to pear, it's synced to the destination as is, but when I deleted the key apple and its value in source and ran the rump syncing script again, it's not being deleted in destination. So basically it's not literally syncing the source and the destination. Plus, last commit to the rump github repo is about 3 years ago. It seems a little bit outdated project to me.

After all this information and attempts, my question is, is there a way to sync two Elasticache for Redis instances, as I said, there is no room for downtime in my case. If you guys with this kind of experience have a bulletproof suggestion, I would be much appreciated. I tried but unfortunately didn't find any.

Thank you very much,

Best Regards.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

昇り龍 2025-01-25 19:24:00

redisshake 已经在这种情况下解释了:

Sync_reader是首选。 AWS ElasticAcce和MemoryDB不启用
默认情况下,Psync协议,但您可以请求启用Psync
协议通过提交票证。 AWS将提供更名的psync
票证中的命令,例如XHMA21YFKSSYNCnmfu2bl5osync
此命令具有与psync命令相同的效果,只有一个
不同的名称。用户只需要修改aws_psync
Redisshake配置文件中的配置项目。单一
实例,写一对ip:port@cmd。对于集群实例,
写入所有ip:port@cmd,由逗号分隔。

当不方便提交机票时,您可以使用scan_reader
应该注意的是,scan_reader将对
源数据库。

我建议您尝试提交支持票。

另外,您可以尝试启用 ksn support获得增量数据。

The document of RedisShake has already explained for this situation:

sync_reader is preferred. AWS ElastiCache and MemoryDB do not enable
the PSync protocol by default, but you can request to enable the PSync
protocol by submitting a ticket. AWS will provide a renamed PSync
command in the ticket, such as xhma21yfkssync and nmfu2bl5osync.
This command has the same effect as the psync command, just with a
different name. Users only need to modify the aws_psync
configuration item in the RedisShake configuration file. For a single
instance, write one pair of ip:port@cmd. For cluster instances,
write all ip:port@cmd, separated by commas.

When it is inconvenient to submit a ticket, you can use scan_reader.
It should be noted that scan_reader will put significant pressure on
the source database.

I recommend that you try submitting a support ticket.

Alternatively, you can try enabling KSN support in scan mode to obtain incremental data.

追我者格杀勿论 2025-01-25 19:24:00

如果这两个Elasticache Redis簇存在在同一帐户中,但区域不同,则可以考虑使用AWS Elasticache global-datastore。

它对区域,节点类型有一些限制节点等

。 https://docs.aws.amazon.com/amazonelastrastiche/latest/red-ug/redis-global-datastores-getting-started.html

否则,否则,您将有一种简单的蛮力机制,您将能够我相信自己编码。

  1. redis实例A创建客户端EC2(让我们调用此同步)pub-subl频道
  2. 从您的EC

。确保簇位于可连接的VPC中。
Elasticache仅适用于VPC中的资源。如果您的实例A和实例B在不同的VPC中,则必须对其进行凝视或通过TrystritGateway连接它们。

If those two Elasticache Redis clusters exist in the same account but different regions, you can consider using AWS Elasticache global-datastore.

It has some restrictions on the regions, type of nodes and that both the clusters should have same configurations in terms of number of nodes, etc.

Limitations - https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/Redis-Global-Datastores-Getting-Started.html

Otherwise, there's a simple brute-force mechanism and you would be able to code it yourself I believe.

  1. Create a client EC2 (let's call this Sync-er) pub-sub channel from your EC Redis instance A.
  2. Whenever there is a new data, Sync-er would make WRITE commands on EC Redis instance B.

NOTE - You'll have to make sure that the clusters are in connectable VPCs.
Elasticache is only available to the resources within the VPC. If your Instance A and Instance B are in different VPCs, you'll have to peer them or connect them via TransitGateway.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文