有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

Windows上的java Zookeeper

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

我下载了zookeeper 3.4.6。提取了它。创建了一个动物园。conf文件夹中的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

然后我试着运行zkServer。从bin文件夹中选择cmd。但我不确定这是否有效

如何测试Zookeeper服务器是否在Windows上运行


共 (2) 个答案

  1. # 1 楼答案

    确保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
    
  2. # 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