Name

cluster-sync — tool for synchronizing files between cluster members

Synopsis

cluster-sync [-n] [-d debug_level] -c cfg

Description

This script performs file synchronization between exactly two (cluster) members.

This script is expected to be executed regularly (i.e. from crontab). It connects to the remote host, looks for changes made on the watched files and transfers the changes from one host to the other. If the file is changed on both hosts, it is considered as the conflict. It is specified in the configuration, which side is prefered in conflicts (CONFLICT_WINNER) below.

The hosts are expected to be interconnected by icamd/icasd daemons. See REMOTE_HOST below.

Options

The values given on the command line have precedence over values given in the configuraiton file.

-c

The configuration file to be used.

-d

The debug level. Default is 6 (LOG_INFO). Increase it for more verbose logging. The script logs to stdout and to /var/log/kernun-debug.

-n

Perform a 'dry run'. No sync actions are performed, just log what would be done.

Configuration file

At least REMOTE_HOST and INCLUDE must be given. If the option can be specified both in configuration file and on command line, the command line value takes precedence.

REMOTE_HOST=TARGET

The ssh target to be used when invoking commands on the other host.

Be sure to use the name defined in /etc/sshd/ssh_config.

There are many commands executed on the REMOTE host, so it is necessary for them to be executed quickly. Daemons icamd/icasd provide fast connections since it takes advantage of the ssh ControlPath feature.

INCLUDE="PATH1"[, "PATH2", ...]

The list of the included files, directories or patterns. The absolute path is given, and it must be preceeded by symbol '.'.

Example:

INCLUDE="./var/log/kernun-stats.*.bz2", "./data/fake-cert/fake_ca/C*.*"
                    

The values must be written in a comma separated list on a single row.

PRECMD="command"

The command is executed to determine whether perform the synchronization or not. Use PRECMD to prevent synchronization when it is not desired. For example when the cluster is degraded.

The command can either be a script name or a simple shell script. It is passed to the perl 'system' call.

No PRECMD is performed by default.

MINIMAL_AGE=seconds

Only files that are older that MINIMAL_AGE are taken in account. This should prevent repetitious copying of the files that are being written for longer period (for examples the zipped logs).

Defaults to 0 (the files are synchronized regardless of their age).

LOCK=filename

The lock file to be locked in order to start the synchronisation. If the lock cannot be (exclusively) locked, the scripts exits immediately.

By default, the lock prevents the script to run more than once in parallel. It can also be used by other programs not to run simultaneously.

CONFLICT_WINNER={LOCAL|REMOTE}

Should the conflict appear, this option specifies whos change wins. Defaults to LOCAL.

RM_STALED={0|1}

Whether the staled temporary file should be automatically removed. Defaults to 1.

DRY_RUN={0,1}

Perform a 'dry run'. No sync actions are performed, just log what would be done.

DEBUG_LEVEL=num

The debug level. Default is 6 (LOG_INFO). Increase it for more verbose logging. The script logs to stdout and to /var/log/kernun-debug.

See Also

icamd(8), icasd(8),

Authors

This man page is a part of Kernun Firewall.
Copyright © 2000–2023 Trusted Network Solutions, a. s.
All rights reserved.