In this case, you can possibly get away with just one DRBD share (resource) for multiple applications. The basic idea is that you have a DRBD share on which you put all your data (not normally binaries or other system files). Let's assume Apache, for example. You might opt for a 'high availability' mountpoint /ha/web. This will be shared across both nodes with DRBD but remember that only the primary node can mount it; you can't have it mounted on both nodes at the same time.
A typical, simple DRBD config for this would look like:
TODO: typical active/passive DRBD config
You would configure Apache with all the websites having document roots under this share, e.g. you might have:
|-/ha
|--- web
|----- client1
|----- client2
snippet from Apache config:
ServerName client1.example.com
DocumentRoot /ha/web/client1
...
ServerName client2.example.com
DocumentRoot /ha/web/client2
...
Setting up heartbeat isn't difficult but there are two steps you need to be aware of:
running the 'drbddisk' script, which triggers DRBD to make the current node primary for the given resource
actually mounting the filesystem
Here's a typical, simple, snippet from haresources showing an active/passive configuration. In this case, node1 is the default primary, and there is a "floating" IP address 192.168.0.1:
node1 drbddisk::web Filesystem::/dev/drbd0::/mnt/ha::ext3 192.168.0.1 httpd
Note the order in which the resources are started. drbddisk needs to go first, since it configures DRBD to be primary. Mounting the filesystem is next, and actually running Apache is last. Setting up the network IP obviously needs to happen at some point before Apache starts.
drbddisk was datadisk in drbd-0.6.x.
web above (the parameter to datadisk or drbddisk) is the resource name you chose for the resource section in drbd.conf, not the device (unless you chose to give your resources device names...)
With several resources, it has to be written like
castor 10.0.0.30 drbddisk::r0 drbddisk::r1 \
Filesystem::/dev/drbd0::/crypt::xfs \
Filesystem::/dev/drbd1::/data::xfs \
samba nfs-kernel-server
No comments:
Post a Comment