Mysql 主服务器的 Postgresql 从服务器。可能的?
我需要对从 Mysql 到 PostgreSql 的潜在迁移进行一些测试。 测试是否可以使用 Postgre 作为我的 MySQL master 的从属会更容易。
是否可以 ?
提前致谢
I need to make some tests for a potential migration from Mysql to PostgreSql.
It will be easier to test if it is possible to use Postgre as slave for my MySQL master.
Is it possible ?
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
不。
您可以使用触发器和外部进程来自己构建一些东西来发送数据,但这相当困难,因为 mysql 对触发器的支持相当有限。
对于您的场景,您最好定期转储数据。最好的方法通常是手动迁移架构,然后以 CSV 形式发送数据。 “mysqldump --兼容”通常工作得不够好。
No.
You can build something yourself using triggers and an external process to send data over, but it's fairly difficult since mysql has a rather limited support for triggers.
For your scenario you're likely to be better off doing periodic dumps of the data over. The best way is often to migrate the schema manually, and then send your data over as CSV. The "mysqldump --compatible" usually doesn't work well enough.
这是可能的。有点像。或许。
一种据称支持 MySQL 的解决方案 -> PostgreSQL 迁移是Continentt 的开源Tungsten Replicator。
您可以在此处查看有关如何实现此“异构复制”的一些说明 (尽管他们建议的使用 tungsten-installer 的方法已被弃用,您最好使用 tpm,例如 所以)。
事实是,虽然有很多 的 资源表明 Tungsten 确实用于支持这一点,官方似乎他们不再这样做了。这意味着,如果您尝试使用最新的 Tungsten Replicator 版本 (3.*),您很快就会发现 Postgres 所需的一些文件丢失了。
另一方面,如果您尝试下载较旧的版本(例如 2.2.1),则不会出现这些错误,并且所有文件似乎都存在,这留下了一些乐观的空间。
就我个人而言,我必须承认我也无法让 2.2.1 工作,但这可能更多地与我缺乏使用 Tungsten Replicator 的经验有关,而不是与 Postgres 支持有关。另外,在我的例子中,实时元素并不那么重要,所以我们最终只是运行一个 cron 作业 pgloader。
因此,如果从 MySQL 到 Postgres 的实时复制是您必须具备的功能,我建议您在开始实施自己的解决方案之前至少尝试一下 Tungsten Replicator。然而,如果实时不是绝对要求,可能还有更简单的方法。
(另外,你可能想看看 SymmetricDS ,它声称可以做类似的事情,尽管我还没有个人研究了一下。)
It is possible. Sort of. Maybe.
One solution that supposedly supports MySQL -> PostgreSQL migration is Continuent's open-source Tungsten Replicator.
You can see some instructions on how to implement this "Heterogeneous Replication" here (although the method they suggest, using tungsten-installer, is deprecated and you might be better off using tpm like so).
Thing is, while there are plenty of resources indicating Tungsten really did use to support this, officially it seems they no longer do. This means that if you try to use the most recent Tungsten Replicator version (3.*), you'll quickly find that some files needed for Postgres are missing.
If, on the other hand, you try to download an older version, say 2.2.1, none of those errors appear, and all the files seem to be present, which leaves some room for optimism.
Personally, I must admit I haven't been able to get 2.2.1 to work either, but this probably has more to do with my lack of experience using Tungsten Replicator in general, and not with Postgres support. Also, in my case the real-time element wasn't as important, so we just ended up going with a cron job running pgloader.
So, if real-time replication from MySQL to Postgres is something you must have, I'd recommend at least trying out Tungsten Replicator before you start implementing a solution of your own. However, if real-time isn't an absolute requirement, there are probably simpler ways.
(Also, you might want to have a look at SymmetricDS which claims to do something similar, though I haven't personally looked into it.)
我不这么认为,主从复制只能在相同的数据库之间进行。
您可以使用 PostgreSQL-SQL- 配置 MySQL模式,您还可以使用 --兼容 mysqldump 中的。
I don't think so, master-slave replication is only possible between same databases.
You could configure MySQL using the PostgreSQL-SQL-mode and you could also make a dump ready to import in Postgresql by using --compatible in mysqldump.
SymmetricDS 支持 MySQL 到 Postgres 的复制。有开源版本以及提供基于 Web 界面的专业版本。
SymmetricDS does support MySQL to Postgres replication. There is an open source version available as well as a professional version which provides a web based interface.