【问题标题】:Zookeeper error: dataDir is not setZookeeper 错误:未设置 dataDir
【发布时间】:2021-10-24 05:41:41
【问题描述】:

我正在使用 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

谢谢!

【问题讨论】:

  • 您没有在 config/zookeeper.properties 中设置“dataDir”。检查文件以确保其配置符合预期。
  • 嗨!我的 zookeeper.properties 文件有 dataDir=/tmp/zookeeper/ 还有 clientPort=2181 和 maxClientCnxns=0
  • 我看过那个帖子,但不是同一个错误
  • 你说的zookeeper属性文件是config/zookeeper.properties吧?

标签: apache-kafka apache-zookeeper


【解决方案1】:

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

【讨论】:

    【解决方案2】:

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

    Zookeeper 应该以zookeeper.properties 开头,Kafka 应该以server.properties 开头。

    不要把这些弄混,否则两者都不会开始

    【讨论】:

      【解决方案3】:

      在 windows 上试试这个:

      对于动物园管理员:

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

      对于 Kafka 服务器:

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2022-11-21
        • 2014-01-14
        • 1970-01-01
        • 2017-01-24
        • 1970-01-01
        • 2019-02-19
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多