ANS Documentation

Improve This Doc
  • Cloud
  • Domains and DNS management
  • Backup and High Availability
    • UKFast Backup
    • Backup Techniques
    • General backup guidance
    • FASTcloudbackup
    • Business Continuity Platform
      • Introduction to BCP
      • Managing your cluster
      • Distributed Replicated Block Device (DRBD)
      • Unison file-level replication
      • Fencing / STONITH
      • Installing, updating, and configuring software
      • Split brain
      • Frequently asked questions
    • Classic Load Balancers
    • Load Balancers
    • Disaster Recovery as a Service
  • eCommerce Stacks
  • Security
  • Email
  • Monitoring and usage management
  • Networking
  • Operating systems
  • Webcelerator
  • MyUKFast
  • Home >
  • Backup and High Availability >
  • Business Continuity Platform >
  • Unison file-level replication

Unison file-level replication¶

In order to keep configuration files and credentials synchronised between all nodes in the cluster, we run a regular cron job to check on the files specified in the Unison configuration.

Configuring Unison¶

We release clusters with a basic configuration that will keep the configuration files for your chosen webserver and database server in sync between the nodes. If you store your configuration files somewhere non-standard, or would like to have more files synchronised and available on both nodes at the same time (e.g. /etc/sysconfig/memcached to ensure Memcached is configured the same way on all nodes), you will need to modify the Unison settings.

To configure Unison, edit the /root/.unison/default.prf file with your favourite text editor (to avoid arguments, vim is the correct answer to that question).

Note

The configuration file for Unison is different on all nodes in your cluster, so you will need to update all of them when making changes.

For solutions with more than two nodes, the configuration on each node might be located in /root/.unison/hostname.prf, where “hostname” is replaced with the hostname of each of the nodes you’re syncing with (e.g. /root/.unison/acme-web-01.prf, /root/.unison/acme-web-02.prf, and /root/.unison/acme-web-03.prf).

The configuration will look something like this:

root = /
root = ssh://acme-webdb-02//

path = var/spool/cron/
path = etc/passwd
path = etc/shadow
path = etc/group
path = etc/motd
path = etc/drbd.conf
path = etc/cluster/cluster.conf
path = etc/php.ini

ignore = Name access.log*
ignore = Name error.log*

To add more files into Unison, add another path = line to the file, using a full path to the file omitting the leading /.

Directories are denoted by the trailing / at the end of the path, and will be recursively copied.

Once this file has been saved, it will take effect from the next run of the cron job, which should be configured similar to the following as the root user:

* * * * * /usr/bin/file_sync.sh

If that cron is not configured, Unison replication will not work.

Warning

Please note that some of the paths configured in Unison are used to ensure proper functioning of the cluster, so check with support before removing any lines from the default Unison configuration.

Also, Unison will not work if the default SSH keys for the root user are changed. As such, if you regenerate these keys for some reason, please ensure that the nodes each have the public keys in their authorized_keys file for the root user.

Manually performing a synchronisation¶

You can force Unison to perform a sync by running the following command:

[root@acme-webdb-01 ~]# /usr/bin/file_sync.sh

However, as this doesn’t provide a verbose output, you can use the following to see what Unison is doing:

[root@acme-webdb-01 ~]# /usr/bin/unison -sshargs "-p 2020"

Next Article > Fencing / STONITH

  • Useful Links
  • SMB
  • Enterprise
  • Channel
  • Public Sector
  • ANS Data Centres
  • About ANS
  • Careers
  • Blog
  • Get in touch
  •  
  • Sales 0800 458 4545
  • Support 0800 230 0032
  • Get in touch

© ANS Group Limited | Terms and Conditions | Corporate Guidance | Sitemap
ANS Group Limited, registered in England and Wales, company registration number 03176761, registered office 1 Archway, Birley Fields, Manchester M15 5QJ