【发布时间】:2021-04-06 23:34:16
【问题描述】:
我遇到了我的主题,尽管正在运行和操作并没有注册我的 MongoDB 中发生的事件。
每次我插入/修改记录时,我都不再从 kafka-console-consumer 命令获取日志。
有没有办法清除 Kafka 的缓存/偏移量? 源和接收器连接已启动并正在运行。整个集群也很健康,只是一切正常,但每隔几周我就会看到这种情况再次出现,或者当我从其他位置登录我的 Mongo 云时。
--partition 0 参数没有帮助,将retention_ms 也更改为1。
我检查了两个连接器的状态并得到了RUNNING:
curl localhost:8083/connectors | jq
curl localhost:8083/connectors/monit_people/status | jq
运行docker-compose logs connect我发现:
WARN Failed to resume change stream: Resume of change stream was not possible, as the resume point may no longer be in the oplog. 286
If the resume token is no longer available then there is the potential for data loss.
Saved resume tokens are managed by Kafka and stored with the offset data.
When running Connect in standalone mode offsets are configured using the:
`offset.storage.file.filename` configuration.
When running Connect in distributed mode the offsets are stored in a topic.
Use the `kafka-consumer-groups.sh` tool with the `--reset-offsets` flag to reset offsets.
Resetting the offset will allow for the connector to be resume from the latest resume token.
Using `copy.existing=true` ensures that all data will be outputted by the connector but it will duplicate existing data.
Future releases will support a configurable `errors.tolerance` level for the source connector and make use of the `postBatchResumeToken
【问题讨论】:
-
你错过了
--from-beginning吗?否则,您只会阅读新消息。您如何检查连接器的健康状况?那里的 up/healthy 仅验证连接 http 服务器已启动,没有任何单个连接器在工作 -
过去我也没有使用过
--from-beginning。我用curl localhost:8083/connectors/monit_people/status | jq运行curl localhost:8083/connectors | jq,状态为RUNNING -
您使用的是哪个 mongo 连接器?您的 docker 图像是否在“每两周”期间的任何时候停止?如果是这样,并且您没有使用卷挂载,那么是的 - Docker 正在删除 Kafka 数据
-
您也可以在
docker-compose logs connect中查找错误 -
连接器:
https://www.confluent.io/hub/mongodb/kafka-connect-mongodb和https://www.confluent.io/hub/snowflakeinc/snowflake-kafka-connector。当我完成学习后,我只需将 docker imagie 与docker container stop $(docker container ls -a -q -f "label=io.confluent.docker")
标签: mongodb apache-kafka apache-kafka-connect mongodb-kafka-connector