Updated on 2026-06-27 GMT+08:00

Why Do ZooKeeper netcat Commands Fail Over Secure Netty?

Question

Executing four-letter commands via Linux netcat fails when secure netty configurations are enabled on the ZooKeeper server. Why does this issue occur?

For example:

echo stat |netcat host port

Answer

The Linux netcat command lacks an option to communicate with a ZooKeeper server securely, so it cannot support ZooKeeper four-letter commands when secure Netty configurations are enabled.

To avoid this problem, you can use the Java API below to execute four-letter commands.

org.apache.zookeeper.client.FourLetterWordMain

For example:

String[] args = new String[]{host, port, "stat"};
org.apache.zookeeper.client.FourLetterWordMain.main(args);

The netcat command should be used only with a non-secure Netty configuration.