Not Able to see kafka.consumer and kafka.producer mBean in jConsole
Asked Answered
B

0

1

EDIT : I come to know that I should enable JMX in my Consumer and Producer processes and get mBean info from respective processes. How will i do this for a Java process publishing message to Kafka and other Java processes consuming messages ?

I have enabled JMX for Kafka . But still I cant see those two mBeans in jConsole.

I tried pub/sub onn Kafka broker but still no results . My steps were as follows : Added following in kafka-run-class.sh:

KAFKA_JMX_OPTS="-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=127.0.1.1 -Djava.net.preferIPv4Stack=true"

Added port in export JMX_PORT=${JMX_PORT:-9999} in kafka-server-start.sh

jCOnsole mBean screenshot

Beore answered 19/9, 2018 at 2:34 Comment(11)
You need to add java arguments to the Producer application if you want metrics from it. Producer and consumer metrics won't appear on the brokersDichromate
@cricket_007 I still dont have a Producer / Consumer application . Just want to confirm if I shoudl add Java arguments in same kafka-run-class.sh file for Producer / Consumer or it will be some different file ?Beore
You wouldn't use kafka-run-class to start either of those. It's typically just java jar... options... app.jar because you don't need Kafka files installed or available to run a producer or consumer applicationDichromate
@cricket_007 this is really helpful . will be in touch as I am working on Kafka these days .Beore
@cricket_007 is there a way to enable JMX without restarting Kafka ? or should i create another thread?Beore
Again, you wouldn't enable JMX on the Kafka server processes to get the information you're asking for, so no, you don't need to restart itDichromate
@cricket_007 i have a new question now #52479509 . Please have a look .Beore
Hi @DivyanshuJimmy, I am also trying to configure Metrics for Kafka via JMX. I am using docker for Kafka and zookeeper. I need steps how to configure JMX for kafka. Can you please help me with that ? TIAGelatinize
@Gelatinize If you read my question again I have all steps there itself. for producer and consumerenable jmx int there respective processes using the configuration in my description .Beore
@DivyanshuJimmy, In your steps you have set the parameters on kafka broker and restarted the kafka-run-class.sh. And you have started the jconsole on broker itself. However, When I tried it, I have only setup the parameters on broker and restarted the broker. And Ran the jconsole on consumer side to get consumer metrics. Just want to check if I missed any step or doing it wrong all together. I am able to see the metrics correctly though.Gelatinize
@Gelatinize , you did it the right way !Beore

© 2022 - 2024 — McMap. All rights reserved.