7.3.1. Deploying Multiple Replicators on a Single Host

It is possible to install multiple replicators on the same host. This can be useful, either when building complex topologies with multiple services, and in hetereogenous environments where you are reading from one database and writing to another that may be installed on the same single server.

When installing multiple replicator services on the same host, different values must be set for the following configuration parameters:

  • RMI network port used for communicating with the replicator service.

    Set through the --rmi-port parameter to tpm. Note that RMI ports are configured in pairs; the default port is 10000, port 10001 is used automatically. When specifying an alternative port, the subsequent port must also be available. For example, specifying port 10002 also requires 10003.

  • THL network port used for exchanging THL data.

    Set through the --thl-port parameter to tpm. The default THL port is 2112. This option is required for services operating as masters (extractors).

  • Master THL port, i.e. the port from which a slave will read THL events from the master

    Set through the --master-thl-port parameter to tpm. When operating as a slave, the explicit THL port should be specified to ensure that you are connecting to the THL port correctly.

  • Master hostname

    Set through the --master-thl-host parameter to tpm. This is optional if the master hostname has been configured correctly through the --master parameter.

  • Installation directory used when the replicator is installed.

    Set through the --install-directory or --install-directory parameters to tpm. This directory must have been created, and be configured with suitable permissions before installation starts. For more information, see Section B.3.3, “Directory Locations and Configuration”.

For example, to create two services, one that reads from MySQL and another that writes to MongoDB on the same host:

  1. Extract the Tungsten Replicator software into a single directory.

  2. Extractor reading from MySQL:

    shell> ./tools/tpm configure extractor \
    --install-directory=/opt/extractor \
    --master=host1 \
    --members=host1 \
    --replication-password=password \
    --replication-user=tungsten \
    --start=true

    This is a standard configuration using the default ports, with the directory /opt/extractor.

  3. Reset the configuration:

    shell> tpm configure defaults --reset
  4. Applier for writing to MongoDB:

    shell> ./tools/tpm configure applier \
    --datasource-type=mongodb \
    --install-directory=/opt/applier \
    --master=host1 \
    --members=host1 \
    --start=true \
    --topology=master-slave \
    --rmi-port=10002 \
    --master-thl-port=2112 \
    --master-thl-host=host1 \
    --thl-port=2113

    In this configuration, the master THL port is specified explicitly, along with the THL port used by this replicator, the RMI port used for administration, and the installation directory /opt/applier.

When multiple replicators have been installed, checking the replicator status through trepctl depends on the replicator executable location used. If /opt/extractor/tungsten/tungsten-replicator/bin/trepctl, the extractor service status will be reported. If /opt/applier/tungsten/tungsten-replicator/bin/trepctl is used, then the applier service status will be reported.

Alternatively, a specific replicator can be checked by explicitly specifying the RMI port of the service. For example, to check the extractor service:

shell> trepctl -port 10000 status

Or to check the applier service:

shell> trepctl -port 10002 status

When an explicit port has been specified in this way, the executable used is irrelevant. Any valid trepctl instance will work.