问题描述
当前以单机版ha模式设置密钥斗篷集群,以便能够在docker swarm上运行.在keycloak中,用户会话被缓存在嵌入式infinispan存储中,并且infinispan可以配置为跨集群的分布式缓存.
Currently setting up a keycloak cluster in standalone-ha mode, to be able to run on docker swarm. In keycloak, the user sessions are cached in an embedded infinispan store and infinispan can be configured to be a distributed cache across the cluster.
我也将所有者设置为2,但是问题是..在缩减期间,有可能丢失用户会话,如果在扩展期间杀死了包含缓存的两个所有者,向下.
I have also set the owner to be 2, but the problem is that.. during scale-down, there is a possibility for the user-sessions to be lost, If both the owners containing the cache are killed during scale-down.
我还阅读了有关Infinispan Redis缓存存储的信息,但是我不确定如何配置它.
I have also read about Infinispan Redis cache store, but I am not sure how to configure this.
问题1:是否可以将Keycloak Infinispan配置为使用Redis Store?
Question 1:Is it possible to configure Keycloak Infinispan to user a Redis Store ?
问题2:如果这不可能,那么有没有办法克服这个问题呢?
Question 2:If this is not possible, is there a way that one could overcome this problem ?
任何建议都会有所帮助.
Any suggestions would be helpful.
推荐答案
当期望动态扩展大型系统时,可以避免在配置中注册可用节点列表的这种限制.因此,在这里发现Redis节点是有好处的.
When expecting to scale large systems dynamically, it is expected to avoid such a constraint to register a list of available nodes in configurations. So Redis nodes discovery is a benefit here.
Infinispan本身支持Redis Store作为实现SPI和添加XML实体以简化配置的扩展:
Infinispan itself supports Redis Store as an extension implementing both SPI and adding XML entities to ease configuration:
https://github.com/infinispan/infinispan-cachestore-redis
http://infinispan.org/docs/stable/user_guide/user_guide.html#custom_cache_stores
但是,WildFly infinispan子系统中尚不支持此扩展,因为Keycloak依赖于WildFly.
But this extension is not supported (yet) in WildFly infinispan subsystem - as Keycloak relies on WildFly.
因此,我希望通过以下任务来为WildFly和Keycloak提供Infinispan Redis Store:
So I expect the following tasks to get Infinispan Redis Store available for WildFly, and so Keycloak:
-
为infinispam redis存储罐创建jboss模块-请参见
modules/system/layers/base/org/infinispan/
创建一个自定义缓存存储"工厂,该工厂能够通过WildFly配置键/值属性实例化Redis存储对象(存储,服务器和连接池).这也必须作为jboss模块添加到WildFly
Create a "Custom Cache Store" factory able to instanciate Redis Store objects (store, servers and connection pool) from WildFly configuration key/value properties. This has to be added to WildFly as a jboss module too
使用WildFly infinispan子系统本地缓存"自定义"来配置具有属性class
和properties
的工厂: https://wildscribe.github.io/WildFly/11.0/subsystem/infinispan/cache-container/local-cache/store/custom/index.html
Use WildFly infinispan subsystem "local-cache" "custom" to configure this factory with attributes class
and properties
: https://wildscribe.github.io/WildFly/11.0/subsystem/infinispan/cache-container/local-cache/store/custom/index.html
工作正在进行中,可能会发布代码和配置.
Work is in progress and it is possible code and configuration will be published.
这篇关于Keycloak-Infinispan Redis缓存存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!