首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为Keycloak 17配置Infinispan

为Keycloak 17配置Infinispan
EN

Stack Overflow用户
提问于 2022-04-13 12:41:44
回答 1查看 3.9K关注 0票数 2

我想在HA模式下运行Keycloak 17 (Quarkus ),并提供无穷大。因为我们在服务器级上运行Keycloak,所以我想指定一个无穷大的集群名。正如我从文档中了解到的,我应该在给定的无穷配置xml ./conf/cache-ispn.xml中配置它。

我改变了

代码语言:javascript
复制
     <transport lock-timeout="60000"/>

代码语言:javascript
复制
     <transport cluster="myClusterName" lock-timeout="60000"/>

之后,我运行了.\kc.bat构建--cache=ispn --缓存-config-file=conf/cache-ispn.xml。

并使用.\kc.bat启动服务器。

遗憾的是,输出日志显示如下:

代码语言:javascript
复制
[org.infinispan.CLUSTER] (keycloak-cache-init) ISPN000078: Starting JGroups channel `ISPN`
[org.infinispan.CLUSTER] (keycloak-cache-init) ISPN000094: Received new cluster view for channel ISPN: [MyHostName-14281|0] (1) [MyHostName-14281]

从日志中可以看到,集群名称仍然是默认的"ISPN“。

我已经在这里查阅了无穷大文档:https://infinispan.org/docs/stable/titles/configuring/configuring.html

以及Keycloak文档:

https://www.keycloak.org/server/caching

https://www.keycloak.org/server/configuration

有人能帮我吗?这是一个与Keycloak 17有关的bug,还是我在无限配置中遗漏了什么?

全Infinispan:

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2019 Red Hat, Inc. and/or its affiliates
  ~ and other contributors as indicated by the @author tags.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~ http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<infinispan
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="urn:infinispan:config:11.0 http://www.infinispan.org/schemas/infinispan-config-11.0.xsd"
        xmlns="urn:infinispan:config:11.0">

    <cache-container name="keycloak">
        <transport cluster="myClusterName" lock-timeout="60000"/>
        <local-cache name="realms">
            <encoding>
                <key media-type="application/x-java-object"/>
                <value media-type="application/x-java-object"/>
            </encoding>
            <memory max-count="10000"/>
        </local-cache>
        <local-cache name="users">
            <encoding>
                <key media-type="application/x-java-object"/>
                <value media-type="application/x-java-object"/>
            </encoding>
            <memory max-count="10000"/>
        </local-cache>
        <distributed-cache name="sessions" owners="2">
            <expiration lifespan="-1"/>
        </distributed-cache>
        <distributed-cache name="authenticationSessions" owners="2">
            <expiration lifespan="-1"/>
        </distributed-cache>
        <distributed-cache name="offlineSessions" owners="2">
            <expiration lifespan="-1"/>
        </distributed-cache>
        <distributed-cache name="clientSessions" owners="2">
            <expiration lifespan="-1"/>
        </distributed-cache>
        <distributed-cache name="offlineClientSessions" owners="2">
            <expiration lifespan="-1"/>
        </distributed-cache>
        <distributed-cache name="loginFailures" owners="2">
            <expiration lifespan="-1"/>
        </distributed-cache>
        <local-cache name="authorization">
            <encoding>
                <key media-type="application/x-java-object"/>
                <value media-type="application/x-java-object"/>
            </encoding>
            <memory max-count="10000"/>
        </local-cache>
        <replicated-cache name="work">
            <expiration lifespan="-1"/>
        </replicated-cache>
        <local-cache name="keys">
            <encoding>
                <key media-type="application/x-java-object"/>
                <value media-type="application/x-java-object"/>
            </encoding>
            <expiration max-idle="3600000"/>
            <memory max-count="1000"/>
        </local-cache>
        <distributed-cache name="actionTokens" owners="2">
            <encoding>
                <key media-type="application/x-java-object"/>
                <value media-type="application/x-java-object"/>
            </encoding>
            <expiration max-idle="-1" lifespan="-1" interval="300000"/>
            <memory max-count="-1"/>
        </distributed-cache>
    </cache-container>
</infinispan>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-04-14 10:45:30

我想出来了:

首先,我将缓存-ispn.xml复制到同一个目录中的一个新文件中,并将其命名为cache.xml,然后将构建参数--cache- config - file = conf /cache-ispn.xml改为-cache-config-file=cache.xml,因此我只是删除了文件夹规范,因为Keycloak似乎自动将配置目录设置为conf文件夹。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71857674

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档