如何使用RDS复制数据库

时间:2021-09-19 21:07:55

I have a database instance on RDS with 2 databases on it. Is there a good way using the RDS command line tools to copy the one database to the other? If not, what is the recommended way of doing it?

我在RDS上有一个数据库实例,上面有2个数据库。是否有一种使用RDS命令行工具将一个数据库复制到另一个数据库的好方法?如果没有,建议的方法是什么?

Thanks in advance.

提前致谢。

3 个解决方案

#1


7  

I'd use mysqldump to get the tables and then mysql to import them.

我使用mysqldump获取表,然后使用mysql导入它们。


Update 2014/07/08: Depending on what you're planning to do here, another solution today is to setup replication and then to promote the slave to be the master. That is for example if you want to update your database's release/version: http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ReadRepl.html

更新2014/07/08:根据您计划在此处执行的操作,今天的另一个解决方案是设置复制,然后将从属服务器提升为主服务器。例如,如果您想更新数据库的版本/版本:http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ReadRepl.html

If you're looking to backup externally, there's also replication: http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/MySQL.Procedural.Exporting.NonRDSRepl.html

如果你想在外部备份,还有复制:http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/MySQL.Procedural.Exporting.NonRDSRepl.html

RDS has come a long way.

RDS已经走过了漫长的道路。

#2


17  

This is not an exact solution to the OP, but if all you need is to clone an existing database for a new purpose, there's an easier way. You can take a snapshot from the original RDS instance, then restore it to a new instance. You can even use the web console.

这不是OP的精确解决方案,但如果您只需要为新目的克隆现有数据库,则可以采用更简单的方法。您可以从原始RDS实例获取快照,然后将其还原到新实例。您甚至可以使用Web控制台。

#3


9  

it depends on which database you are hosting there - for SQL Server I have used the SQL Azure Migration wizard (free download from CodePlex).

这取决于您在哪里托管数据库 - 对于SQL Server,我使用了SQL Azure迁移向导(从CodePlex免费下载)。

To get full RDBMS functionality the trick is to use the DNS name of your SQL Server instance in the wizard, but select 'SQL Server v2008' (or eventually v2012 after AWS RDS makes instances with 2012 available) and do NOT select to-->'SQL Azure'. I did a short screencast on this on my blog as well.

要获得完整的RDBMS功能,诀窍是在向导中使用SQL Server实例的DNS名称,但选择“SQL Server v2008”(或最终在AWS RDS使2012年的实例可用后的v2012)并且不要选择 - > 'SQL Azure'。我也在博客上做了一个简短的截屏视频。

#1


7  

I'd use mysqldump to get the tables and then mysql to import them.

我使用mysqldump获取表,然后使用mysql导入它们。


Update 2014/07/08: Depending on what you're planning to do here, another solution today is to setup replication and then to promote the slave to be the master. That is for example if you want to update your database's release/version: http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ReadRepl.html

更新2014/07/08:根据您计划在此处执行的操作,今天的另一个解决方案是设置复制,然后将从属服务器提升为主服务器。例如,如果您想更新数据库的版本/版本:http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ReadRepl.html

If you're looking to backup externally, there's also replication: http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/MySQL.Procedural.Exporting.NonRDSRepl.html

如果你想在外部备份,还有复制:http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/MySQL.Procedural.Exporting.NonRDSRepl.html

RDS has come a long way.

RDS已经走过了漫长的道路。

#2


17  

This is not an exact solution to the OP, but if all you need is to clone an existing database for a new purpose, there's an easier way. You can take a snapshot from the original RDS instance, then restore it to a new instance. You can even use the web console.

这不是OP的精确解决方案,但如果您只需要为新目的克隆现有数据库,则可以采用更简单的方法。您可以从原始RDS实例获取快照,然后将其还原到新实例。您甚至可以使用Web控制台。

#3


9  

it depends on which database you are hosting there - for SQL Server I have used the SQL Azure Migration wizard (free download from CodePlex).

这取决于您在哪里托管数据库 - 对于SQL Server,我使用了SQL Azure迁移向导(从CodePlex免费下载)。

To get full RDBMS functionality the trick is to use the DNS name of your SQL Server instance in the wizard, but select 'SQL Server v2008' (or eventually v2012 after AWS RDS makes instances with 2012 available) and do NOT select to-->'SQL Azure'. I did a short screencast on this on my blog as well.

要获得完整的RDBMS功能,诀窍是在向导中使用SQL Server实例的DNS名称,但选择“SQL Server v2008”(或最终在AWS RDS使2012年的实例可用后的v2012)并且不要选择 - > 'SQL Azure'。我也在博客上做了一个简短的截屏视频。