Is it possible to use virtual IP address in JDBC connection string for MySQL

asked 2020-06-17 01:39:55 -0500

Vallikannu gravatar image

updated 2020-06-17 01:41:08 -0500

We are planning to have an active-active(2 Master nodes) MySQL replication setup for SCH relational database. We are using a virtual IP which will migrate between these nodes in case of any failover. We are using keepalived service to monitor the MySQL service and also node failure. Is it possible to give virtual IP address in JDBC connection string?

jdbc:mysql://<virtual_ip_address>:<port>/<database name="">

Will this connection URL take care of the migration of one node to another node since we are providing the virtual IP and it might migrate to another node in case of failover?

edit retag flag offensive close merge delete


Have you tried it? Is it causing a problem? Can you connect that way from another client?

KateF gravatar imageKateF ( 2020-06-18 09:57:47 -0500 )edit

No, yet to try. Just need confirmation whether this setup works as expected or need to have a separate node to handle this MySQL (master/master) setup.

Vallikannu gravatar imageVallikannu ( 2020-06-18 11:24:52 -0500 )edit