【问题标题】:Zookeeper on WindowsWindows 上的动物园管理员
【发布时间】:2020-11-30 08:56:50
【问题描述】:

我在 windows 环境下运行 zookeeper 时遇到一些困难。

我下载了 zookeeper 3.4.6。提取它。在 conf 文件夹中创建了 zoo.cfg,详细信息如下:

# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial 
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between 
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just 
# example sakes.
dataDir=/tmp/zookeeper
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the 
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1

然后我尝试从 bin 文件夹中运行 zkServer.cmd。但我不确定这是否会运行。

如何测试 Zookeeper Server 是否在 Windows 上运行?

【问题讨论】:

    标签: java windows apache-zookeeper


    【解决方案1】:

    如果您想查看结果,请以管理员身份从 windows 命令行工具运行 zkServer.cmd,而不是单击它会在最后关闭,您将无法看到结果。

    此外,您应该将 dataDir 更新为 C:/tmp/... 格式的有效 Windows 目录。

    在命令行中,调用 zkServer.cmd 后,你应该可以在命令行上看到不同的 [INFO] 消息,最后一条绑定到端口 0.0.0.0/0.0.0.0:2181。

    【讨论】:

    • 谢谢!!我将 dataDir 更改为 C:/tmp/ 并修复了我的 java 主路径的问题。这很好用!
    【解决方案2】:

    这里是windows的命令:

    C:\kafka_2.12-2.3.1>.\bin\windows\zookeeper-server-start.bat .\config\zookeeper.properties

    C:\kafka_2.12-2.3.1>.\bin\windows\kafka-server-start.bat .\config\server-1.properties

    C:\kafka_2.12-2.3.1>.\bin\windows\kafka-topics.bat --create --bootstrap-server localhost:9093 --partitions 2 --replication-factor 2 --topic user-tracking

    C:\kafka_2.12-2.3.1>.\bin\windows\kafka-topics.bat --list --bootstrap-server localhost:9093

    【讨论】:

      【解决方案3】:

      确保您的 Zookeeper 服务器未在 Windows 中运行。 甚至在 docker 中都不活跃(如果已安装)。如果在 docker 中处于活动状态,请禁用 docker。

      运行以下命令

      %KAFKA_HOME%\bin\windows\zookeeper-server-stop.bat 
      

      你会得到这样的回应 -

      No Instance(s) Available.
      

      然后运行以下命令:

      %KAFKA_HOME%\bin\windows\zookeeper-server-start.bat KAFKA_HOME%\etc\kafka\zookeeper.properties
      

      【讨论】:

        猜你喜欢
        • 2023-04-05
        • 1970-01-01
        • 2013-09-14
        • 2015-09-27
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-10-01
        • 1970-01-01
        相关资源
        最近更新 更多