pls help
We have 2 kafka topic. I want copy 10 message from beginning from topic1 to topic2.
I`m try do it with kafka-console-consumer and kafka-console-producer
First i save 10 message from topic1 to some directory:
for (( i=1; i<=10; i++ )); do bin/kafka-console-consumer.sh --bootstrap-server 1.1.2.3:9092 --group CONSUMER1 --topic TOPIC1 --max-messages 1 > /tmp/_topic/$i.msg; done;
then i try with kafka-console-producer send it to topic2:
for (( i=1; i<=10; i++ )); do bin/kafka-console-producer.sh --broker-list 1.1.2.4:9092 --topic TOPIC2 < /tmp/_topic/$i.msg; done;
And i got error - my service Can't deserialize data. My question is:
- does my solution will work ?
- Why i can reciev this error ?
- What is best way to copy message from one topic to another once ?
UPD: How i`m solve this problem (thanks: Robin Moffatt): I using kafka-mirror and this jar : https://github.com/opencore/mirrormaker_topic_rename with this i can copy message from one topic kafka to another on one cluster