|
|
|
You will need to obtain an rsync executable for the operating system on your host machine. See http://samba.anu.edu.rsync for information on how to obtain and install this utility.
The following examples will show you how to configure and operate the rsync utility on a Unix/Linux machine to automatically maintain a remote replica of your trending database.
First, create the following directories:
/opt/rsync/PathControl/data /opt/rsync/PathControl/etc
The data directory is where the replicated database will be stored.
Add the following to the rsync.conf configuration file, and place it in the etc directory:
log file = /opt/rsync/PathControl/etc/rsyncd.log pid file = /opt/rsync/PathControl/etc/rsyncd.pid lock file = /opt/rsync/PathControl/etc/rsyncd.pid syslog facility = local1 [trends] path = /opt/rsync/pc1/data/trends comment = trends read only = no use chroot = no uid = rsync gid = rsync list = yes transfer logging = yes log format = [%o] [%m] size=%l transfered=%b %f [to/from %h] dont compress = *.*
Create a simple start/stop script in the directory /opt/rsync/PathControl. This file must be executable, and the port number (5005 in the example script) must refer to a usable port on your host machine.
The following rsync.sh file is an example Unix/Linux bash shell script:
#!/bin/bash
start() {
rsync --daemon --config=$config --port $port \
|| echo "ERROR while starting rsync daemon"
}
stop() {
kill `cat $pidfile` \
|| echo "ERROR while stopping rsync daemon"
}
status() {
local j
j=`ps axwww | grep -v grep | grep rsync | grep -- "--port $port"`
if [ -n "$j" ]; then
echo "$sn running, on port $port"
else
echo "$sn not running"
fi
}
sn=rsync
port=5005
config=/opt/rsync/PathControl/etc/rsyncd.conf
pidfile=/opt/rsync/pc1/PathControl/rsyncd.pid
case "$1" in start) start;; stop) stop;; status) status;; *) echo "$sn [ start | stop | status ]"; exit esac
/opt/rsync/PathControl/rsync.sh start
tail -f /opt/rsync/PathControl/etc/rsyncd.log
/opt/rsync/pc1/rsync.sh stop
To query the rsync daemon for its status:
/opt/rsync/pc1/rsync.sh status
To communicate with the rsync daemon on a host machine configured as shown and named remote_host located in the domain myDomain, enter the following command in the CNA CLI:
rsync target remote_host.myDomain:5005::/opt/rsync/PathControl/data rsync enable trends
The rsync username command on the CNA system was not used because the rsync daemon on remote_host was configured to use anonymous log ins.
This example will automatically maintain a replica of your trending database.
Alternatively, you could manually force updates, using the copy command to copy data from your CNA system to your rsync host (this example assumes you have used the rsync target command as shown previously):
copy /trends rsync:
When you first add the rsync enable command to the configuration or execute the copy rsync command the first time, the entire trending database will be written to the remote host. From then on, however, only incremental changes will be written, requiring much less time.
|
|
|