Zookeeper error: dataDir is not set
Asked Answered
G

3

5

I am using the kafka quickstart tutorial to set a producer-consumer connection. https://kafka.apache.org/quickstart

I have been using this tutorial for a while and it worked perfectly until now. When I run zookeeper:

bin/zookeeper-server-start.sh config/zookeeper.properties

I get the following error:

[2017-01-14 18:57:18,148] INFO Reading configuration from: config/server.properties (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
[2017-01-14 18:57:18,159] ERROR Invalid config, exiting abnormally (org.apache.zookeeper.server.quorum.QuorumPeerMain)
org.apache.zookeeper.server.quorum.QuorumPeerConfig$ConfigException: Error processing config/server.properties
at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:123)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:101)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:78)
Caused by: java.lang.IllegalArgumentException: dataDir is not set
at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parseProperties(QuorumPeerConfig.java:243)
at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:119)
... 2 more
Invalid config, exiting abnormally

This happened after killing manually some tail processes. How can I overcome this error? I already downloaded a new kafka quickstart folder but the error continues. My zookeeper.config file:

...
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# the directory where the snapshot is stored.
dataDir=/tmp/zookeeper
# the port at which the clients will connect
clientPort=2181
# disable the per-ip limit on the number of connections since this is a non-production config
maxClientCnxns=0

Thank you!

Goalkeeper answered 14/1, 2017 at 22:50 Comment(10)
You did not set 'dataDir' in config/zookeeper.properties. Check the file to ensure it's configured as expected.Chequerboard
Hi! My zookeeper.properties file has dataDir=/tmp/zookeeper/ also clientPort=2181 and maxClientCnxns=0Lambrecht
Possible duplicate of Zookeeper issue in setting kafkaPekoe
I have seen that post, but it's not the same errorLambrecht
The zookeeper properties file you mean is config/zookeeper.properties, right?Chequerboard
Yes, if you download the kafka package it is in the config folderLambrecht
This happened to me right after I killed some tail processesLambrecht
Can anyone help here?Lambrecht
If you already have it, delete /tmp/zookeeper dir and try again.Infielder
Hi! I do not have that directory..Lambrecht
A
7

The guide is actually mistaken ... in order to start Zookeeper you should point to the config/zookeeper.properties file instead.

Avi answered 7/8, 2017 at 15:19 Comment(1)
this worked for me, Quickstart from Kafka page is wrong, as stated here just do: bin/zookeeper-server-start.sh config/zookeeper.properties instead of bin/zookeeper-server-start.sh config/server.propertiesSwindle
G
4

Your start command says config/zookeeper.properties but your error message references config/server.properties.

Zookeeper should be started with zookeeper.properties and Kafka should be started with server.properties.

Don't get these mixed up or neither will start

Gracye answered 8/8, 2017 at 2:20 Comment(0)
E
3

Try this for windows:

For zookeeper:

.\bin\windows\zookeeper-server-start.bat .\config\zookeeper.properties

For Kafka Server:

.\bin\windows\kafka-server-start.bat .\config\server.properties
Ezana answered 14/7, 2020 at 5:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.