Moving the export statement to kafka-server.start.sh fixed the issue. I was
able to start kafka with JMX monitoring and run kafka-topics.sh.

Thanks Lance.



On Mon, Sep 14, 2015 at 6:43 PM, Lance Laursen <llaur...@rubiconproject.com>
wrote:

> This is not a bug. The java process spawned by kafka-topics.sh is trying to
> bind to 9998 upon start. The java process spawned by kafka-server-start.sh
> already owns that port. It's doing this because both of these scripts use
> kafka-run-class.sh and that is where you defined your 'export JMX_PORT'.
>
> Put your export statement into kafka-server-start.sh instead and run
> kafka-topics.sh using a separate terminal or user account. Also, google
> search "linux environment variables." You could also just run
> kafka-topics.sh from a separate host, such as your workstation, so long as
> it can see zookeeper:2181.
>
> On Mon, Sep 14, 2015 at 3:52 PM, allen chan <allen.michael.c...@gmail.com>
> wrote:
>
> > After completely disabling JMX settings, i was able to create topics.
> Seems
> > like there is an issue with using JMX with the product. Should i create
> > bug?
> >
> > On Sun, Sep 13, 2015 at 9:07 PM, allen chan <
> allen.michael.c...@gmail.com>
> > wrote:
> >
> > > Changing the port to 9998 did not help. Still the same error occurred
> > >
> > > On Sat, Sep 12, 2015 at 12:27 AM, Foo Lim <foo....@vungle.com> wrote:
> > >
> > >> Try throwing
> > >>
> > >> JMX_PORT=9998
> > >>
> > >> In front of the command. Anything other than 9994
> > >>
> > >> Foo
> > >>
> > >> On Friday, September 11, 2015, allen chan <
> allen.michael.c...@gmail.com
> > >
> > >> wrote:
> > >>
> > >> > Hi all,
> > >> >
> > >> > First time testing kafka with brand new cluster.
> > >> >
> > >> > Running into an issue that i do not understand.
> > >> >
> > >> > Server started up fine but I get error when trying to create a
> topic.
> > >> >
> > >> > *[achan@server1 ~]$ ps -ef | grep -i kafka*
> > >> > *root      6507     1  0 15:42 ?        00:00:00 sudo
> > >> > /opt/kafka_2.10-0.8.2.1/bin/kafka-server-start.sh
> > >> > /opt/kafka_2.10-0.8.2.1/config/server.properties*
> > >> > *root      6508  6507  0 15:42 ?        00:00:36 java -Xmx1G -Xms1G
> > >> -server
> > >> > -XX:+UseParNewGC -XX:+UseConcMarkSweepGC
> -XX:+CMSClassUnloadingEnabled
> > >> > -XX:+CMSScavengeBeforeRemark -XX:+DisableExplicitGC
> > >> > -Djava.awt.headless=true
> > >> > -Xloggc:/opt/kafka_2.10-0.8.2.1/bin/../logs/kafkaServer-gc.log
> > >> -verbose:gc
> > >> > -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps
> > >> > -Dcom.sun.management.jmxremote -Djava.rmi.server.hostname=server1
> > >> > -Dcom.sun.management.jmxremote.authenticate=false
> > >> > -Dcom.sun.management.jmxremote.ssl=false
> > >> > -Dcom.sun.management.jmxremote.port=9994
> > >> > -Dkafka.logs.dir=/opt/kafka_2.10-0.8.2.1/bin/../logs
> > >> >
> > >> >
> > >>
> >
> -Dlog4j.configuration=file:/opt/kafka_2.10-0.8.2.1/bin/../config/log4j.properties
> > >> > -cp
> > >> >
> > >> >
> > >>
> >
> :/opt/kafka_2.10-0.8.2.1/bin/../core/build/dependant-libs-2.10.4*/*.jar:/opt/kafka_2.10-0.8.2.1/bin/../examples/build/libs//kafka-examples*.jar:/opt/kafka_2.10-0.8.2.1/bin/../contrib/hadoop-consumer/build/libs//kafka-hadoop-consumer*.jar:/opt/kafka_2.10-0.8.2.1/bin/../contrib/hadoop-producer/build/libs//kafka-hadoop-producer*.jar:/opt/kafka_2.10-0.8.2.1/bin/../clients/build/libs/kafka-clients*.jar:/opt/kafka_2.10-0.8.2.1/bin/../libs/jopt-simple-3.2.jar:/opt/kafka_2.10-0.8.2.1/bin/../libs/kafka_2.10-0.8.2.1.jar:/opt/kafka_2.10-0.8.2.1/bin/../libs/kafka_2.10-0.8.2.1-javadoc.jar:/opt/kafka_2.10-0.8.2.1/bin/../libs/kafka_2.10-0.8.2.1-scaladoc.jar:/opt/kafka_2.10-0.8.2.1/bin/../libs/kafka_2.10-0.8.2.1-sources.jar:/opt/kafka_2.10-0.8.2.1/bin/../libs/kafka_2.10-0.8.2.1-test.jar:/opt/kafka_2.10-0.8.2.1/bin/../libs/kafka-clients-0.8.2.1.jar:/opt/kafka_2.10-0.8.2.1/bin/../libs/log4j-1.2.16.jar:/opt/kafka_2.10-0.8.2.1/bin/../libs/lz4-1.2.0.jar:/opt/kafka_2.10-0.8.2.1/bin/../libs/metrics-core-2.2.0.jar:/opt/kafka_2.10-0.8.2.1/bin/../libs/scala-library-2.10.4.jar:/opt/kafka_2.10-0.8.2.1/bin/../libs/slf4j-api-1.7.6.jar:/opt/kafka_2.10-0.8.2.1/bin/../libs/slf4j-log4j12-1.6.1.jar:/opt/kafka_2.10-0.8.2.1/bin/../libs/snappy-java-1.1.1.6.jar:/opt/kafka_2.10-0.8.2.1/bin/../libs/zkclient-0.3.jar:/opt/kafka_2.10-0.8.2.1/bin/../libs/zookeeper-3.4.6.jar:/opt/kafka_2.10-0.8.2.1/bin/../core/build/libs/kafka_2.10*.jar
> > >> > kafka.Kafka /opt/kafka_2.10-0.8.2.1/config/server.properties*
> > >> >
> > >> >
> > >> > *[achan@server1 ~]$ sudo
> /opt/kafka_2.10-0.8.2.1/bin/kafka-topics.sh
> > >> > --create –zookeeper server1:2181 –partition 3 –replica 0 –topic
> > >> test.logs*
> > >> > *[sudo] password for achan:*
> > >> > *Error: Exception thrown by the agent :
> > java.rmi.server.ExportException:
> > >> > Port already in use: 9994; nested exception is:*
> > >> > * java.net.BindException: Address already in use*
> > >> >
> > >> > I have pretty much the manila kakfa-run-class.sh except i added the
> > >> > following
> > >> > *export JMX_PORT=9994* (near the top of the file)
> > >> > and
> > >> > *Djava.rmi.server.hostname=sever1* (to the KAFKA_JMX_OPTS)
> > >> >
> > >> > JMX monitoring is working perfectly on 9994.
> > >> >
> > >> > Has anyone else run into this issue?
> > >> >
> > >> >
> > >> > Thanks
> > >> > --
> > >> > Allen Michael Chan
> > >> >
> > >>
> > >
> > >
> > >
> > > --
> > > Allen Michael Chan
> > >
> >
> >
> >
> > --
> > Allen Michael Chan
> >
>



-- 
Allen Michael Chan

Reply via email to