I've dug some more info about this:

https://www.baeldung.com/jmx-ports

"First of all, we can disable exposing an application for local
connection from JConsole with the -XX:+DisableAttachMechanism option"

"Furthermore, starting from JDK 16, we can set the local port number"

"There's an additional option
-Dcom.sun.management.jmxremote.rmi.port=1234 that allows us to set the
RMI port to the same value as the JMX port."

Interesting. Shall we take advantage of any of these in ZooKeeper?

Andor





On Wed, 2023-06-07 at 11:20 +0200, Andor Molnar wrote:
> Confirmed on branch-3.5 too.
> 
> Thanks Enrico & Tison for the quick help. I'll close the ticket with
> the explanation.
> 
> Andor
> 
> 
> 
> On Wed, 2023-06-07 at 10:03 +0800, tison wrote:
> > Confirm with master.
> > 
> > With JMXDISABLE=1 bin/zkServer.sh start-foreground the extra port
> > doesn't
> > occur. So it should follow Enrico's analysis.
> > 
> > Best,
> > tison.
> > 
> > 
> > Enrico Olivelli <[email protected]> 于2023年6月6日周二 22:39写道:
> > 
> > > Andor
> > > 
> > > "Log4j 1.2 jmx support not found; jmx disabled."
> > > 
> > > This means that "log4j" JMX support is disabled.
> > > 
> > > You wrote in the very first line of your logs
> > > "$ bin/zkServer.sh start-foreground
> > > ZooKeeper JMX enabled by default"
> > > 
> > > 
> > > Enrico
> > > 
> > > Il giorno mar 6 giu 2023 alle ore 16:00 Andor Molnar
> > > <[email protected]> ha scritto:
> > > > Looks like we already have a ticket about it:
> > > > 
> > > > https://issues.apache.org/jira/browse/ZOOKEEPER-2910
> > > > 
> > > > Sure, I'll try to repro on master in a minute.
> > > > 
> > > > 
> > > > 
> > > > On Tue, 2023-06-06 at 21:24 +0800, tison wrote:
> > > > > Can you reproduce this on master? Or only happen on 3.4 and
> > > > > 3.5?
> > > > > 
> > > > > Best,
> > > > > tison.
> > > > > 
> > > > > 
> > > > > Andor Molnar <[email protected]> 于2023年6月6日周二 21:16写道:
> > > > > 
> > > > > > JMX is disabled by ManagedUtil:
> > > > > > 
> > > > > > 2023-06-06 14:56:48,384 [myid:] - INFO  [main:
> > > > > > ManagedUtil@47]
> > > > > > -
> > > > > > Log4j
> > > > > > 1.2 jmx support not found; jmx disabled.
> > > > > > 
> > > > > > Hence I don't see the 9010 tcp port bound. But why would a
> > > > > > random
> > > > > > ephemeral port still open?
> > > > > > 
> > > > > > Important that this port is random and keeps changing at
> > > > > > every
> > > > > > startup.
> > > > > > 
> > > > > > Andor
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > On Tue, 2023-06-06 at 15:08 +0200, Enrico Olivelli wrote:
> > > > > > > Andor,
> > > > > > > 
> > > > > > > Il giorno mar 6 giu 2023 alle ore 14:59 Andor Molnar
> > > > > > > <[email protected]> ha scritto:
> > > > > > > > Hi folks,
> > > > > > > > 
> > > > > > > > I cannot find an answer for this which annoys the hell
> > > > > > > > out of
> > > > > > > > me.
> > > > > > > > Please help to understand why ZooKeeper is binding a
> > > > > > > > local
> > > > > > > > ephemeral
> > > > > > > > port right after start without any quorum or client
> > > > > > > > socket
> > > > > > > > opened.
> > > > > > > > This
> > > > > > > > is what I see when start a 3.4 or 3.5 server is
> > > > > > > > standalone
> > > > > > > > mode.
> > > > > > > > (Same
> > > > > > > > behaviour is observed with quorum too)
> > > > > > > > 
> > > > > > > > $ bin/zkServer.sh start-foreground
> > > > > > > > ZooKeeper JMX enabled by default
> > > > > > > > Using config: /home/andor/git/my-
> > > > > > > > zookeeper/bin/../conf/zoo.cfg
> > > > > > > > 2023-06-06 14:56:48,378 [myid:] - INFO  [main:
> > > > > > > > QuorumPeerConfig@154]
> > > > > > > > -
> > > > > > > > Reading configuration from: /home/andor/git/my-
> > > > > > > > zookeeper/bin/../conf/zoo.cfg
> > > > > > > > ...
> > > > > > > > 2023-06-06 14:56:48,648 [myid:] - INFO  [main:
> > > > > > > > NIOServerCnxnFactory@689]
> > > > > > > > - binding to port 0.0.0.0/0.0.0.0:2181
> > > > > > > > 
> > > > > > > > ZooKeeper is running with PID 57126. Admin server is
> > > > > > > > disabled.
> > > > > > > > 
> > > > > > > > $ sudo netstat -plnt | grep 57126
> > > > > > > > tcp6       0      0
> > > > > > > > :::2181                 :::*                    LISTEN 
> > > > > > > >   
> > > > > > > >    571
> > > > > > > > 26/j
> > > > > > > > ava
> > > > > > > > tcp6       0      0
> > > > > > > > :::45669                :::*                    LISTEN 
> > > > > > > >   
> > > > > > > >    571
> > > > > > > > 26/j
> > > > > > > > ava
> > > > > > > > 
> > > > > > > > What is the second line??
> > > > > > > 
> > > > > > > It should be JMX
> > > > > > > 
> > > > > > > Enrico
> > > > > > > 
> > > > > > > > Thanks,
> > > > > > > > Andor
> > > > > > > > 
> > > > > > > > 
> > > > > > > > 

Reply via email to