is using via the nfsstat command:
% nfsstat -m
...
/budget_stats from hamilton,wolcott,dexter:/export/budget_stats
Flags:
vers=3,proto=tcp,sec=sys,hard,intr,llock,link,symlink,acl,rsize=32768,wsize=32768,
retrans=5
Failover:noresponse=1, failover=1, remap=1, currserver=wolcott
The currserver value tells us that NFS traffic for the
/budget_stats mount point is bound to server
wolcott. Apparently
hamilton stopped responding at one point,
because we see non-zero values for the counters
noresponse, failover and
remap. The counter
noresponse counts the number of times a remote
procedure call to the currently bound NFS server timed out. The
counter failovercounts the number of times the NFS client has
"failed over" or switched to another NFS server due to a
timed out remote procedure call. The counter
remap counts the number of files that were
"mapped" to another NFS server after a failover. For
example, if an application on the NFS client had
/budget_stats/1994/deficit open, and then the client
failed over to another server, the next time the application went to
read data from /budget_stats/1944/deficit, the
open file reference would be re-mapped to the corresponding
1944/deficit file on the newly bound NFS server.
Solaris will also notify you when a failover happens. Expect a
message like:
NOTICE: NFS: failing over from hamilton to wolcott
on both the NFS client's system console and in its
/var/adm/messages file.
By the way, it is not required that each server have the same
pathname mounted. The mount command will let you
mount replica servers with different directories. For example:
# mount -o ro serverX:/q,serverY:/m /mnt
As long as the contents of serverX:/q and
serverY:/m are the same, the top level directory
name does not have to be. The next section discusses rules for
content of replicas.
6.5.1. Properties of replicas
Replicas on each server in the replicated filesystem have to be the same in
content. For example, if on an NFS client we have done:
# mount -o ro serverX,serverY:/export /mnt
then /export on both servers needs to be an
exact copy. One way to generate such a copy would be:
# rlogin serverY
serverY # cd /export
serverY # rm -rf ../export
serverY # mount serverX:/export /mnt
serverY # cd /mnt
serverY # find . -print | cpio -dmp /export
serverY # umount /mnt
serverY # exit
#
The third command invoked here, rm -rf ../export
is somewhat curious. What we want to do is remove the contents of
/export in a manner that is as fast and secure
as possible. We could do rm -rf /exportbut that has the side of effect of removing
/export as well as its contents. Since
/export is exported, any NFS client that is
currently mounting serverY:/export will
experience stale filehandles (see Section 18.8, "Stale filehandles"). Recreating
/export
immediately with the
mkdir command
does not suffice because of the way NFS servers generate filehandles
for clients. The filehandle contains among other things the inode
number (a file's or directory's unique identification
number) and this is almost guaranteed to be different. So we want to
remove just what is under
/export. A commonly
used method for doing that is:
# cd /export ; find . -print | xargs rm -rf
but the problem there is that if someone has placed a filename like
foo /etc/passwd (i.e., a file with an embedded
space character) in
/export, then the
xargs rm -rf command will remove a file called
foo and a file called
/etc/passwd, which on Solaris may prevent one
from logging into the system. Doing
rm -rf
../export will prevent
/export from
being removed because
rm will not remove the
current working directory. Note that this behavior may vary with
other systems, so test it on something unimportant to be sure.
At any rate, the aforementioned sequence of commands will create a
replica that has the following properties:
-
Each regular file, directory, named pipe, symbolic link, socket, and
device node in the original has a corresponding object with the same
name in the copy.
-
The file type of each regular file, directory, named pipe, symbolic
link, socket, and device node in the original is the same in the
corresponding object with same name in the copy.
-
The contents of each regular file, directory, symbolic link and
device node in the original are the equal to the contents of each
corresponding object with same name in the copy.
-
The user identifier, group identifier, and file permissions of each
regular file, directory, name pipe, symbolic link, socket, and device
node in the original are to equal the user identifier, group
identifier, and file permissions of each corresponding object with
the same name in the copy. Strictly speaking this last property is
not mandatory for client-side failover to work, but if after a
failover, the user on the NFS client no longer has access to the file
his application was reading, then the user's application will
stop working.