How to migrate data from mySQL to PostgreSQL?

How well does DRBD (Distributed Replicated Block Device) work with either MySQL or PostgreSQL?

  • http://dev.mysql.com/doc/refman/5.5/en/ha-drbd.html I have used DRBD as part of a data store for but I just saw a data store setup using it. Clearly, a good use for fail-over, but doesn't replication provide the same protection?

  • Answer:

    This page has a good writeup. http://www.patriceguay.com/webhosting/database-server-clustering A consequence of mirroring data at the block device level is that you can only access your data on the active node. This is caused by the nature of most Linux file systems (ext3, ext4, XFS, JFS, etc). These file systems do not support multiple servers accessing the same shared disk for read and write operations. Their design only allow one server accessing each disk. As a consequence, the performance of a MySQL DRBD cluster is roughly equal to the performance of a single MySQL server. DRBD provides high availability but no performance enhancement for a MySQL database service.

Hiroshi Ono at Quora Visit the source

Was this solution helpful to you?

Other answers

DRBD is not for every kind of MySQL setup. If all your tables are MyISAM and a failover occurs, chances are there will be marked as crash when the old DRBD Secondary becomes the new DRBD Primary. Any MyISAM tables that were just reads only would be fine in most cases but may still need a REPAIR TABLE command run against it to clean up it header info, If all your tables are InnoDB and a failover occurs, you will have to be patient while mysql on the new DRBD Primary performs InnoDB Crash Recovery to bring all tables back to a consistent state. How long you wait depends on how many tables were open, how many transactions have to be rolled back or committed. Other than waiting for Crash Recovery, DRBD is reliable for an all InnoDB Setups.

Rolando Angel Edwards

DRBD is great for an active/passive setup regardless of what you are running on top of it.  It was a common approach with PostgreSQL prior to replication having first class status in the project and still helpful for file servers and other things that don't support an active/active configuration. If you can have a replication slave instead there is no reason to use DRBD.  I greatly prefer active/active failover setup as they are easier to verify and feel good about.

Joe Uhl

DRBD is the right tools to just fool yourself. It gives you a false feeling of security in most case. The problem lies in the degraded mode. An exemple to understand the problem. We have two servers with DRBD in C protocol (full sync to disk): A is the master, B is the slave. Data are accessed only on A. B is the backup. An incident happens on the server A and it lost his connectivity to B, but everything else works. Data is no more replicated on B.  AND A continues to serve new transactions in DEGRADED mode. Next, the incident gets really bad and the A server dies. We can not recover the server A, and we can not switch to B because there are few transactions in A that was not sync with B. Conclusion: If you allow a degraded mode, you fool yourself. If your replication solution (other than DRBD) does not have a degraded mode, the safety of your data is better, but the availability of the cluster is worst. Because, as soon as one of the two servers has a problem, the service shuts down. In PostgreSQL, if you use synchronous replication, there is not degraded mode. The data are safe, but the availability is down. You need to use a third server to have a better availability.

Jean-Gérard Pailloncy

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.