Adjusting Parallel Replication After Installation
How to Enable Parallel Apply After Installation
To enable parallel replication after installation, take the replicator offline cleanly using the following command:
shell> trepctl offline
Modify the configuration to add two parameters:
[defaults]
...
svc-parallelization-type=disk
channels=10
Show argument definitions
svc-parallelization-type=diskMethod for implementing parallel apply.channels=10Number of replication channels to use for parallel apply.You may use an actual data service name in place of the keyword defaults.
Signal the changes by a complete restart of the Replicator process:
shell> replicator restart
You can check the number of active channels on a replica by looking at the "channels" property once the replicator restarts.
replica-shell> trepctl -service alpha status| grep channels
channels : 10
The channel count for a &ctpri; will ALWAYS be 1 because extraction is single-threaded:
primary-shell> trepctl -service alpha status| grep channels
channels : 1
Enabling parallel apply will dramatically increase the number of connections to the database server.
Typically the calculation on a replica would be: Connections = Channel_Count x Service_Count x 2, so for a 4-way Composite Active/Active topology, for example, with 30 channels there would be 30 x 4 x 2 = 240 connections required for the replicator alone, not counting application traffic.
You may display the currently used number of connections in MySQL:
mysql> SHOW STATUS LIKE 'max_used_connections'
+----------------------+-------+
| Variable_name | Value |
+----------------------+-------+
| Max_used_connections | 190 |
+----------------------+-------+
1 row in set (0.00 sec)
Below are suggestions for how to change the maximum connections setting in MySQL both for the running instance as well as at startup:
mysql> SET GLOBAL max_connections = 512;
mysql> SHOW VARIABLES LIKE 'max_connections';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 512 |
+-----------------+-------+
1 row in set (0.00 sec)
shell> vi /etc/my.cnf
max_connections = 512
How to Change Channels Safely
To change the number of channels you must take the replicator offline cleanly using the following command:
shell> trepctl offline
This command brings all channels up the same transaction in the log, then goes offline. If you look in the trep_commit_seqno table, you will notice only a single row, which shows that updates to the replica have been completely serialized to a single point. At this point you may safely reconfigure the number of channels on the replicator, for example using the following command:
[alpha]
...
channels=5
Show argument definitions
channels=5Number of replication channels to use for parallel apply.You can check the number of active channels on a &ctrep; by looking at the "channels" property once the replicator restarts.
If you attempt to reconfigure channels without going offline cleanly, Tungsten Replicator will signal an error when you attempt to go online with the new channel configuration. The cure is to revert to the previous number of channels, go online, and then go offline cleanly. Note that attempting to clean up the trep_commit_seqno and trep_shard_channel tables manually can result in your replicas becoming inconsistent and requiring full resynchronization. You should only do such cleanup under direction from Continuent support.
Failing to follow the channel reconfiguration procedure carefully may result in your replicas becoming inconsistent or failing. The cure is usually full resynchronization, so it is best to avoid this if possible.
How to Disable Parallel Replication Safely
The following steps describe how to gracefully disable parallel apply replication.
Replication Graceful Offline (critical first step)
To disable parallel apply, you must first take the replicator offline cleanly using the following command:
shell> trepctl offline
This command brings all channels up the same transaction in the log, then goes offline. If you look in the trep_commit_seqno table, you will notice only a single row, which shows that updates to the replica have been completely serialized to a single point. At this point you may safely disable parallel apply on the replicator, for example using the following command:
[alpha]
...
svc-parallelization-type=none
channels=1
Show argument definitions
svc-parallelization-type=noneMethod for implementing parallel apply.channels=1Number of replication channels to use for parallel apply.Verification
You can check the number of active channels on a replica by looking at the "channels" property once the replicator restarts.
shell> trepctl -service alpha status| grep channels
channels : 1
Notes and Warnings
If you attempt to reconfigure channels without going offline cleanly, Tungsten Replicator will signal an error when you attempt to go online with the new channel configuration. The cure is to revert to the previous number of channels, go online, and then go offline cleanly. Note that attempting to clean up the trep_commit_seqno and trep_shard_channel tables manually can result in your replicas becoming inconsistent and requiring full resynchronization. You should only do such cleanup under direction from Continuent support.
Failing to follow the channel reconfiguration procedure carefully may result in your replicas becoming inconsistent or failing. The cure is usually full resynchronization, so it is best to avoid this if possible.
How to Switch Parallel Queue Types Safely
As with channels you should only change the parallel queue type after the replicator has gone offline cleanly. The following example shows how to update the parallel queue type after installation:
[alpha]
...
svc-parallelization-type=disk
channels=5
Show argument definitions
svc-parallelization-type=diskMethod for implementing parallel apply.channels=5Number of replication channels to use for parallel apply.