如何将数据从 Postgres 移动到在 Amazon RDS 上运行的 MySQL?

发布于 2024-08-10 03:35:23 字数 216 浏览 4 评论 0原文

我需要将具有 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 技术交流群。

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

发布评论

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

评论(2

我ぃ本無心為│何有愛 2024-08-17 03:35:23

Django 还有 dumpdataloaddata 中的命令。 MySQL 中的进程是

  1. syncdb,用于准备来自 PostgreSQL 的
  2. dumpdata将上一个命令的数据加载到新的 MySQL 实例中

Django also has the dumpdata and loaddata commands in manage.py. Process would be

  1. syncdb in MySQL to prepare the tables
  2. dumpdata from PostgreSQL
  3. loaddata from the previous command into the new MySQL instance
や三分注定 2024-08-17 03:35:23

如果您备份 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.

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