I have deployed two instances of Keycloak on two different machine.
and using following env variable to enable cluster and also enable Distrubition cache by
DJGROUPS_DISCOVERY_EXTERNAL_IP= -DJGROUPS_DISCOVERY_PROTOCOL=TCPPING -DJGROUPS_DISCOVERY_PROPERTIES=initial_hosts=“,”"
I can see they are joined as cluster in logs but can this work as cluster?
and Do we need Reverse Proxy or Load Balancer to control the traffic and have same endpoint for both instance?
The relevant documentation is at Configuring distributed caches - Keycloak
By default, Keycloak uses UDP transport (with UDP multicast discovery). This will work out of the box when the two machines are in the same subnet (and multicast is not filtered at machine level, which is not normally the case).
If your TCP discovery is working, now you’ll probably want a reverse proxy with load balancing so clients have a single point in front of the two instances. But you can use just DNS load balancing.
In that case (with the Keycloak instances available directly to the clientes), you’ll need to set up
--hostname-* options: All configuration - Keycloak