Synchronisation of data between NASs
This describes the means of synchronising data between several Mac mini NASs.
We have a single master NAS on the main plant network, and 3 NASs in the South Wing area, one for each of the isolated networks.
- Linn Home
- Dem Rooms
- Welcome Area
Due to the network topology, the isolated networks can access the main plant network, but access the other way round is not available (without some non-default reconfiguration of network components). Hence a pull synchronisation method was required, so that changes from the master NAS are pulled in by the slave NASs in a regular manner.
This has been achieved using the standard OS/X (and Unix) tools rsync, cron and ssh. As this uses an SSH connection the synchronisation method described below should be extensible to any setup where the NASs can be connected using SSH, including remotely across the internet (although bandwidth requirements are likely to be a major factor in this case).
Configure Remote Access on Server
On the server (master), remote (ssh) access must be enabled
- System Preferences -> Internet & Wireless -> Sharing
- Check the Remote Login service
Configure SSH access from Clients
For every client (slave), it is necessary to configure SSH access to the server. The method described here includes steps to remove the requirement for a password to be entered (so that the synchronisation can be executed automatically). As described this leaves a security hole in that anyone with access to the client machine can access the server machine without any further restrictions.
On client
- Open terminal window and execute ssh-keygen -t dsa
- Accept defaults for all prompts (file location and blank passkey)
- Open the file ~/.ssh/id_dsa.pub and copy the entire (one line) contents
- Open another terminal window and connect to the server
- ssh <user>@<address>
- Answer yes if prompted to accept new connection
- Enter password for server to connect
- In the server window create (or open) the file ~/.ssh/authorized_keys
- Append the contents of the clients id_dsa.pub to this file and save it
- Exit the server, and try reconnecting
- ssh <user>@<address>
- This time should connect without requiirement to enter password
rsync --quiet --recursive --whole-file --delete-during <user>@<address>:/Volumes/USBDrive1/Music /Voumes/USBDrive1
add to cron - check this out as may be strange permission issues