开发者

Postgresql slave for Mysql Master. Possible?

开发者 https://www.devze.com 2022-12-22 19:12 出处:网络
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.

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 ?

T开发者_JS百科hanks in advance


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.


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.)


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 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消