events: splitout a monitor_interfaces function in 10.interface
[tridge/ctdb.git] / web / nfs.html
1 <!--#set var="TITLE" value="CTDB and NFS" -->
2 <!--#include virtual="header.html" -->
3
4 <h1>Setting up clustered NFS</h1>
5
6 NFS v2/v3 has been successfully tested with exporting the same
7 data/network share from multiple nodes in a CTDB cluster with correct
8 file locking behaviour and lock recovery.<br><br>
9
10 Also see <a href="http://wiki.samba.org/index.php/CTDB_Setup#Setting_up_CTDB_for_clustered_NFS">Configuring
11 NFS for CTDB clustering</a> at samba.org for additional information.
12
13 <h2>Prereqs</h2>
14 Configure CTDB as above and set it up to use public ipaddresses.<br>
15 Verify that the CTDB cluster works.
16
17 <h2>/etc/exports</h2>
18
19 Export the same directory from all nodes.<br>
20 Make sure to specify the fsid export option so that all nodes will present the same fsid to clients.<br>
21
22 Clients can get "upset" if the fsid on a mount suddenly changes.<br>
23 Example /etc/exports :
24 <pre>
25   /gpfs0/data *(rw,fsid=1235)
26 </pre>
27
28 <h2>/etc/sysconfig/nfs</h2>
29
30 This file must be edited to point statd to keep its state directory on 
31 shared storage instead of in a local directory.<br><br>
32
33 We must also make statd use a fixed port to listen on that is the same for 
34 all nodes in the cluster.<br>
35
36 If we don't specify a fixed port, the statd port will change during failover 
37 which causes problems on some clients.<br>
38 (some clients are very slow to realize when the port has changed)<br><br>
39
40 This file should look something like :
41 <pre>
42   NFS_TICKLE_SHARED_DIRECTORY=/gpfs0/nfs-tickles
43   STATD_SHARED_DIRECTORY=/gpfs0/nfs-state
44   NFS_HOSTNAME=ctdb
45   STATD_PORT=595
46   STATD_OUTGOING_PORT=596
47   MOUNTD_PORT=597
48   RQUOTAD_PORT=598
49   LOCKD_TCPPORT=599
50   LOCKD_UDPPORT=599
51   STATD_HOSTNAME="$NFS_HOSTNAME -H /etc/ctdb/statd-callout -p 97"
52   RPCNFSDARGS="-N 4"
53
54 </pre>
55
56 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>
57 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>
58
59 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>
60
61 This directory must be stored on the shared cluster filesystem so that all nodes can access the same data.<br><br>
62
63 Don't forget to create this directory:
64 <pre>
65   mkdir /gpfs0/nfs-state
66 </pre>
67
68 NFS_TICKLE_SHARED_DIRECTORY is where ctdb will store information about which
69 clients have established tcp connections to the cluster. This information
70 is used during failover of ip addresses.
71 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>
72 The reason to do this is to improve the speed at which a client will detect
73 that the tcp connection for NFS needs to be reestablished and to speed up
74 recovery in the client.<br>
75
76 NFS_HOSTNAME is the dns name for the ctdb cluster and which is used when clients map nfs shares. This name must be in DNS and resolve back into the public ip addresses of the cluster.<br>
77 Always use the same name here as you use for the samba hostname.
78
79 RPCNFSDARGS is used to disable support for NFSv4 which is not yet supported by CTDB.
80
81 <h2>/etc/sysconfig/ctdb</h2>
82 Add the following line to /etc/sysconfig/ctdb :
83
84 <pre>
85   CTDB_MANAGES_NFS=yes
86 </pre>
87 The CTDB_MANAGES_NFS line tells the events scripts that CTDB is to manage startup and shutdown of the NFS and NFSLOCK services.<br>
88
89 With this set to yes, CTDB will start/stop/restart these services as required.<br><br>
90
91
92 <h2>chkconfig</h2>
93
94 Since CTDB will manage and start/stop/restart the nfs and the nfslock services, you must disable them using chkconfig.
95 <pre>
96   chkconfig nfs off
97   chkconfig nfslock off
98 </pre>
99
100
101 <h2>Event scripts</h2>
102
103 CTDB clustering for NFS relies on two event scripts /etc/ctdb/events.d/60.nfs and /etc/ctdb/events.d/61.nfstickle.<br>
104
105 These two scripts are provided by the RPM package and there should not be any need to change them.
106
107 <h2><strong>IMPORTANT</strong></h2>
108
109 Never ever mount the same nfs share on a client from two different nodes in the cluster at the same time!<br><br>
110
111 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.
112
113
114 <!--#include virtual="footer.html" -->
115