You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@zookeeper.apache.org by Zisis T <zi...@runbox.com> on 2014/07/25 13:23:56 UTC
Zookeeper listening to ports other than clientPort and server.x
ports
Hi all,
I've configured a Zookeeper cluster of 3 servers. The configuration of each
one of the servers follows
~~~~~~~~ Server myid=1 PID:16543~~~~~~~~~~~~~
dataDir=/opt/zookeeper-3.4.6/zookeeper-data/1
clientPort=6815
server.1=mymachine:6816:6817
server.2=mymachine:6818:6819
server.3=mymachine:6820:6821
~~~~~~~~ Server myid=2 PID:16815~~~~~~~~~~~~~
dataDir=/opt/zookeeper-3.4.6/zookeeper-data/2
clientPort=6825
server.1=mymachine:6816:6817
server.2=mymachine:6818:6819
server.3=mymachine:6820:6821
~~~~~~~~ Server myid=3 PID:16866~~~~~~~~~~~~~
dataDir=/opt/zookeeper-3.4.6/zookeeper-data/2
clientPort=6835
server.1=mymachine:6816:6817
server.2=mymachine:6818:6819
server.3=mymachine:6820:6821
I expect the above configuration - once the quorum is up and functional - to
make use only of the ports defined (6815,6825,6835,
6816,6817,6818,6819,6820,6821)
Calling a "netstat -nap" on all 3 of the above processes I get the following
results.
~~~~~~~~~~~~ netstat for zk process with myid=1 ~~~~~~~~~~~~~~~
tcp6 0 0 :::6815 :::* LISTEN
16543/java
tcp6 0 0 127.0.1.1:6816 :::* LISTEN
16543/java
tcp6 0 0 127.0.1.1:6817 :::* LISTEN
16543/java
tcp6 0 0 :::34657 :::* LISTEN
16543/java
tcp6 0 0 127.0.1.1:6817 127.0.0.1:50770
ESTABLISHED 16543/java
tcp6 0 0 127.0.1.1:6817 127.0.0.1:50766
ESTABLISHED 16543/java
tcp6 0 0 127.0.1.1:6816 127.0.0.1:60441
ESTABLISHED 16543/java
tcp6 0 0 127.0.1.1:6816 127.0.0.1:60437
ESTABLISHED 16543/java
~~~~~~~~~~~~ netstat for zk process with myid=2 ~~~~~~~~~~~~~~~
tcp6 0 0 127.0.1.1:6821 :::* LISTEN
16815/java
tcp6 0 0 :::6835 :::* LISTEN
16815/java
tcp6 0 0 :::47926 :::* LISTEN
16815/java
tcp6 0 0 127.0.0.1:60437 127.0.1.1:6816
ESTABLISHED 16815/java
tcp6 0 0 127.0.0.1:55381 127.0.1.1:6819
ESTABLISHED 16815/java
tcp6 0 0 127.0.0.1:50766 127.0.1.1:6817
ESTABLISHED 16815/java
~~~~~~~~~~~~ netstat for zk process with myid=3 ~~~~~~~~~~~~~~~
tcp6 0 0 127.0.1.1:6819 :::* LISTEN
16866/java
tcp6 0 0 :::6825 :::* LISTEN
16866/java
tcp6 0 0 :::46305 :::* LISTEN
16866/java
tcp6 0 0 127.0.1.1:6819 127.0.0.1:55381
ESTABLISHED 16866/java
tcp6 0 0 127.0.0.1:60441 127.0.1.1:6816
ESTABLISHED 16866/java
tcp6 0 0 127.0.0.1:50770 127.0.1.1:6817
ESTABLISHED 16866/java
I see a lot of "randomly chosen" ports opened. I'd expect all communications
to be established between the ports defined in the configuration. Am I doing
something wrong? Due to these "random ports" I get port conficts with other
services running on the same machine.
I'm using zookeeper 3.4.6 and java 1.7.0_60
--
View this message in context: http://zookeeper-user.578899.n2.nabble.com/Zookeeper-listening-to-ports-other-than-clientPort-and-server-x-ports-tp7580137.html
Sent from the zookeeper-user mailing list archive at Nabble.com.
Re: Zookeeper listening to ports other than clientPort and server.x
ports
Posted by Zisis T <zi...@runbox.com>.
Well, after a bit of researching it turns out that since Zookeeper servers
act as both client (trying to connect to other servers) and server
(listening for connections from other zk servers) it must choose an
ephemeral port when trying to connect to other server (as client).
This ephemeral port is taken from the range defined by the output of the
following command
sysctl net.ipv4.ip_local_port_range
which in my case was 32768-61000.
--
View this message in context: http://zookeeper-user.578899.n2.nabble.com/Zookeeper-listening-to-ports-other-than-clientPort-and-server-x-ports-tp7580137p7580138.html
Sent from the zookeeper-user mailing list archive at Nabble.com.