|Auto Read/Write Splitting||No|
|Primary Selection||Manually, by hostname/IP address|
|Replica Selection||Manually, by hostname/IP address|
Host-based routing uses specific hostnames to provide the distinction between read and write availability within the connector. Two different hostnames and associated IP addresses need to be created on each connector host. Clients connecting to one host will be routed to the current Primary for writing, and connections to the other host will be redirected to a current Replica using the current load-balancing algorithm.
Once enabled, a client can open a connection directly to a Primary or Replica by connecting to the appropriate IP address or hostname. For example:
Will connect to the currently active Primary, while:
Would connect to any currently available Replica.
To enable host-based routing requires both operating system and Connector based configuration changes:
The following steps must be made to the operating system configuration for each Connector host that will be configured within the dataservice:
Add a second IP address to the host. This can be achieved either by adding or exposing a second physical ethernet device, or by exposing an alias on an existing hardware interface.
For example, to add a second IP address to the physical
sudo ifconfig eth0:1 192.168.2.24
To ensure this is retained during a restart, update your network configuration with the additional physical interface and IP address.
file to reflect both addresses and appropriate hostnames. For
192.168.2.20 host1 Primary.host1 192.168.2.21 Replica.host1
When using DNS to resolve addresses, the DNS should also be updated with hostnames to match those configured for each IP interface.
user.map file on every host
running a connector to reflect the the desired QoS for each
hostname. The connector will automatically read the changes after
the file is saved.
@hostoption Primary.host1 qos=RW_STRICT @hostoption Primary.host2 qos=RW_STRICT @hostoption Primary.host3 qos=RW_STRICT @hostoption Replica.host1 qos=RO_RELAXED @hostoption Replica.host2 qos=RO_RELAXED @hostoption Replica.host3 qos=RO_RELAXED
Once configured, client applications must be configured to select the appropriate host based on the operation they are performing.