我们有2台机器在域模式下运行Keycloak 4.8.3.Final (WildFly Core 6.0.2.Final)。首先,host1将运行域控制器,并将成为我们的主人。Host2是我们的奴隶,并向主人注册自己。据我们了解,域模式通过提供存储和发布配置的中心位置来解决这个问题。
第一个命令是通过执行以下命令启动的:
/opt/keycloak/bin/domain.sh -host-config- -Djboss.bind.address=0.0.0.0 -Djboss.bind.address.management=0.0.0.0 -Djava.security.egd=file:/dev/urandom -Djboss.node.name=host1
第二个方法是执行命令:
/opt/keycloak/bin/domain.sh -host-config主机- -Djboss.bind.address=0.0.0.0 -Djboss.bind.address.management=0.0.0.0 -Djboss.domain.master.username=slave -Djboss.domain.master.address={host1_ip} -Djboss.domain.master.username=slave-Djboss.domain.master.address={host1_ip}Djava.security.egd=file:/dev/urandom -Djboss.node.name=host2
它们都成功启动,从服务器成功地连接到主服务器。我们使用的是两个服务器都指向的用于数据持久性的MySQL机器。
首先,我们使用了键盘斗篷发行版附带的默认domain.xml,我们最初的期望是通过在host1上创建一些东西,这些更改将传播到host2。不幸的是,这种情况并没有发生。当我们创建一个用户时,用户会在一段时间后出现在host2上。当我们从host1在一个领域中创建一个领域或一个客户端时,直到我们重新启动两个服务器并强制同步信息之后,才能从host2中看到更改。
下一步是在domain.xml指令下更改infinispan配置,并在所有机器上复制缓存。
<subsystem xmlns="urn:jboss:domain:infinispan:7.0">
<cache-container name="keycloak">
<transport lock-timeout="60000" />
<replicated-cache name="authenticationSessions" />
<replicated-cache name="clientSessions" />
<replicated-cache name="offlineClientSessions" />
<replicated-cache name="authorization" />
<replicated-cache name="work" />
<replicated-cache name="keys" />
<replicated-cache name="actionTokens"></replicated-cache>
<replicated-cache name="realms" />
<replicated-cache name="users" />
<replicated-cache name="sessions" />
<replicated-cache name="offlineSessions" />
<replicated-cache name="loginFailures" />
<replicated-cache name="work" />
<replicated-cache name="realmVersions" />
</cache-container>
<cache-container name="server" aliases="singleton cluster" default-cache="default" module="org.wildfly.clustering.server">
<transport lock-timeout="60000" />
<replicated-cache name="default">
<transaction mode="BATCH" />
</replicated-cache>
</cache-container>
<cache-container name="web" default-cache="dist" module="org.wildfly.clustering.web.infinispan">
<transport lock-timeout="60000" />
<distributed-cache name="dist">
<locking isolation="REPEATABLE_READ" />
<transaction mode="BATCH" />
<file-store />
</distributed-cache>
</cache-container>
<cache-container name="ejb" aliases="sfsb" default-cache="dist" module="org.wildfly.clustering.ejb.infinispan">
<transport lock-timeout="60000" />
<distributed-cache name="dist">
<locking isolation="REPEATABLE_READ" />
<transaction mode="BATCH" />
<file-store />
</distributed-cache>
</cache-container>
<cache-container name="hibernate" module="org.infinispan.hibernate-cache">
<transport lock-timeout="60000" />
<local-cache name="local-query">
<object-memory size="10000" />
<expiration max-idle="100000" />
</local-cache>
<invalidation-cache name="entity">
<transaction mode="NON_XA" />
<object-memory size="10000" />
<expiration max-idle="100000" />
</invalidation-cache>
<replicated-cache name="timestamps" />
</cache-container>
</subsystem>但是,我们也有同样的问题,特别是如果您为客户端重新生成一个秘密,这个秘密既不会传播到从主机,也不会传播到从主机。
有没有其他人经历过这个问题,为了解决这个问题,你做了什么?任何帮助都将不胜感激!
发布于 2019-07-12 07:29:19
问题是,我们的云提供商不支持多播,两个服务器无法找到并相互交谈!我对配置进行了更改,并开始使用TCPPING,而不是使用UDP的PING。我花了那么多时间试图弄清楚这一点,所以请确保您的提供商支持多播,以便只需使用Keycloak就可以了。此外,我还发现了下面的文章,其中提供了有关如何设置Keycloak https://www.keycloak.org/2019/04/keycloak-cluster-setup.html的信息。如果这篇文章是在我处理这个问题的时候写出来的.
https://stackoverflow.com/questions/55147047
复制相似问题