How to view kafka message










15

















is there any way I can view the message content sent to kafka for a given topic? Say some thing like view last 5 messages for this topic, if that it possible.



thanks,
Sandeep










share|improve this question


























    15

















    is there any way I can view the message content sent to kafka for a given topic? Say some thing like view last 5 messages for this topic, if that it possible.



    thanks,
    Sandeep










    share|improve this question
























      15












      15








      15


      3








      is there any way I can view the message content sent to kafka for a given topic? Say some thing like view last 5 messages for this topic, if that it possible.



      thanks,
      Sandeep










      share|improve this question
















      is there any way I can view the message content sent to kafka for a given topic? Say some thing like view last 5 messages for this topic, if that it possible.



      thanks,
      Sandeep







      apache-kafka






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked May 29 '17 at 9:28









      SandySandy

      3111516




      3111516






















          2 Answers
          2






          active

          oldest

          votes


















          30














          You can use console consumer to view messages produced on some topic:



          bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning





          share|improve this answer

























          • This command also required --zookeeper details , I added those like - ./kafka-console-consumer.sh --zookeeper localhost:2181 --bootstrap-server localhost:9092 --topic test. But now I get - kafka.common.ConsumerRebalanceFailedException: console-consumer-18088_sp-1496052524018-50bb9338 can't rebalance after 4 retries at kafka.consumer.ZookeeperConsumerConnector$ZKRebalancerListener.syncedRebalance(ZookeeperConsumerConnector.scala:660) at

            – Sandy
            May 29 '17 at 10:11












          • Which is a separate issue. Take a look at this: stackoverflow.com/questions/22563401/…

            – vatsal mevada
            May 29 '17 at 10:15






          • 2





            Use bin/kafka-console-consumer.sh --new-consumer --bootstrap-server localhost:9092 --topic test --from-beginning

            – Luciano Afranllie
            May 29 '17 at 12:27






          • 1





            bootstrap-server vs. zookeeper is a matter of kafka version.

            – Joe Atzberger
            Sep 14 '17 at 23:07


















          3














          Use the Kafka consumer provided by Kafka :



          bin/kafka-console-consumer.sh --bootstrap-server BROKERS --topic TOPIC_NAME


          It will display the messages as it will receive it. Add --from-beginning if you want to start from the beginning.






          share|improve this answer






















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f44239027%2fhow-to-view-kafka-message%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            30














            You can use console consumer to view messages produced on some topic:



            bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning





            share|improve this answer

























            • This command also required --zookeeper details , I added those like - ./kafka-console-consumer.sh --zookeeper localhost:2181 --bootstrap-server localhost:9092 --topic test. But now I get - kafka.common.ConsumerRebalanceFailedException: console-consumer-18088_sp-1496052524018-50bb9338 can't rebalance after 4 retries at kafka.consumer.ZookeeperConsumerConnector$ZKRebalancerListener.syncedRebalance(ZookeeperConsumerConnector.scala:660) at

              – Sandy
              May 29 '17 at 10:11












            • Which is a separate issue. Take a look at this: stackoverflow.com/questions/22563401/…

              – vatsal mevada
              May 29 '17 at 10:15






            • 2





              Use bin/kafka-console-consumer.sh --new-consumer --bootstrap-server localhost:9092 --topic test --from-beginning

              – Luciano Afranllie
              May 29 '17 at 12:27






            • 1





              bootstrap-server vs. zookeeper is a matter of kafka version.

              – Joe Atzberger
              Sep 14 '17 at 23:07















            30














            You can use console consumer to view messages produced on some topic:



            bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning





            share|improve this answer

























            • This command also required --zookeeper details , I added those like - ./kafka-console-consumer.sh --zookeeper localhost:2181 --bootstrap-server localhost:9092 --topic test. But now I get - kafka.common.ConsumerRebalanceFailedException: console-consumer-18088_sp-1496052524018-50bb9338 can't rebalance after 4 retries at kafka.consumer.ZookeeperConsumerConnector$ZKRebalancerListener.syncedRebalance(ZookeeperConsumerConnector.scala:660) at

              – Sandy
              May 29 '17 at 10:11












            • Which is a separate issue. Take a look at this: stackoverflow.com/questions/22563401/…

              – vatsal mevada
              May 29 '17 at 10:15






            • 2





              Use bin/kafka-console-consumer.sh --new-consumer --bootstrap-server localhost:9092 --topic test --from-beginning

              – Luciano Afranllie
              May 29 '17 at 12:27






            • 1





              bootstrap-server vs. zookeeper is a matter of kafka version.

              – Joe Atzberger
              Sep 14 '17 at 23:07













            30












            30








            30







            You can use console consumer to view messages produced on some topic:



            bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning





            share|improve this answer















            You can use console consumer to view messages produced on some topic:



            bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Jan 25 at 20:12









            Andrew Theken

            2,54112349




            2,54112349










            answered May 29 '17 at 9:31









            vatsal mevadavatsal mevada

            1,52121839




            1,52121839












            • This command also required --zookeeper details , I added those like - ./kafka-console-consumer.sh --zookeeper localhost:2181 --bootstrap-server localhost:9092 --topic test. But now I get - kafka.common.ConsumerRebalanceFailedException: console-consumer-18088_sp-1496052524018-50bb9338 can't rebalance after 4 retries at kafka.consumer.ZookeeperConsumerConnector$ZKRebalancerListener.syncedRebalance(ZookeeperConsumerConnector.scala:660) at

              – Sandy
              May 29 '17 at 10:11












            • Which is a separate issue. Take a look at this: stackoverflow.com/questions/22563401/…

              – vatsal mevada
              May 29 '17 at 10:15






            • 2





              Use bin/kafka-console-consumer.sh --new-consumer --bootstrap-server localhost:9092 --topic test --from-beginning

              – Luciano Afranllie
              May 29 '17 at 12:27






            • 1





              bootstrap-server vs. zookeeper is a matter of kafka version.

              – Joe Atzberger
              Sep 14 '17 at 23:07

















            • This command also required --zookeeper details , I added those like - ./kafka-console-consumer.sh --zookeeper localhost:2181 --bootstrap-server localhost:9092 --topic test. But now I get - kafka.common.ConsumerRebalanceFailedException: console-consumer-18088_sp-1496052524018-50bb9338 can't rebalance after 4 retries at kafka.consumer.ZookeeperConsumerConnector$ZKRebalancerListener.syncedRebalance(ZookeeperConsumerConnector.scala:660) at

              – Sandy
              May 29 '17 at 10:11












            • Which is a separate issue. Take a look at this: stackoverflow.com/questions/22563401/…

              – vatsal mevada
              May 29 '17 at 10:15






            • 2





              Use bin/kafka-console-consumer.sh --new-consumer --bootstrap-server localhost:9092 --topic test --from-beginning

              – Luciano Afranllie
              May 29 '17 at 12:27






            • 1





              bootstrap-server vs. zookeeper is a matter of kafka version.

              – Joe Atzberger
              Sep 14 '17 at 23:07
















            This command also required --zookeeper details , I added those like - ./kafka-console-consumer.sh --zookeeper localhost:2181 --bootstrap-server localhost:9092 --topic test. But now I get - kafka.common.ConsumerRebalanceFailedException: console-consumer-18088_sp-1496052524018-50bb9338 can't rebalance after 4 retries at kafka.consumer.ZookeeperConsumerConnector$ZKRebalancerListener.syncedRebalance(ZookeeperConsumerConnector.scala:660) at

            – Sandy
            May 29 '17 at 10:11






            This command also required --zookeeper details , I added those like - ./kafka-console-consumer.sh --zookeeper localhost:2181 --bootstrap-server localhost:9092 --topic test. But now I get - kafka.common.ConsumerRebalanceFailedException: console-consumer-18088_sp-1496052524018-50bb9338 can't rebalance after 4 retries at kafka.consumer.ZookeeperConsumerConnector$ZKRebalancerListener.syncedRebalance(ZookeeperConsumerConnector.scala:660) at

            – Sandy
            May 29 '17 at 10:11














            Which is a separate issue. Take a look at this: stackoverflow.com/questions/22563401/…

            – vatsal mevada
            May 29 '17 at 10:15





            Which is a separate issue. Take a look at this: stackoverflow.com/questions/22563401/…

            – vatsal mevada
            May 29 '17 at 10:15




            2




            2





            Use bin/kafka-console-consumer.sh --new-consumer --bootstrap-server localhost:9092 --topic test --from-beginning

            – Luciano Afranllie
            May 29 '17 at 12:27





            Use bin/kafka-console-consumer.sh --new-consumer --bootstrap-server localhost:9092 --topic test --from-beginning

            – Luciano Afranllie
            May 29 '17 at 12:27




            1




            1





            bootstrap-server vs. zookeeper is a matter of kafka version.

            – Joe Atzberger
            Sep 14 '17 at 23:07





            bootstrap-server vs. zookeeper is a matter of kafka version.

            – Joe Atzberger
            Sep 14 '17 at 23:07













            3














            Use the Kafka consumer provided by Kafka :



            bin/kafka-console-consumer.sh --bootstrap-server BROKERS --topic TOPIC_NAME


            It will display the messages as it will receive it. Add --from-beginning if you want to start from the beginning.






            share|improve this answer



























              3














              Use the Kafka consumer provided by Kafka :



              bin/kafka-console-consumer.sh --bootstrap-server BROKERS --topic TOPIC_NAME


              It will display the messages as it will receive it. Add --from-beginning if you want to start from the beginning.






              share|improve this answer

























                3












                3








                3







                Use the Kafka consumer provided by Kafka :



                bin/kafka-console-consumer.sh --bootstrap-server BROKERS --topic TOPIC_NAME


                It will display the messages as it will receive it. Add --from-beginning if you want to start from the beginning.






                share|improve this answer













                Use the Kafka consumer provided by Kafka :



                bin/kafka-console-consumer.sh --bootstrap-server BROKERS --topic TOPIC_NAME


                It will display the messages as it will receive it. Add --from-beginning if you want to start from the beginning.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered May 29 '17 at 14:57









                ImbaBalboaImbaBalboa

                595318




                595318



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f44239027%2fhow-to-view-kafka-message%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    這個網誌中的熱門文章

                    How to read a connectionString WITH PROVIDER in .NET Core?

                    In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

                    Museum of Modern and Contemporary Art of Trento and Rovereto