問題描述
Kafka 連接器可以使用主鍵和時間戳來確定需要處理哪些行.
The Kafka Connector can make use of a primary key and a timestamp to determine which rows need to be processed.
我正在尋找一種重置連接器的方法,以便它從一開始就進行處理.
I'm looking for a way to reset the Connector so that it will process from the beginning of time.
推薦答案
因為要求是在分布式模式下運行,所以最簡單的做法是將連接器名稱更新為新值.這將提示在 connect-offsets 主題中創(chuàng)建一個新條目,因為它看起來像一個全新的連接器.然后連接器應(yīng)該再次開始讀取,好像還沒有向 Kafka 寫入任何內(nèi)容.您還可以手動向與該特定連接器關(guān)聯(lián)的連接偏移主題中的鍵發(fā)送墓碑消息,但重命名比處理它容易得多.此方法適用于所有源連接器,而不僅僅是此處描述的 JDBC 連接器.
Because the requirement is to run in distributed mode, the easiest thing to do is to update the connector name to a new value. This will prompt a new entry to be made into the connect-offsets topic as it looks like a totally new connector. Then the connector should start reading again as if nothing has been written to Kafka yet. You could also manually send a tombstone message to the key in the connect-offsets topic associated with that particular connector, but renaming is much easier than dealing with that. This method applies to all source connectors, not only the JDBC one described here.
這篇關(guān)于重置 JDBC Kafka 連接器以從一開始就開始拉行?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!