15.2. Single-master Replication

In a single-master replication scenario, the master copy of the directory data is held in a single read-write replica on one server called the supplier server. The supplier also maintains the changelog for this replica. On another server, called the consumer server, a read-only copy of the directory is stored. In a single master replication environment, you can run multiple consumers.
Use a single-master replication topology, for example, if a suffix receives a large number of search requests, but a small number of write requests. To distribute the load, clients can run searches for the suffix on all servers in the topology and send write requests to the master.
The following diagram shows a single-master replication environment with two consumers:
Single-master Replication

Figure 15.1. Single-master Replication

Use the command line or web console to set up a single-master replication topology. See:

15.2.1. Setting up Single-master Replication Using the Command Line

The following example assumes that you have an existing Directory Server instance running on a host named supplier.example.com that will act as a master in the replication topology to be set up. The following procedures describe how to add a read-only consumer named consumer.example.com to the topology, and how to configure single-master replication for the dc=example,dc=com suffix.

Steps to be Performed on the Consumer

On the consumer.example.com host:
  1. Install Directory Server, and create an instance. For details, see the Red Hat Directory Server Installation Guide.
  2. In case you created the instance without a database, create the database for the suffix. For example, to create a database named userRoot for the dc=example,dc=com suffix:
    # dsconf -D "cn=Directory Manager" ldap://consumer.example.com backend \
        create --suffix="dc=example,dc=com" --be-name="userRoot"
    For details on creating a database for a suffix, see Section 2.1.1, “Creating Suffixes”.
  3. Enable replication for the suffix, and create the replication manager account:
    # dsconf -D "cn=Directory Manager" ldap://consumer.example.com replication \
        enable --suffix="dc=example,dc=com" --role="consumer" \
        --bind-dn="cn=replication manager,cn=config" --bind-passwd="password"
    This command configures the consumer.example.com host as a consumer for the dc=example,dc=com suffix. Additionally, the server creates the cn=replication manager,cn=config user with the specified password, and allows this account to replicate changes for the suffix to this host.
To add multiple consumers for the suffix to the topology, repeat the steps on each consumer.

Steps to be Performed on the Supplier

On the supplier.example.com host:
  1. Enable replication for the dc=example,dc=com suffix:
    # dsconf -D "cn=Directory Manager" ldap://supplier.example.com replication \
        enable --suffix="dc=example,dc=com" --role="master" --replica-id=1
    This command configures the supplier.example.com host as a master for the dc=example,dc=com suffix, and sets the replica ID for this entry to 1.

    Important

    The replica ID must be a unique integer between 1 and 65534 for a suffix across all masters in the topology.
  2. Add the replication agreement, and initialize the consumer. For example:
    # dsconf -D "cn=Directory Manager" ldap://supplier.example.com repl-agmt \
         create --suffix="dc=example,dc=com" --host="consumer.example.com" --port=636 \
         --conn-protocol=LDAPS --bind-dn="cn=replication manager,cn=config" \
         --bind-passwd="password" --bind-method=SIMPLE --init \
         example-agreement
    This command creates a replication agreement named example-agreement. The replication agreement defines settings, such as the consumer's host name, protocol, and authentication information that the supplier uses when connecting and replicating data to the consumer.
    After the agreement was created, Directory Server initializes the consumer. To initialize the consumer later, omit the --init option. Note that replication does not start before you initialize the consumer. For details about initializing a consumer, see Section 15.7.3, “Initializing a Consumer”.
    For further details about the options used in the command, enter:
    # dsconf -D "cn=Directory Manager" ldap://supplier.example.com repl-agmt --help
  3. Verify whether the initialization was successful:
    # dsconf -D "cn=Directory Manager" ldap://supplier.example.com repl-agmt \
         init-status --suffix="dc=example,dc=com" example-agreement
    Agreement successfully initialized.
    Depending on the amount of data to replicate, the initialization can be time-consuming.
If you add multiple consumers for the suffix to the topology, repeat the steps on the supplier for each consumer. However, you must enable replication for the suffix only once on the supplier.

15.2.2. Setting up Single-master Replication Using the Web Console

The following example assumes that you have an existing Directory Server instance running on a host named supplier.example.com that will act as a master in the replication topology to be set up. The following procedures describe how to add a read-only consumer named consumer.example.com to the topology, and how to configure single-master replication for the dc=example,dc=com suffix.

Steps to be Performed on the Consumer

On the consumer.example.com host:
  1. Install Directory Server, and create an instance. For details, see the Red Hat Directory Server Installation Guide.
  2. Open the Directory Server user interface in the web console. See Section 1.4, “Logging Into Directory Server Using the Web Console”.
  3. Select the instance.
  4. In case you created the instance without a database, create the database for the suffix. For details about creating a database for a suffix, see Section 2.1.1, “Creating Suffixes”.
  5. Enable replication for the suffix:
    1. Open the Replication menu.
    2. Select the dc=example,dc=com suffix, and click Enable Replication.
    3. Select Consumer in the Replication Role field, and enter the DN and password of the replication manager account to create. For example:
      These settings configure the host as a consumer for the dc=example,dc=com suffix. Additionally, the server creates the cn=replication manager,cn=config user with the specified password, and allows this account to replicate changes for the suffix to this host.
    4. Click Enable Replication.
To add multiple consumers for the suffix to the topology, repeat the steps on each consumer.

Steps to be Performed on the Supplier

On the supplier.example.com host:
  1. Open the Directory Server user interface in the web console. See Section 1.4, “Logging Into Directory Server Using the Web Console”.
  2. Select the instance.
  3. Enable replication for the dc=example,dc=com suffix:
    1. Open the Replication menu.
    2. Select the dc=example,dc=com suffix, and click Enable Replication.
    3. Select Master in the Replication Role field, enter a replica ID, and leave the fields in the Replication Authentication area empty. For example:
      This configures the host as a master for the dc=example,dc=com suffix, and sets the replica ID for this entry to 1.

      Important

      The replica ID must be a unique integer between 1 and 65534 for a suffix across all masters in the topology.
    4. Click Enable Replication.
  4. Add the replication agreement, and initialize the consumer:
    1. Open the Replication menu, and select the dc=example,dc=com suffix.
    2. On Replication Agreements tab, click Create Agreement, and fill the fields. For example:
      These settings create a replication agreement named example-agreement. The replication agreement defines settings, such as the consumer's host name, protocol, and authentication information that the supplier uses when connecting and replicating data to the consumer.
    3. Select Do Online Initialization in the Consumer Initialization field to automatically initialize the consumer after saving the agreement.
      To initialize the consumer later, select Do Not Initialize. Note that replication does not start before you initialize the consumer. For details about initializing a consumer, see Section 15.7.3, “Initializing a Consumer”.
    4. Click Save Agreement.
  5. Verify whether the initialization was successful:
    1. Open the Replication menu.
    2. Select the Agreements entry.
      For a successfully-completed initialization, the web console displays the Error (0) Replica acquired successfully: Incremental update succeeded message in the Last Update Status column.
      Depending on the amount of data to replicate, the initialization can be time-consuming.
If you add multiple consumers for the suffix to the topology, repeat the steps on the supplier for each consumer. However, you must enable replication for the suffix only once on the supplier.