Setting Up A Highly Available NFS Server - Page 2
4 Install NFS Server
Next we install the NFS server on both server1 and server2:
apt-get install nfs-kernel-server
Then we remove the system bootup links for NFS because NFS will be started and controlled by heartbeat in our setup:
update-rc.d -f nfs-kernel-server remove
We want to export the directory /data/export (i.e., this will be our NFS share that our web server cluster nodes will use to serve web content), so we edit /etc/exports on server1 and server2. It should contain only the following line:
This means that /data/export will be accessible by all systems from the 192.168.0.x subnet. You can limit access to a single system by using 192.168.0.100/255.255.255.255 instead of 192.168.0.0/255.255.255.0, for example. See
man 5 exports
to learn more about this.
Later in this tutorial we will create /data/exports on our empty (and still unmounted!) partition /dev/sda8.
5 Install DRBD
Next we install DRBD on both server1 and server2:
apt-get install kernel-headers-2.6.8-2-386 drbd0.7-module-source drbd0.7-utils
Then edit /etc/drbd.conf on server1 and server2. It must be identical on both systems and looks like this:
As resource name you can use whatever you like. Here it's r0. Please make sure you put the correct hostnames of server1 and server2 into /etc/drbd.conf. DRBD expects the hostnames as they are shown by the command
If you have set server1 and server2 respectively as hostnames during the basic Debian installation, then the output of uname -n should be server1 and server2.
Also make sure you replace the IP addresses and the disks appropriately. If you use /dev/hda instead of /dev/sda, please put /dev/hda8 instead of /dev/sda8 into /etc/drbd.conf (the same goes for the meta-disk where DRBD stores its meta data). /dev/sda8 (or /dev/hda8...) will be used as our NFS share later on.