Write Affinity for Composite Active/Active environments was introduced in version 6.1.12.
Setting write affinity allows write statements to be routed to the remote Active cluster, while reads may follow the affinity for the local cluster. This provides the ability to ensure conflicts do not occurr when writing to multiple active clusters.
This can be configured in a number of different ways, depending upon the configuration of your connectors.
For Proxy Routing:
When running in Proxy mode, you can set the affinity via the
user.map by specifying the
Write Dataservice and Read Dataservice as follows:
user password global remoteWriteCluster:localReadCluster
Additionally, affinity can be set per connection, for example:
mysql -u username -p secret -h connector1 -P 3306 database@affinity=remoteWriteCluster:localReadCluster
For Bridge Mode Routing:
You can enable the affinity for Bridge Mode connections by setting the
tpm property, for example, add the following in your ini file: