NFS

From Wikitech
(Difference between revisions)
Jump to: navigation, search
(update)
(recat)
 
(12 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{Document me}}
 
 
 
== pmtpa ==
 
== pmtpa ==
  
Required for all machines:
+
=== /home ===
* /home
+
** [[suda]] (in guise of "izwinger" since february 2006)
+
** Not mounted on [[amane]]
+
  
Required for apaches and others dealing with file data:
+
==== The server ====
* /mnt/upload3
+
** [[amane]]
+
* /mnt/math
+
** [[amane]]
+
  
Required for [[backup]]-dump work:
+
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.
* /mnt/benet
+
** [[benet]]
+
  
== yaseo ==
+
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].
  
{{fixme|Add info here}}
+
Status of DRBD resources can be found in <tt>/proc/drbd</tt>.
  
== knams ==
+
<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>
  
{{fixme|Add info here}}
+
global {
 +
usage-count no;
 +
}
  
 +
common {
 +
protocol C;
 +
}
  
== Old stuff ==
+
resource nfshome {
 +
syncer {
 +
rate 110M;
 +
}
  
{{fixme|How accurate is this info?}}
+
on nfs1 {
 +
device /dev/drbd1;
 +
disk /dev/mapper/mirror-nfshome;
 +
address 10.3.0.1:7789;
 +
meta-disk internal;
 +
}
  
 
+
on nfs2 {
<pre>
+
device /dev/drbd1;
zwinger.wikimedia.org:/home    /home                  nfs    defaults      0 0
+
disk /dev/mapper/mirror-nfshome;
</pre>
+
address 10.3.0.2:7789;
vs.
+
meta-disk internal;
<pre>
+
}
zwinger.wikimedia.org:/home  /home  nfs  bg,soft,tcp,rsize=8192,wsize=8192,timeo=14,nfsvers=3 0 0
+
}
 
</pre>
 
</pre>
  
* use version 3! Version 2 breaks > 2GB file access in some cases.
+
The migration of NFS home off db20 onto nfs1/nfs2 was described extensively in the [[Db20 to NFS1-2 migration plan]].
* bg - system can boot without mounting it - will retry in background
+
 
* soft - return I/O error to caller on major NFS timeout instead of retrying indefinitely
+
If the primary host goes down, the secondary can be promoted to primary. Use the following steps:
* tcp - use tcp instead of the default of udp - ''Why?'' [http://nfs.sourceforge.net/nfs-howto/performance.html#NFS-TCP because this ?]
+
 
* rsize, wsize of 8192 - better throughput (ike)
+
'''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
  
It seems that explicit version 2 breaks > 2GB file access, but implicit (default) version 2 does not. Need to do a bit more checking to see if it's not some of the other options causing it.
+
To mount <tt>/home</tt> on a server, include the class <tt>nfs::home</tt> in the Puppet node definition for that server, in <tt>site.pp</tt>. You probably also want to include some of <tt>admins::roots</tt>, <tt>admins::mortals</tt> and <tt>admins::restricted</tt> to get the associated user accounts.
  
== Current NFS servers ==
+
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
  
* [[zwinger]]: /home, math images
+
texvc output:
* [[albert]]: most images
+
amane:/export/math  /mnt/math nfs    bg,soft,udp,rsize=8192,wsize=8192,timeo=14,intr,nfsvers=3  0 0
* [[khaldun]]: some images
+
  
[[Category:Software]]
+
[[Category:Current]]

Latest revision as of 00:08, 21 February 2012

Contents

[edit] pmtpa

[edit] /home

[edit] 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.

[edit] 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
Personal tools
Namespaces

Variants
Actions
Navigation
Ops documentation
Wiki
Toolbox