summaryrefslogtreecommitdiff
path: root/ctdb/web/nfs.html
blob: 9e23af2cbeda578db25d1f6b2ae9f27a712fdee9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<!--#set var="TITLE" value="CTDB and NFS" -->
<!--#include virtual="header.html" -->

<h1>Setting up clustered NFS</h1>

NFS v2/v3 has been successfully tested with exporting the same
data/network share from multiple nodes in a CTDB cluster with correct
file locking behaviour and lock recovery.<br><br>

Also see <a href="http://wiki.samba.org/index.php/CTDB_Setup#Setting_up_CTDB_for_clustered_NFS">Configuring
NFS for CTDB clustering</a> at samba.org for additional information.

<h2>Prereqs</h2>
Configure CTDB as above and set it up to use public ipaddresses.<br>
Verify that the CTDB cluster works.

<h2>/etc/exports</h2>

Export the same directory from all nodes.<br>
Make sure to specify the fsid export option so that all nodes will present the same fsid to clients.<br>

Clients can get "upset" if the fsid on a mount suddenly changes.<br>
Example /etc/exports :
<pre>
  /gpfs0/data *(rw,fsid=1235)
</pre>

<h2>/etc/sysconfig/nfs</h2>

This file must be edited to point statd to keep its state directory on 
shared storage instead of in a local directory.<br><br>

We must also make statd use a fixed port to listen on that is the same for 
all nodes in the cluster.<br>

If we don't specify a fixed port, the statd port will change during failover 
which causes problems on some clients.<br>
(some clients are very slow to realize when the port has changed)<br><br>

This file should look something like :
<pre>
  CTDB_MANAGES_NFS=yes
  NFS_TICKLE_SHARED_DIRECTORY=/gpfs0/nfs-tickles
  STATD_PORT=595
  STATD_OUTGOING_PORT=596
  MOUNTD_PORT=597
  RQUOTAD_PORT=598
  LOCKD_TCPPORT=599
  LOCKD_UDPPORT=599
  STATD_SHARED_DIRECTORY=/gpfs0/nfs-state
  PUBLIC_IP=`ctdb publicip 2>/dev/null`
  [ -z "$PUBLIC_IP" ] || {
    STATD_HOSTNAME="ctdb -P "$STATD_SHARED_DIRECTORY/$PUBLIC_IP" -H /etc/ctdb/statd-callout -p 97"
  }
</pre>

The CTDB_MANAGES_NFS line tells the events scripts that CTDB is to manage startup and shutdown of the NFS and NFSLOCK services.<br>

With this set to yes, CTDB will start/stop/restart these services as required.<br><br>

You need to make sure that the lock manager runs on the same port on all nodes in the cluster since some clients will have "issues" and take very long to recover if the port suddenly changes.<br>
599 above is only an example. You can run the lock manager on any available port as long as you use the same port on all nodes.<br><br>

STATD_SHARED_DIRECTORY is the shared directory where statd and the statd-callout script expects that the state variables and lists of clients to notify are found.<br>

This directory must be stored on the shared cluster filesystem so that all nodes can access the same data.<br><br>

Don't forget to create this directory:
<pre>
  mkdir /gpfs0/nfs-state
</pre>

NFS_TICKLE_SHARED_DIRECTORY is where ctdb will store information about which
clients have established tcp connections to the cluster. This information
is used during failover of ip addresses.
This allows the node that takes over an ip address to very quickly 'tickle' and reset any tcp connections for the ip address it took over.<br>
The reason to do this is to improve the speed at which a client will detect
that the tcp connection for NFS needs to be reestablished and to speed up
recovery in the client.<br>

<h2>chkconfig</h2>

Since CTDB will manage and start/stop/restart the nfs and the nfslock services, you must disable them using chkconfig.
<pre>
  chkconfig nfs off
  chkconfig nfslock off
</pre>


<h2>Event scripts</h2>

CTDB clustering for NFS relies on two event scripts /etc/ctdb/events.d/60.nfs and /etc/ctdb/events.d/61.nfstickle.<br>

These two scripts are provided by the RPM package and there should not be any need to change them.

<h2><strong>IMPORTANT</strong></h2>

Never ever mount the same nfs share on a client from two different nodes in the cluster at the same time!<br><br>

The client side caching in NFS is very fragile and assumes/relies on that an object can only be accessed through one single path at a time.


<!--#include virtual="footer.html" -->