Obsolete:NFS

From Wikitech
This page contains historical information. It may be outdated or unreliable. 2010

pmtpa

/home

The server

A DRBD cluster of nfs1 and nfs2 serve NFS /home. (At most) one of the two is primary at any point in time, and can read and write from the block device /dev/drbd1. The (other) secondary host can not write nor read from the block device... so /home cannot be mounted from it while the host is secondary.

DRBD has excellent documentation, and repeating that here would be pointless. The most common administrative tasks are described here.

Status of DRBD resources can be found in /proc/drbd.

/etc/drbd.conf (must always be equal on both hosts):

# drbd.conf for replication between nfs1 and nfs2
# Written on 2009/11/23 by Mark Bergsma <mark@wikimedia.org>

global {
	usage-count no;
}

common {
	protocol C;
}

resource nfshome {
	syncer {
		rate 110M;
	}

	on nfs1 {
		device /dev/drbd1;
		disk /dev/mapper/mirror-nfshome;
		address 10.3.0.1:7789;
		meta-disk internal;
	}

	on nfs2 {
		device /dev/drbd1;
		disk /dev/mapper/mirror-nfshome;
		address 10.3.0.2:7789;
		meta-disk internal;
	}
}

The migration of NFS home off db20 onto nfs1/nfs2 was described extensively in the Db20 to NFS1-2 migration plan.

If the primary host goes down, the secondary can be promoted to primary. Use the following steps:

On the (failing?) primary (if accessible):

  • Stop nfs-kernel-server
  • Umount /home (so /dev/drbd1 is unused)
  • drbdadm secondary nfshome

On the secondary, to become the new primary host:

  • drbdadm primary nfshome
  • Mount /home (uncomment in /etc/fstab)
  • Start nfs-kernel-server
  • Then, migrate the service ip 10.0.5.8 to the appropriate host.

Clients

/etc/fstab entry:

10.0.5.8:/home  /home nfs     bg,soft,udp,rsize=8192,wsize=8192,timeo=14,intr,nfsvers=3  0 0

To mount /home on a server, include the class nfs::home in the Puppet node definition for that server, in site.pp. You probably also want to include some of admins::roots, admins::mortals and admins::restricted to get the associated user accounts.

Upload mounts:

amane:/export/upload  /mnt/upload3 nfs     bg,soft,udp,rsize=8192,wsize=8192,timeo=14,intr,nfsvers=3  0 0
storage1.wikimedia.org:/export/upload /mnt/upload4 nfs bg,soft,tcp,rsize=8192,wsize=8192,timeo=14 0 0

texvc output:

amane:/export/math  /mnt/math nfs     bg,soft,udp,rsize=8192,wsize=8192,timeo=14,intr,nfsvers=3  0 0