apache-kafka - 带有内部 RocksDB 状态存储的 Kafka 流应用程序无法获取密钥的数据
问题描述
我有一个运行 36 个不同实例(每个分区一个)的 kafka 流应用程序。我正在状态之上建立休息服务来访问数据。
这里有一些代码来访问数据
StreamsMetadata metadata = streams.metadataForKey(store, key, serializer); --> call this find ouy which host has the key
if (localSelf.host().equals(hostStoreInfo.getHost())) {
get the key from local store
}
else {
call the remote host using restTemplate
现在的问题是metadata
返回的对象具有不同的主机/IP,但数据位于不同的节点上。我能够看到使用我打印的一些应用程序日志。
allMetadata
on 方法说,当重新分配分区时,该KafkaStreams
值将被更新。但它不会发生以防万一。我能做什么。
解决方案
推荐阅读
- python - 如何在选定的时间后设置海龟的结束
- html - 悬停选择器不适用于这种情况?
- c++ - MAC OS 有类似 _wenviron 的东西吗?
- image - 使用 ar.js 增加对 nft 标记的识别容差?毛刺接受
- python - Django timezone.now() 给出错误的时间
- python-3.x - 如何重新排序字典中的键?
- flutter - 扑。创建列表
firestore 文档和集合 - c# - C# SSH Text, number Send?
- opengl - 纹理翻转行为
- r - 使用 dplyr::distinct() 时保留最后一次出现,而不是第一次出现(此处不能使用arrange())