Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

we are planing to use drbd to sync two servers (different hardware) to get kind of HA in case the master server dies. The servers are hosted physically in the same datacenter (Hetzner in germany) and they are running with openSUSE.

The main purpose of the servers is to host print-on-demand stuff and render or generate pdf.

We want to sync the "/var/www" folder as well as the database which stores at the default folder at the moment.

My plan is to move these folders to the drbd synced partition and link them via "ln" back to where they used to be. Or is it better to do the other way round? Or sync the Database via replication?

The main problem is, that we just have 100mbit uplink at each server, and I dont know if it is enough to sync the servers in drbd-mode C.

Maybe some of you have any advice or experience you want to share with me.

PS: I don't have the servers yet, I am just planing if everything would work.

edit: I got the drbd sync process running now, syncronizing /dev/drbd0 mounted to /srv/drbd on the primary node. I have linked (ln) the folder /srv/drbd/vhosts, containing my websites, back to /srv/www/ but always get error 404 errors in my browser. Is this just a chown problem?

At the moment I am trying to configure corosync/pacemaker via crm, but I can’t get all primitives running. Here is my config, maybe someone of you can figure out why it won't start.

Last updated: Mon Aug  5 16:37:54 2013
Last change: Mon Aug  5 16:37:32 2013 by root via cibadmin on alice
Stack: openais
Current DC: alice - partition with quorum
Version: 1.1.7-61a079313275f3e9d0e85671f62c721d32ce3563
2 Nodes configured, 2 expected votes
5 Resources configured.

Online: [ bob alice ]

 Master/Slave Set: DRBD_MS [DRBD]
     Masters: [ alice ]
     Slaves: [ bob ]
 Resource Group: APACHE_IP
     APACHE (ocf::heartbeat:apache):    Started bob
     failover-ip    (ocf::heartbeat:IPaddr2):   Stopped 

Failed actions:
    failover-ip_start_0 (node=alice, call=57, rc=1, status=complete): unknown error
    DRBD_FS_monitor_0 (node=alice, call=60, rc=5, status=complete): not installed
    APACHE_monitor_15000 (node=bob, call=49, rc=7, status=complete): not running
    failover-ip_start_0 (node=bob, call=57, rc=1, status=complete): unknown error
    DRBD_FS_monitor_0 (node=bob, call=59, rc=5, status=complete): not installed

my cib.xml looks like:

node alice
node bob
primitive APACHE ocf:heartbeat:apache \
    params configfile="/etc/apache2/httpd.conf" \
    op monitor interval="15s"
primitive DRBD ocf:linbit:drbd \
    params drbd_resource="r0" \
    op monitor interval="120s"
primitive DRBD_FS ocf:heartbeat:Filesystem \
    params device="/dev/drbd0" directory="/srv/drbd" fstype="ext4" \
    meta target-role="Started"
primitive failover-ip ocf:heartbeat:IPaddr2 \
    params ip="123.456.789.101" nic="net0:0" \
    op monitor interval="10s" \
    meta is-managed="true" target-role="Started"
group APACHE_IP APACHE failover-ip \
    meta target-role="Started"
    meta master-max="1" master-node-max="1" clone-max="2" clone-node-max="1" notify="true" target-role="Started"
colocation FS_ON_DRBD inf: DRBD_FS DRBD_MS:Master
order FS_AFTER_DRBD inf: DRBD_MS:promote DRBD_FS:start
property $id="cib-bootstrap-options" \
    dc-version="1.1.7-61a079313275f3e9d0e85671f62c721d32ce3563" \
    cluster-infrastructure="openais" \
    expected-quorum-votes="2" \
    stonith-enabled="false" \
    no-quorum-policy="ignore" \
rsc_defaults $id="rsc-options" \
share|improve this question

Syncing /var/www with DRBD should be fine. Those files probably don't change too much.

However, I would not recommend using DRBD to sync the database files. I would instead use MySQL's built-in replication features.

share|improve this answer

The only way you can use DRBD with MySQL is if ALL YOUR DATA IS INNODB !!! Why ?

InnoDB Architecture

InnoDB Architecture

InnoDB is designed to handle crash recovery and cache all 16KB block changes in the double write buffer of the system tablespace, provided you configure innodb_flush_method as O_DIRECT. If this were mounted on DRBD, any automatic failovers will not lose data that is recorded in the double write buffer. It will require crash recovery time for mysql when you failover to the DRBD Secondary and promote it as the new DRBD Primary.

On the other hand, MyISAM tables cannot handle automatic failovers due to crashes. Why? MyISAM tables are marked as crashed simply because of the file handle count in its header. It should be zero for the MyISAM table to be fine. A server or mysql crash can leave any open MyISAM table in need of a repair table opertion. While an automatic table repair can be configured in my.cnf, there is the string likelihoodwill be data loss (and possible data inconsistency) after such repairs. This is the nature of a non-transactional storage engine.

I support MySQL/DRBD setups for my employer and I always recommend using an all-InnoDB Database for DRBD setups.

As far as the connectivity between the DRBD pair, you should not let the DRBD traffic pass through switches or firewalls. Use a dedicated NIC on each server (usingthe 192.168.1.x netblock) and a crossover cable to shorten DRBD communication. WARNING: Packet loss is possible for worn-out cables.


If you have a mix of InnoDB tables and any read-only MyISAM tables, that could be acceptable in a DRBD setup. In that instance, table repairs on MyISAM tables would not that much of a problem if you can love with the increased mysql startup time.

share|improve this answer
Thank you guys so far. Anyone some experience with 100mbit lan? @ RolandoMySQLLDBA: we already use INNODB, thanks! But i think I'll give mysql replication a try! – Jul 19 '13 at 8:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.