我正在研究 Lettuce 集群 Java 客户端。它在拓扑结构 (Apache Strom) 中设置bolt
。spout
正在从 读取数据kafka
并将其传递给bolt
。但是,当我开始我的拓扑时,我收到以下错误消息并且程序终止。我错过了什么吗?是什么原因造成的?
29502 [Thread-17-RecommendationLettuceBolt-executor[2 2]] 错误 oasutil - 异步循环已死!io.lettuce.core.RedisException:无法从 io.lettuce.core.cluster.RedisClusterClient.loadPartitions(RedisClusterClient.java:865)的初始 URI [RedisURI [host='127.0.0.1', port=7001]] 检索初始集群分区) ~[lettuce-core-5.1.7.RELEASE.jar:?] 在 io.lettuce.core.cluster.RedisClusterClient.initializePartitions(RedisClusterClient.java:819) ~[lettuce-core-5.1.7.RELEASE.jar: ?] 在 io.lettuce.core.cluster.RedisClusterClient.connect(RedisClusterClient.java:345) ~[lettuce-core-5.1.7.RELEASE.jar:?] 在 com.projectName.indexer.lettuce.LettuceClusterClientProvider.getConnection( LettuceClusterClientProvider.java:72) ~[classes/:?] 在 com.projectName.indexer.lettuce.LettuceCacheRepopulationHandler。
private void init() {
redisUri = RedisURI.Builder
.redis(lettuceConfig.getLettuceClusterHost())
.withPort(lettuceConfig.getLettuceClusterPort())
.withTimeout(Duration.ofMillis(lettuceConfig.getLettuceClusterTimeout()))
.build();
}
public StatefulRedisClusterConnection getConnection() {
if (connection == null || !connection.isOpen()) {
redisClusterClient = RedisClusterClient.create(redisUri);
final ClusterTopologyRefreshOptions topologyRefreshOptions = ClusterTopologyRefreshOptions.builder()
.enablePeriodicRefresh(Duration.ofMinutes(BoltConstants.Lettuce.PERIODIC_REFRESH_TIME_IN_MIN))
.enableAdaptiveRefreshTrigger()
.build();
final ClusterClientOptions clusterClientOptions = ClusterClientOptions.builder()
.autoReconnect(true)
.topologyRefreshOptions(topologyRefreshOptions)
.build();
}
return connection;
}
环境
compile 'io.lettuce:lettuce-core:5.1.7.RELEASE'
郎朗坤
相关分类