我已使用缓存注释设置spring boot,如下所示:
@Configuration
@EnableAutoConfiguration(exclude = ElastiCacheAutoConfiguration.class)
@EnableElastiCache({@CacheClusterConfig(name = "prod-cache", expiration = 259200)})
@Profile("!local")
public class ClusterCache {}
这完美无缺。在此设置中,我创建了一个名为" prod-cache"的缓存。没有"群集模式启用(横向扩展)"启用;如下所示:
如果我使用"群集模式启用(缩小)"创建弹性缓存启用;并选择两个分片(每个分片为0个副本)我从我的应用程序收到以下错误:
引起: com.amazonaws.services.elasticache.model.CacheClusterNotFoundException: 找不到CacheCluster:prod-cache(服务:AmazonElastiCache;状态 代码:404;错误代码:CacheClusterNotFound;请求ID: 2e147019-bc6c-11e6-b7db-19f8baf0d46e)at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:1378) 在 com.amazonaws.http.AmazonHttpClient.executeOneRequest(AmazonHttpClient.java:924) 在 com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:702) 在 com.amazonaws.http.AmazonHttpClient.doExecute(AmazonHttpClient.java:454) 在 com.amazonaws.http.AmazonHttpClient.executeWithTimer(AmazonHttpClient.java:416) 在 com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:365) 在 com.amazonaws.services.elasticache.AmazonElastiCacheClient.doInvoke(AmazonElastiCacheClient.java:2899) 在 com.amazonaws.services.elasticache.AmazonElastiCacheClient.invoke(AmazonElastiCacheClient.java:2869) 在 com.amazonaws.services.elasticache.AmazonElastiCacheClient.describeCacheClusters(AmazonElastiCacheClient.java:1492) 在 org.springframework.cloud.aws.cache.ElastiCacheFactoryBean.createInstance(ElastiCacheFactoryBean.java:67) 在 org.springframework.cloud.aws.cache.ElastiCacheFactoryBean.createInstance(ElastiCacheFactoryBean.java:36) 在 org.springframework.beans.factory.config.AbstractFactoryBean.afterPropertiesSet(AbstractFactoryBean.java:134) 在 org.springframework.cloud.aws.cache.config.annotation.ElastiCacheCacheConfigurer.clusterCache(ElastiCacheCacheConfigurer.java:69) ...省略了89个常见帧
以下是导致错误的设置: