MYSQL with HA Docker Keycloak cluster

Hi all,

I’m trying to configure a cluster of Keycloak on docker with an external MYSQL Database.
Keycloak release 15.1.1

I changed the docker compose with
JGROUPS_DISCOVERY_PROTOCOL: TCPPING
JGROUPS_DISCOVERY_EXTERNAL_IP: ${PRIMARY_IP}
JGROUPS_DISCOVERY_PROPERTIES: initial_hosts="${PRIMARY_IP}[7600],${SECONDARY_IP}[7600]"
KEYCLOAK_CACHE_OWNERS_COUNT: 2
KEYCLOAK_AUTH_CACHE_OWNERS_COUNT: 2

I put PRIMARY_IP and SECONDART_IP in the .end file.
I copied the TCPPING.cli script (like Keycloak Cluster Setup - Keycloak)

Now, when I start the docker instance, I got the following error message:
The batch failed with the following error: :
WFLYCTL0062: Composite operation failed and was rolled back. Steps that failed:
Step: step-9
Operation: /subsystem=datasources/jdbc-driver=mysql:add(driver-name=mysql, driver-module-name=com.mysql.jdbc, driver-xa-datasource-class-name=com.mysql.cj.jdbc.MysqlXADataSource)
Failure: WFLYCTL0212: Duplicate resource [
(“subsystem” => “datasources”),
(“jdbc-driver” => “mysql”)
]

17:34:59,708 INFO [org.jboss.as] (MSC service thread 1-4) WFLYSRV0050: Keycloak 15.1.1 (WildFly Core 15.0.1.Final) stopped in 21ms
Setting JGroups discovery to TCPPING with properties {initial_hosts=>“primary_ip[7600],secondary[7600]”}

If I remove all the reference to JGROUPS, Keycloak starts but the session are not synchronized (this create a lot of problem)…

What can I do to solve this issue ??

Regards,

HA

Forget to add the following error message:

User with username ‘admin’ already added to ‘/opt/jboss/keycloak/standalone/configuration/keycloak-add-user.json’

Any idea ??

HA