How do I initialize the whitelist for Apache-Zookeeper?
Asked Answered
U

4

17

I'm new to Apache Kafka. I've installed it into a Ubuntu Linux VM (18.04).

I've started up Zookeeper from the Kafka directory with the default configuration. Apache Kafka Startup

The Zookeeper looks like it started successfully. From another Terminal window I am attempting to test. I'm connecting to it with Telnet and am attempting to send a "stat" command.

When I do so, I get the following error message: Zookeeper Error Message

I'm a newbie to Apache/kafka and have limited linux experience. I googled around but it wasn't really clear to me how to update the whitelist.

I found the following snippet from Zookeeper documentation:

4lw.commands.whitelist (Java system property: zookeeper.4lw.commands.whitelist)

New in 3.4.10: This property contains a list of comma separated Four Letter Words commands. It is introduced to provide fine grained control over the set of commands ZooKeeper can execute, so users can turn off certain commands if necessary. By default it contains all supported four letter word commands except "wchp" and "wchc", if the property is not specified. If the property is specified, then only commands listed in the whitelist are enabled.

Here's an example of the configuration that enables stat, ruok, conf, and isro command while disabling the rest of Four Letter Words command: 4lw.commands.whitelist=stat, ruok, conf, isro Users can also use asterisk option so they don't have to include every command one by one in the list. As an example, this will enable all four letter word commands: 4lw.commands.whitelist=*

Can someone please explain the whitelist usage and how to correctly initialize it?

Thanks, JohnB

Underweight answered 1/7, 2020 at 0:2 Comment(0)
U
12

This worked for me; setting the environment variable on the command line.

KAFKA_OPTS="-Dzookeeper.4lw.commands.whitelist=*" bin/zookeeper-server-start.sh config/zookeeper.properties
Underweight answered 1/7, 2020 at 21:17 Comment(0)
Z
31

For me, adding one of the following lines (or a variation) to the config/zookeeper.properties file (in the installation folder) worked.

  • 4lw.commands.whitelist=stat, ruok, conf, isro
  • 4lw.commands.whitelist=*
Zeniazenith answered 19/11, 2020 at 22:35 Comment(1)
thanks. it works for me! but... in latest version (3.6.3) there is another path to property file conf/zoo.cfgYeh
U
12

This worked for me; setting the environment variable on the command line.

KAFKA_OPTS="-Dzookeeper.4lw.commands.whitelist=*" bin/zookeeper-server-start.sh config/zookeeper.properties
Underweight answered 1/7, 2020 at 21:17 Comment(0)
E
8

For mac, I added

4lw.commands.whitelist=stat, ruok, conf, isro

in /usr/local/etc/zookeeper/zoo.cfg

Erving answered 6/2, 2021 at 13:8 Comment(0)
I
0

If zookeeper has been pulled through docker, use the below command to run the container:

docker run -e "ZOO_4LW_COMMANDS_WHITELIST=*" --name zc --restart always -d zookeeper
Ischium answered 25/9, 2023 at 5:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.