NFS

From Wikitech
(Difference between revisions)
Jump to: navigation, search
(docs on DRBD setup)
Line 1: Line 1:
 
== pmtpa ==
 
== pmtpa ==
  
/home, useful for apaches,  
+
=== /home ===
 +
 
 +
==== The server ====
 +
 
 +
A [http://www.drbd.org 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 <tt>/dev/drbd1</tt>. 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 [http://www.drbd.org/docs/about/ documentation], and repeating that here would be pointless. The most common administrative tasks are described [http://www.drbd.org/docs/working/ here].
 +
 
 +
<tt>/etc/drbd.conf</tt> (must always be equal on both hosts):
 +
<pre>
 +
# 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;
 +
}
 +
}
 +
</pre>
 +
 
 +
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 <tt>/dev/drbd1</tt> is unused)
 +
* drbdadm secondary nfshome
 +
 
 +
'''On the secondary, to become the new primary host:'''
 +
 
 +
* drbdadm primary nfshome
 +
* Mount /home (uncomment in <tt>/etc/fstab</tt>)
 +
* Start nfs-kernel-server
 +
 
 +
* Then, migrate the service ip <tt>10.0.5.8</tt> to the appropriate host.
 +
 
 +
==== Clients ====
 +
 
 +
<tt>/etc/fstab</tt> entry:
 +
 
  10.0.5.8:/home  /home nfs    bg,soft,udp,rsize=8192,wsize=8192,timeo=14,intr,nfsvers=3  0 0
 
  10.0.5.8:/home  /home nfs    bg,soft,udp,rsize=8192,wsize=8192,timeo=14,intr,nfsvers=3  0 0
  
Line 22: Line 85:
  
 
[[Category:Current]]
 
[[Category:Current]]
 +
[[Category:NFS]]

Revision as of 20:26, 23 November 2009

Contents

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.

/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

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


yaseo

No NFS anymore.

knams

Probably none. None on the squids anyway.

Personal tools
Namespaces

Variants
Actions
Navigation
Ops documentation
Wiki
Toolbox