User Tools

Site Tools


replicator_agent_highly_available

Highly Available Replicator Agent Configuration

Dubnium

The Replicator Agent supports an “exclusive consumer” mode that provides a Highly Available (HA) Agent solution while maintaining the order of messages in a queue. This active-passive HA approach will exclusively allow only one Agent to actively read messages from a queue. Other Agents will passively try to connect to the queue and will only be given access to the queue if another Agent is no longer connected.

The Agent uses the queue in the message connection and locks that queue for exclusive use. If multiple tasks are made using the same message connection, only one subscriber task will be created and used. When running a backup Agent, a warning will be logged indicating that the queue is in exclusive use and that consumer wait time will be increased (default is to increase to 30 seconds). Once the first running Agent is stopped or fails, the backup Agent will start consuming messages when the queue becomes available and the consumer wait time will be reset.

HA is only available when the Agent is set to connect to Perspectium's MBS over AMQP/S (HTTP/S is not currently supported)

To set up your HA Agent, add the following configurations to your agent.xml file:

Required Directive Example Use Default Description
message_connection <message_connection user="USER_NAME" password="USER_PASSWORD" queue="QUEUE_NAME" use_basic_consume="true" exclusive="true">URI</message_connection> Message Bus Connection Required Setting the exclusive attribute to true enables HA exclusive consumer mode.
consumer_sleep_time <consumer_sleep_time>"NUMBER OF MILLISECONDS"</consumer_sleep_time> Consumer Sleep Time Optional The consumer_sleep_time tag indicates how many milliseconds a passively connecting Agent should wait before attempting to connect again following a failed connection.

HA Agent Configuration Example

<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
    <config>
    <agent>

        <max_reads_per_connect>2000</max_reads_per_connect>
       	<polling_interval>15</polling_interval>

        <subscribe>
            <task>
                <task_name>ticket_table_replication</task_name>
                <polling_interval>30</polling_interval>

                <handler>com.perspectium.replicator.sql.SQLSubscriber</handler>
                <decryption_key>The cow jumped over the moon</decryption_key>

                <message_connection queue="psp.out.replicator.ticket_table" password="encrypted:iTOCp4deP7rJNgFkf2AEMA==" user="admin"  use_basic_consume="true" exclusive="true" >amqp://acme.perspectium.net</message_connection>
                <instance_connection user="agent" password="agent123">https://dev17481.service-now.com</instance_connection>
                <consumer_sleep_time>50000</consumer_sleep_time>
                <database_type>mysql</database_type>
                <database_server>localhost</database_server>
                <database_port>3306</database_port>
                <database_user>root</database_user>
                <database_password>encrypt:mypassword</database_password>
                <database_params/>
                <database>mydatabase</database>
                <skip_database_creation/>
            </task>
      </subscribe>

   </agent>
  </config>

For more information about configuring your Replication Agent, see Agent Configuration.

replicator_agent_highly_available.txt · Last modified: 2018/08/22 15:52 by timothy.pike