Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Sample kafkacat command to move messages from one topic to another - one liner!
- #####################################################################
- #mycert2 topic is empty:
- #####################################################################
- mojave$ kafkacat -C -b localhost:9092 -t mycert2
- % Reached end of topic mycert2 [0] at offset 0
- % Reached end of topic mycert2 [1] at offset 0
- % Reached end of topic mycert2 [2] at offset 0
- ^Cmojave$
- #mycert topic has messages:
- #####################################################################
- mojave$ kafkacat -C -b localhost:9092 -t mycert
- zero
- one
- two
- well
- how on earth
- is this funny?
- % Reached end of topic mycert [0] at offset 6
- ^Cmojave$
- #redirect the consumer o/p of mycert until end of line (-e) to producer of empty topic:
- #####################################################################
- mojave$ kafkacat -C -b localhost:9092 -t mycert -e | kafkacat -P -b localhost:9092 -t mycert2
- % Reached end of topic mycert [0] at offset 6: exiting
- mojave$
- #The empty topic got populated with the messages of the other topic:
- #####################################################################
- mojave$ kafkacat -C -b localhost:9092 -t mycert2
- how on earth
- one
- two
- zero
- well
- is this funny?
- % Reached end of topic mycert2 [1] at offset 2
- % Reached end of topic mycert2 [2] at offset 3
- % Reached end of topic mycert2 [0] at offset 1
- ^Cmojave$
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement