Skip to content

Instantly share code, notes, and snippets.

@leewin12
Created June 23, 2020 08:42
Show Gist options
  • Save leewin12/e706c166bf1e334bba280b3abbfce824 to your computer and use it in GitHub Desktop.
Save leewin12/e706c166bf1e334bba280b3abbfce824 to your computer and use it in GitHub Desktop.
how-to-reset-kafka-offset
offset reset (0.8.2 기준)
topic을 지워봐야 zookeeper에 보존된 low-level offset을 초기화 할 수 없음.
따라서 zookeeper shell에 접근해서 low-level offset을 초기화해야함.
[root@sv-kafka-dev01 bin]# ./zookeeper-shell.sh sv-zkdev1a.idincu.net:2181/kafka
Connecting to sv-zkdev1a.idincu.net:2181/kafka
ls /consumers
[panel.ptl.messages, analytic.ptl.messages, response.analytic.messages, panel.analytic.messages]
ls /consumers/response.analytic.messages
[offsets]
get /consumers/response.analytic.messages/offsets/response/0
7
cZxid = 0x424861
ctime = Mon Jul 23 15:15:11 KST 2018
mZxid = 0x3441d85
mtime = Tue Aug 20 23:21:49 KST 2019
pZxid = 0x424861
cversion = 0
dataVersion = 450
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 1
numChildren = 0
set /consumers/response.analytic.messages/offsets/response/0 0
0.9.0 이상에서는 위와 같은 방법 대신 bin/kafka-streams-application-reset.sh을 이용하는 아름다운 방법이 있음.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment