Zookeeper错误:未设置dataDir

时间:2017-01-14 22:50:24

标签: apache-kafka apache-zookeeper

我正在使用kafka快速入门教程来设置生产者 - 消费者连接。 https://kafka.apache.org/quickstart

我已经使用这个教程一段时间了,它一直运作到现在。 当我运行zookeeper:

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

我收到以下错误:

[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

这是在手动杀死一些尾部进程后发生的。我怎样才能克服这个错误?我已经下载了一个新的kafka quickstart文件夹,但错误仍在继续。我的zookeeper.config文件:

...
# 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

谢谢!

3 个答案:

答案 0 :(得分:1)

您的启动命令显示config/zookeeper.properties,但您的错误消息引用了config/server.properties

Zookeeper应该以{{1​​}}开头,而Kafka应该以{{1​​}}开头。

不要混淆这些或不会开始

答案 1 :(得分:1)

在Windows上尝试以下操作:

对于动物园管理员:

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

对于Kafka服务器:

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

答案 2 :(得分:0)

指南实际上是错误的...为了启动Zookeeper,你应该指向config / zookeeper.properties文件。