Start zookeeper listening on localhost only
- 03 Jan 2018: Post was created (diff)
I’m setting up a local kafka server with a backing zookeeper instance, but it listens on all interfaces (0.0.0.0
) by default.
To make zookeeper listen on localhost only, use clientPortAddress
in the config/zookeeper.properties
. My full config now looks like this:
dataDir=/tmp/zookeeper
clientPort=2181
clientPortAddress=localhost
maxClientCnxns=0
Now, when starting zookeeper, it prints the address it’s listening to
# cd kafka_2.12-1.0.0
# bin/zookeeper-server-start.sh config/zookeeper.properties
[ <redacted> ]
[2018-01-03 15:58:54,629] INFO binding to port localhost/127.0.0.1:2181 (org.apache.zookeeper.server.NIOServerCnxnFactory)
If you have any comments or feedback, please send me an e-mail. (stig at stigok dotcom).
Did you find any typos, incorrect information, or have something to add? Then please propose a change to this post.