Hi there,
I have found this write-up, I though it could be helpful ...
With respect to monitoring which Gateway database is in use: You can determine which host is the active host by checking the output of `netstat -tnap` to see where TCP connections over the designated MySQL port are connecting to.
For an example:
Output of netstat on the primary (on 192.168.1.10):
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN - Listening on all interfaces at port 3306
tcp 0 0 192.168.1.10:3306 192.168.1.10:53540 ESTABLISHED - Local GW connecting to a local DB. 192.168.1.10 is using 192.168.1.10 as the active DB
tcp 0 0 192.168.1.10:3306 192.168.1.20:42631 ESTABLISHED - Remote connecting to a local DB. 192.168.1.20 is using 192.168.1.10 as the active DB
tcp 0 0 192.168.1.10:31722 192.168.1.10:3307 ESTABLISHED - Local GW connecting to a remote DB for replication.
Output of netstat on the secondary (on 192.168.1.20):
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN - Listening on all interfaces at port 3306
tcp 0 0 192.168.1.20:20613 192.168.1.10:3306 ESTABLISHED - Local GW connecting to a remote DB. 192.168.1.20 is using 192.168.1.10 as the active DB
tcp 0 0 192.168.1.20:42631 192.168.1.10:3306 ESTABLISHED - Local GW connecting to a remote DB. 192.168.1.20 is using 192.168.1.10 as the active DB
tcp 0 0 192.168.1.10:3307 192.168.1.10:16249 ESTABLISHED - Remote GW connecting to local DB for replication.
To summarize: Look at the TCP connections for port 3306 on a Gateway appliance. A majority (if not all of them, outright) will be connected to whichever database host is considered "active" (regardless of primary or secondary status).
OR ...
Run below mysql query on both nodes Primary and Secondary DB
mysql -e 'show processlist';
The one that lists more connections is the one that is active.
Thanks
CA Support
Kemal Ajan