如何将数据从 Postgres 移动到在 Amazon RDS 上运行的 MySQL?
我需要将具有 Django 架构的数据库从 Postgres 移动到 MySQL,在 Amazon 的 RDF 上运行。我可以使用 manage.py 重新生成表,但我仍在寻找一种迁移所有行数据的方法。有谁知道将其转移的干净方法吗? Amazon 的 RDF 有什么需要注意的问题吗?
I need to move a database with a Django schema from Postgres to MySQL, running on Amazon's RDF. I can re-generate the tables using manage.py, but I'm still looking for a way to migrate over all of the row data. Does anyone know a clean way of moving it over? Are there any gotchas to watch out for with Amazon's RDF?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Django 还有 dumpdata 和 loaddata 中的命令。 MySQL 中的进程是
Django also has the dumpdata and loaddata commands in manage.py. Process would be
如果您备份 Postgresql 数据库并选择“插入命令”选项,您最终将得到一个包含 SQL 插入语句的文本文件,理论上您可以针对不同的 SQL 数据库(在本例中为 MySQL)运行该文本文件。实际上,这取决于您使用的数据库类型,因为并非所有 Postgresql 和 MySQL 数据类型都直接相互映射。
对我来说,Amazon RDS 的一个问题是,每周有 4 小时的时间需要关闭数据库以进行修补和维护。关系数据库的难点在于使它们具有复制和集群的容错能力。目前,Amazon 的 RDS 并没有解决这两个问题,看起来它只是使用 EC2 实例来托管 MySQL 服务器,而这在很长一段时间内无需 RDS 就可以做到。
就我个人而言,我喜欢 RDS 的发展方向,并期待有一天我可以将关系数据库视为黑匣子,而不必担心容错性和可扩展性,就像现在的 Amazon SimpleDB 产品一样。
If you backup your Postgresql database and choose the "Insert Commands" option you will end up with a text file of SQL insert statements that in theory you can run against a different SQL database, in this case MySQL. In practice it's going to depend on the database types that you are using since not all Postgresql and MySQL data types map directly to each other.
The gotcha for me with Amazon's RDS is the statement that there will be a 4 hour window each week where the database needs to be taken down for patching and maintenance. The hard thing with relational databases is making them fault tolerant with replication and clustering. At the moment Amazon's RDS doesn't solve either of those issues and looks like it's simply using an EC2 instance to host a MySQL server which is something that's been possible to do for a long time without RDS.
Personally I love the direction RDS is heading though and look forward to the day I can treat a relational database as a black box and not have to worry about fault tolerance and scalability, like the Amazon SimpleDB product is now.