Keycloak clustering - No members discovered

Hi, currently I’am configuring the keycloak for the production. For this I want to run keycloak in cluster mode using TCPPING.

In this I have 2 AWS EC2 servers on which I’am running docker containers for keycloak using the image “ivanfranchin/keycloak-clustered”.

I have also added the below environement variables in the docker configuration according to information given in this link https://www.keycloak.org/2019/05/keycloak-cluster-setup:
KEYCLOAK SERVER: 1
#IP address of this host, please make sure this IP can be accessed by the other Keycloak instances
JGROUPS_DISCOVERY_EXTERNAL_IP=172.31.140.50
#protocol
JGROUPS_DISCOVERY_PROTOCOL=TCPPING
#IP and Port of all host
JGROUPS_DISCOVERY_PROPERTIES=initial_hosts=“172.31.140.50[7600],172.31.140.62[7600]”

KEYCLOAK SERVER: 2
#IP address of this host, please make sure this IP can be accessed by the other Keycloak instances
JGROUPS_DISCOVERY_EXTERNAL_IP=172.31.140.62
#protocol
JGROUPS_DISCOVERY_PROTOCOL=TCPPING
#IP and Port of all host
JGROUPS_DISCOVERY_PROPERTIES=initial_hosts=“172.31.140.50[7600],172.31.140.62[7600]”

image

The problem is that the two keycloak containers running on different host servers cannot discover each other. I have also opened up all ports between them for accessing. Can anyone please help me on this?

I have the same issue, did you find a solution ??

Facing the same issue. Is there is any other solution for mitigating the above issue ?

#IP address of this host, please make sure this IP can be accessed by the other Keycloak instances”

Have you verified this is true in your case?
Also when you are running the command ‘ip a’ what ip do you see?

I haven’t had an experience with AWS servers but there may be a change the the internal ip of your machine is not really the ip you are trying to connect with and you may need additional jgroups configuration of ‘NAT’.

Go to the jgroups documentation [1] and search for external_addr.

[1] Reliable group communication with JGroups