在我的Spring应用程序中,我使用了以下缓存(ehcache):
<bean id="statelessTicketCache"
class="org.springframework.security.cas.authentication.EhCacheBasedTicketCache">
<property name="cache">
<bean id="ehcache" class="net.sf.ehcache.Cache" init-method="initialise"
destroy-method="dispose">
<constructor-arg value="casTickets" />
<constructor-arg value="0" />
<constructor-arg value="true" />
<constructor-arg value="false" />
<constructor-arg value="3600" />
<constructor-arg value="900" />
<property name="cacheManager" ref="cacheManager" />
</bean>
</property>
</bean>在这个缓存中,我存储对API后端的访问票。每件事都与单个节点Tomcat8完美地工作。但是,当我尝试在我的AWS集群中使用两个或多个实例时,负载均衡器(ELB)和N Tomcat(在EC2实例上)都会遇到这样的问题,即每个节点都使用自己的statelessTicketCache实例进行操作。
我需要在集群中复制这个ehcache statelessTicketCache。有可能吗?如果是这样的话,您能提供一个示例配置吗?
更新
我想,我将从Ehcache解决方案中移开,尝试使用Redis(AWS Elastic cache on Redis engine)配置statelessTicketCache,并使用Spring无状态票缓存Redis的以下实现https://github.com/vnomics/spring-stateless-ticket-cache-redis
发布于 2016-02-10 21:43:11
我已经从Ehcache解决方案中移出,用Redis (在Redis引擎上使用AWS弹性缓存)配置了statelessTicketCache,并使用Spring无状态票证缓存Redis的以下实现https://github.com/vnomics/spring-stateless-ticket-cache-redis。
现在一切都很好。
https://stackoverflow.com/questions/35301741
复制相似问题