Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NFS multiple home logins, ssh, & Spotlight



This is a follow-up to my post in the previous thread about multiple- logins to an NFS home directory (via ssh or GUI).

I have verified that Spotlight does synchronize changes between more than one computer mounting the same NFS home directory. Normally, changes made on one computer are visible within a few minutes on the other computers (using Spotlight or mdfind). This occurs whether or not a user is logged in via the GUI (e.g. if a file is modified when logged in remotely with ssh).

ISSUES: if the home directory has not yet been indexed on a specific Mac, no changes that are made on that Mac will propagate until the index is caused to be built by doing an 'mdfind' as that user on that Mac. While mds is building the index, mdfind on that Mac doesn't return correct results (same as when Spotlight is indexing a local drive). I've also been having some issues where things don't seem to sync up after indexing until mds is restarted on both machines, but I haven't really tracked that down. Before the index is properly created and working properly, I've had horrible problems on my MacBook Pro where mds would crash constantly and take gobs of CPU time. I first thought it was an intel/endian bug but after I let my MacBook Pro index my home directory in isolation (as the master), it seems to be working ok now.


Here are the details:

I have several Macs that statically automount an NFS filesystem from a FreeBSD 6.1 server. The mounts are done statically at boot time via local NetInfo DB /mounts entries (like Marcel Bresink's NFSManager creates). My users are all stored in the local NetInfo DB, but with home directories that reside on the NFS fileserver. I don't see why it wouldn't also work fine with network directory logins.

I tested it while logged into the GUI simultaneously as the same user on 2 of the Macs, and just ssh logged in to the others. Since the Spotlight mechanism runs as daemons, I don't think GUI login makes any difference one way or the other as far as Spotlight indexing is concerned.

The changes are all coordinated in a directory called ~/.Spotlight- V100 (in the root of each home directory). Each Mac has it's own private index of the home directory. The indexes themselves live locally on each Mac in subdirectories of /var/db/Spotlight-V100 in a separate subdirectory for each home that's been indexed on that Mac.

One Mac is designated as the Spotlight "master" for a home directory. This is stored in the mds-lock-dir/master-status file (in the ~/.Spotlight-V100 directory). I'm not exactly sure how it becomes the master, but it does change from host to host. It seems to be the first host that logs onto the home directory. When I killed the master Mac (by force-shutting it down), the master changed to my other logged-in Mac within a few minutes which seems to indicate some network handshaking, but I haven't tracked it with tcpdump.


The files that have changed on the master are recorded (as human readable text) in files called master-change-list-<n>. <n> keeps increasing and is stored in master-change-id. There can be quite a number of these files. Presumably the changes are cumulative and a slave Mac might require some or all files to get in sync again if it's been turned off for a while and has just powered on. If you kill -HUP mds, these files seem to be consolidated and/or cleaned up (but I don't recommend to do that; I seem to have had some crashing of mds after that).


The master seems to have a 60 strobe: using fslogger, I found that every 60 seconds a file called "delete-me" is created and deleted and this seems to be somewhat correlated with when the master-change-list files are created/updated. fslogger is not reliable when it comes to finding Spotlight-related changes since it uses the Spotlight notification API which does not report changes on Spotlight-specific files!

Changes on a "slave" Mac are recorded in slave-work-dir as files called .<full-host-name>. There seem to be a slave file for each Mac that has invoked a Spotlight search for that home directory (e.g. using mdfind -- a GUI login is not necessary). The first time you do an mdfind from a Mac, it can take quite a while for that Mac to build the index (as we already know).

The slave seems to have a 120 sec strobe: every 120 seconds, the slave creates a directory called mds-lock-dir-<full-host-name>-<id>. If a change has been made, the changed file is noted in the slave host's file in the slave-work-dir (as human readable text). It seems like it is picked up by the master at its next strobe and incorporated into the master-change-list and then the slave's file is zeroed out (I haven't yet checked to make sure that rpc.lockd is locking the file) The change then seems to be picked up by all other slave clients at their next strobe.



The upshot seems to be that under normal operation after indexing on all machines, a change made on any machine will be visible on all other machines within 3 minutes.


_______________________________________________ Do not post admin requests to the list. They will be ignored. Macos-x-server mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/macos-x-server/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.