AFAIK this functionality is currently broken.
You can work around it by using haproxy and/or keepalived/vip in front
of the DB service.
On 2024-09-25 23:24, Sean Lair wrote:
Did you ever get this working Frederic? This used to work for us, but
during some update (not sure at the moment which one) the mysql-ha
stopped failing over.
-----Original Message-----
From: Frederic Larcher <frederic.larc...@quadris.co.uk.INVALID>
Sent: Tuesday, May 30, 2023 6:07 AM
To: users@cloudstack.apache.org
Subject: RE: Database HA in Cloudstack 4.15.2
Hi Simon,
I have installed the cloudstack-mysql-ha package after converted it to
a Debian package. I can see the jar file in the
/usr/share/cloudstack-management/lib/ folder
(cloud-plugin-database-mysqlha-4.15.2.0.jar), but I can't see any
mention of it in the logs when restarting the cloudstack-management
service. Is there another step that need to be done?
-----Original Message-----
From: Simon Weller <siwelle...@gmail.com>
Sent: Friday, May 26, 2023 3:36 PM
To: users@cloudstack.apache.org
Subject: Re: Database HA in Cloudstack 4.15.2
Hi Frederic,
First of all, have you installed the cloudstack-mysql-ha package? If
so, can you look through the logs on cloudstack-management startup, and
check to see whether the jar is being loaded?
-Si
On Fri, May 26, 2023 at 3:27 AM Frederic Larcher
<frederic.larc...@quadris.co.uk.invalid> wrote:
Hi,
I am trying to configure HA with 2 Mysql servers in Cloudstack 4.15.2.
Both DB servers are configured as master-master, and the db.properties
file has been updated:
--------------------------
# High Availability And Cluster Properties db.ha.enabled=true
db.ha.loadBalanceStrategy=com.cloud.utils.db.StaticStrategy
# cloud stack Database
db.cloud.slaves=10.10.10.20
db.cloud.autoReconnect=true
db.cloud.failOverReadOnly=false
db.cloud.reconnectAtTxEnd=true
db.cloud.autoReconnectForPools=true
db.cloud.secondsBeforeRetryMaster=3600
db.cloud.queriesBeforeRetryMaster=5000
db.cloud.initialTimeout=3600
#usage Database
db.usage.slaves=10.10.10.20
db.usage.autoReconnect=true
db.usage.failOverReadOnly=false
db.usage.reconnectAtTxEnd=true
db.usage.autoReconnectForPools=true
db.usage.secondsBeforeRetryMaster=3600
db.usage.queriesBeforeRetryMaster=5000
db.usage.initialTimeout=3600
----------------------------------------------------
When I stop the mysql service or disable the NIC to stop connectivity,
Cloudstack does not use the second mysql server. The UI keeps loading,
and the management service cannot be restarted. I am getting these
logs on the management server:
----------------------------------------------------------
Unable to keep the db connection for LockMaster1
java[358521]: java.sql.SQLNonTransientConnectionException: Server
shutdown in progress
java[358521]: at
com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:110)
java[358521]: at
com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
java[358521]: at
com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
java[358521]: at
com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:953)
java[358521]: at
com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:1003)
java[358521]: at
jdk.internal.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)
java[358521]: at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java[358521]: at
java.base/java.lang.reflect.Method.invoke(Method.java:566)
java[358521]: at
com.mysql.cj.jdbc.ha.MultiHostConnectionProxy$JdbcInterfaceProxy.invoke(MultiHostConnectionProxy.java:108)
java[358521]: at
com.mysql.cj.jdbc.ha.FailoverConnectionProxy$FailoverJdbcInterfaceProxy.invoke(FailoverConnectionProxy.java:98)
java[358521]: at com.sun.proxy.$Proxy25.executeQuery(Unknown
Source)
java[358521]: at
org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:122)
java[358521]: at
org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:122)
java[358521]: at
com.cloud.utils.db.ConnectionConcierge$ConnectionConciergeManager.testValidity(ConnectionConcierge.java:148)
java[358521]: at
com.cloud.utils.db.ConnectionConcierge$ConnectionConciergeManager$1.runInContext(ConnectionConcierge.java:203)
java[358521]: at
org.apache.cloudstack.managed.context.ManagedContextRunnable$1.run(ManagedContextRunnable.java:48)
java[358521]: at
org.apache.cloudstack.managed.context.impl.DefaultManagedContext$1.call(DefaultManagedContext.java:55)
java[358521]: at
org.apache.cloudstack.managed.context.impl.DefaultManagedContext.callWithContext(DefaultManagedContext.java:102)
java[358521]: at
org.apache.cloudstack.managed.context.impl.DefaultManagedContext.runWithContext(DefaultManagedContext.java:52)
java[358521]: at
org.apache.cloudstack.managed.context.ManagedContextRunnable.run(ManagedContextRunnable.java:45)
java[358521]: at
java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
java[358521]: at
java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
java[358521]: at
java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
java[358521]: at
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
java[358521]: at
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
java[358521]: at
java.base/java.lang.Thread.run(Thread.java:829)
----------------------------------------------------------------------
------------------ We are using Mysql version 8.0.33 on Ubuntu 20.04.
I can see on the CS documentation, it has been "Tested with MySQL 5.1
and 5.5.", not sure if it has been tested on newer version as well?
Is there something else that need to be configured?
Thanks