Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. #Sample kafkacat command to move messages from one topic to another - one liner!
  2. #####################################################################
  3.  
  4. #mycert2 topic is empty:
  5. #####################################################################
  6. mojave$ kafkacat -C -b localhost:9092 -t mycert2
  7. % Reached end of topic mycert2 [0] at offset 0
  8. % Reached end of topic mycert2 [1] at offset 0
  9. % Reached end of topic mycert2 [2] at offset 0
  10. ^Cmojave$
  11.  
  12. #mycert topic has messages:
  13. #####################################################################
  14. mojave$ kafkacat -C -b localhost:9092 -t mycert
  15. zero
  16. one
  17. two
  18. well
  19. how on earth
  20. is this funny?
  21. % Reached end of topic mycert [0] at offset 6
  22. ^Cmojave$
  23.  
  24. #redirect the consumer o/p of mycert until end of line (-e) to producer of empty topic:
  25. #####################################################################
  26.  
  27. mojave$ kafkacat -C -b localhost:9092 -t mycert -e | kafkacat -P -b localhost:9092 -t mycert2
  28. % Reached end of topic mycert [0] at offset 6: exiting
  29. mojave$
  30.  
  31. #The empty topic got populated with the messages of the other topic:
  32. #####################################################################
  33. mojave$ kafkacat -C -b localhost:9092 -t mycert2
  34. how on earth
  35. one
  36. two
  37. zero
  38. well
  39. is this funny?
  40. % Reached end of topic mycert2 [1] at offset 2
  41. % Reached end of topic mycert2 [2] at offset 3
  42. % Reached end of topic mycert2 [0] at offset 1
  43. ^Cmojave$
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement