ivangfr / keycloak-clustered

Keycloak-Clustered extends quay.io/keycloak/keycloak official Keycloak Docker image by adding JDBC_PING discovery protocol.
162 stars 57 forks source link

Wront Pysical Address of ISPN #10

Closed whitepiratebaku closed 2 years ago

whitepiratebaku commented 2 years ago

Hello, I am trying to setup caching between two keycloak:17.0.0 containers which hosted on two different networks. When keycloak2 tries to connect infinispan on keycloak1 it times out.

keycloak1: (that ip is internal docker network ip) ISPN000079: Channel ISPN local address is c1e5d04bfd44-19571, physical addresses are `[192.168.48.5:7800]

keycloak2: [org.jgroups.protocols.pbcast.GMS] (keycloak-cache-init) 5e3d9b655522-54955: JOIN(5e3d9b655522-54955) sent to c1e5d04bfd44-19571 timed out (after 2000 ms), on try 0

can I explicitly give physical IP ?

whitepiratebaku commented 2 years ago

used hosted-network from docker as workaround and it worked, but still want to know if there is normal solution for this problem

ivangfr commented 2 years ago

Hi @whitepiratebaku I am having the same issue with ISPN... Have you see this comment in the issue #9

zdykstra commented 2 years ago

I just hit a version of this issue on my testing environment. As long as you launch the docker container with --network host, you can then use the following change to the cache xml file:

diff --git a/quarkus/cache-ispn-jdbc-ping.xml b/quarkus/cache-ispn-jdbc-ping.xml
index 3f9b551..4c47920 100644
--- a/quarkus/cache-ispn-jdbc-ping.xml
+++ b/quarkus/cache-ispn-jdbc-ping.xml
@@ -33,7 +33,8 @@
                        stack.position="MPING" />
         </stack>
         <stack name="postgres-jdbc-ping-tcp" extends="tcp">
-            <TCP use_ip_addrs="true"/>
+            <TCP use_ip_addrs="true"
+                 bind_addr="match-interface:eth0" />

JGroups will bind to the eth0 interface address (and report that via the JDBC_PING method) rather than the docker0 interface.

Take a look at http://www.jgroups.org/manual4/index.html#Transport to see the different bind_addr options.

whitepiratebaku commented 2 years ago

@ivangfr no I did not see that, comment.

ivangfr commented 2 years ago

Hi @whitepiratebaku Did you solve the problem you were having?

ivangfr commented 2 years ago

Closing issue due as there is no feedback

whitepiratebaku commented 2 years ago

Hello @ivangfr, not using the proper way, still using docker hosted network mode.