本文介绍了如何将Elasticache Redis集群设置为从属?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据Elasticache手册,SLAVEOF命令仅限于AWS缓存节点.

According to Elasticache manual, the SLAVEOF command is restricted for AWS cache nodes.

总有没有将现有的Elasticache节点设置为从节点,以便可以将现有的Redis集群迁移到AWS上?

Is there anyway to set an existing Elasticache node as a slave so that I can migrate my existing redis cluster over to AWS?

推荐答案

正如您所发现的, Elasticache不支持SLAVEOF命令,因此您不能简单地将Elasticache节点添加到现有群集中,然后将其升级到主节点/关闭现有群集.

As you've spotted, Elasticache doesn't support the SLAVEOF command so you can't simply add an Elasticache node to your existing cluster and then promote it to the primary node/switch off your existing cluster.

相反,要迁移Redis群集,您应该使用 BGSAVE 保存 来生成 .rdb 快照文件.

Instead, to migrate your Redis cluster you should create a snapshot by using either BGSAVE or SAVE to produce a .rdb snapshot file.

然后您应该将此快照文件上传到S3,并允许Elasticache访问该文件:

You should then upload this snapshot file to S3 and allow Elasticache access to the file:

  1. 登录到AWS管理控制台并打开Amazon S3控制台在 https://console.aws.amazon.com/s3/.

单击所有存储桶,然后单击Amazon S3存储桶的名称包含您的.rdb文件.

Click All Buckets, and then click the name of the Amazon S3 bucket that contains your .rdb file.

单击包含.rdb文件的文件夹的名称.

Click the name of the folder that contains your .rdb file.

单击您的.rdb文件的名称,单击操作"下拉菜单,然后选择属性.

Click the name of your .rdb file, click the Actions drop-down menu, and then select Properties.

单击权限",然后单击添加更多权限".

Click Permissions, and then click Add more permissions.

在受让人"框中,键入以下电子邮件地址:aws-scs-s3-readonly@amazon.com.

In the Grantee box, type this email address: aws-scs-s3-readonly@amazon.com.

  1. 单击打开/下载",然后单击保存".

此后,只需创建一个新的Redis支持的Elasticache群集,并在配置部分中应指定快照文件的S3位置.

After this, simply create a new Redis backed Elasticache cluster and in the configuration section you should specify the S3 location of your snapshot file.

这将使用从快照中获取的现有群集的数据为新的Elasticache群集播种,但是显然,您仍然必须处理停机时间,数据丢失,或者您必须找到一种将AOF日志重播到Elasticache中的方法使用类似 aof-replay工具的集群.

This will seed your new Elasticache cluster with your existing cluster's data taken from the snapshot but obviously you will still have to deal with either downtime, data loss or you would have to work out a way to replay the AOF log into the Elasticache cluster using something like this aof-replay tool.

此处.

这篇关于如何将Elasticache Redis集群设置为从属?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 04:18