Layer7 API Management

 View Only
  • 1.  CA db failover question

    Posted Oct 02, 2019 09:07 AM

    Hi,


    How  we can check to which mysql node gw is connected to ? 
    We have situation in which vmware with mysql went down, and we would like to check did gw switched to "Secondary" db?
    What happens once it become available agai ? Will it switch back to "Primary" or stayed connected to "Secundary" ? 


    Kr
    Marko



  • 2.  RE: CA db failover question
    Best Answer

    Broadcom Employee
    Posted Oct 02, 2019 08:34 PM
    Dear Marko,
    there could be different ways to do it, one of them is to run the command below on a running gateway node,
    netstat -apnt|grep 3306|grep ESTABLISHED

    You will see the IP of the mysql server.

    Regards,
    Mark


  • 3.  RE: CA db failover question

    Broadcom Employee
    Posted Oct 09, 2019 10:33 AM
    For example:
    Abridged 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.

    Abridged 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).


  • 4.  RE: CA db failover question

    Posted Oct 10, 2019 03:28 PM
    Hi,

    thank you. 
    This approach with tcp connections works well

    Kr
    Marko


  • 5.  RE: CA db failover question

    Broadcom Employee
    Posted Oct 10, 2019 05:12 PM
    Thanks everyone.
    I'll add it to the troubleshooting section of the API Gateway documentation.


    Simon Crum
    Lead Technical Writer  |
    Security and API Management