Hey Jorge, I looked into it, and can reproduce the second LISTEN port in a vanilla Kafka Connect cluster without any connectors running.
Using jstack, I see that there are two threads that appear to be waiting in the corresponding accept methods: "RMI TCP Accept-0" #15 daemon prio=5 os_prio=31 cpu=0.37ms elapsed=790.61s tid=0x00000001370f5a00 nid=0x6d03 runnable [0x000000017255e000] java.lang.Thread.State: RUNNABLE at sun.nio.ch.Net.accept(java.base@17.0.4.1/Native Method) "qtp1530870688-33-acceptor-0@45f75f75-http_8083@43826ec{HTTP/1.1, (http/1.1)}{0.0.0.0:8083}" #33 prio=3 os_prio=31 cpu=0.17ms elapsed=789.45s tid=0x000000012712e400 nid=0x8707 runnable [0x00000001737ca000] java.lang.Thread.State: RUNNABLE at sun.nio.ch.Net.accept(java.base@17.0.4.1/Native Method) The latter appears to be the 8083 port which is serving the REST API, and is expected. The former appears to be a Java Remote Method Invocation socket on "port 0" which ends up selecting a random open port on each startup. I do see that RMI is often used to export JMX metrics, and it appears that kafka-run-class.sh (which is used when starting Kafka Connect) by default enables JMX metrics. I was able to disable the RMI port by setting the KAFKA_JMX_OPTS="-Dkey=value" environment variable before running bin/connect-distributed.sh. This isn't a recommendation for you, but proves that the default KAFKA_JMX_OPTS settings from the kafka-run-class.sh are relevant. Thanks for the question, I learned something new! Greg Harris On Fri, May 19, 2023 at 4:45 AM Jorge Martin Cristobal <jmar...@stratio.com> wrote: > > Hi all, > > I'm testing apache kafka connect for a project and I found that the main > process listens to two different ports, the one to provide REST api, 8083 > by default, and a different unprivileged port that changes its number each > restart. For instance, this is fragment of the output from netstat command: > tcp 0 0 0.0.0.0:8083 0.0.0.0:* LISTEN 28646/java > tcp 0 0 0.0.0.0:42859 0.0.0.0:* LISTEN 28646/java <--THIS > > What's the purpose of that port?. Is there any public definition of that > interface? I haven't found any documentation wrt that port number. > Kindly regards, > > Jorge M.