13. Configuring Samba servers replication

Introduction

Running a single database on multiple servers is a rather customary task. You will probably want this if your company has remote offices (this structure is commonly called a geographically distributed business). In this case, exchanging data is a problem you have to solve. That is what the _ data replication_ technology was intended for.

Replication means synchronizing the contents of multiple copies of an object (a LDAP database). Replication is about copying data from a source to multiple targets and vice versa. It allows you to distribute the changes you have made in one copy to any other copies.

Samba replication implies that all servers involved in replication will handle the same list of users and changes in Unix and Samba accounts made on one of these servers will be automatically applied to the other servers.

Support of LDAP replication is included in the _calculate-server package since version 2.0.7_.

Configuring and starting replication

Backup

Before you start to configure replication, it is recommended to backup the settings to avoid using data should anything go wrong:

cl-backup

To restore your data from a recent backup, enter:
cl-backup -r

Setting up replication services

To add the Samba service to replication replication and specify the servers, execute:

cl-replication -r <full server names, comma-separated> samba

For the full name of the server, use the hostname -f command.

When you specify a list of Samba replication servers, replication of the Unix service is automatically added for them.

Transferring replication settings to other servers

If you need to replicate the settings to other servers:
*On the server where the replication is configured, make a settings backup:

cl-backup

*Copy the backup to all servers that are involved in the replication:
scp /var/calculate/server-backup/ldap/<last backup>.tar.bz2 root@otherserver:/var/calculate/server-backup/ldap/

Applying replication settings to other servers

To apply the replication settings to other servers, you should enter:

cl-rebuild --repl

Disabling replication

To disable replication of a service on the server, use the following command:

cl-replication --off <service>

Client support

We have been supporting replication in the calculate-client package since version 2.0.13.

The client goes through the following steps:
  1. At login, the client synchronizes the profile with the current server;
  2. Then it determines whether replication is enabled on the server;
  3. If you did enable replication, it reads the LDAP information on the location of the latest copy of the profile and, if necessary, synchronizes the user profile with the remote server;
  4. At logout, the user's profile is written to the current server;
  5. If successfully synchronized with the remote server, a note is made in the LDAP records (replicated on all servers) about the new location of the latest copy.
Thank you!