当前位置:   article > 正文

kafka_kafka-server-start.bat' 不是内部或外部命令,也不是可运行的程序

kafka-server-start.bat' 不是内部或外部命令,也不是可运行的程序

摘要:参考了网上资料做了一个windows下使用kafka的实验

 

版本:

2.8.0

发布日期:2021-04-19

下载地址:

https://kafka.apache.org/downloads

下载后的文件:

kafka_2.13-2.8.0.tgz

kafka_2.8.0-src.tgz

解压:使用winzip

使用解压工具:https://www.winzip.com/win/zh/downwz.html

下载IDEA工具

https://www.jetbrains.com/products/#type=ide

https://www.jetbrains.com/idea/

下载 idea,版本2021.1.2

选择安装位置: C:\Program Files\JetBrains\IntelliJ IDEA 2021.1.2

需要2GB

等待安装,安装完成,打开软件

可以选

license激活或者选free版本

free版本使用30天

购买license,https://www.jetbrains.com/idea/buy/?fromIDE#commercial?billing=yearly

如果是个人使用,1个月14.9美元

下载JDK

Oracle OpenJDK 16.0.1

位置:C:\Users\Administrator\.jdks\openjdk-16.0.1

新建项目:hello

位置:C:\Users\Administrator\IdeaProjects\hello

写一个hello程序

运行:

C:\Users\Administrator\.jdks\openjdk-16.0.1\bin\java.exe "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2021.1.2\lib\idea_rt.jar=59097:C:\Program Files\JetBrains\IntelliJ IDEA 2021.1.2\bin" -Dfile.encoding=UTF-8 -classpath C:\Users\Administrator\IdeaProjects\hello\out\production\hello com.company.Main


在windows中配置java环境变量,参考https://www.huaweicloud.com/articles/c1c3d70b7a3a7d026ee5851d317b061c.html

cmd进入任意目录,测试:

 

  1. C:\Users\Administrator>java --version
  2. openjdk 16.0.1 2021-04-20
  3. OpenJDK Runtime Environment (build 16.0.1+9-24)
  4. OpenJDK 64-Bit Server VM (build 16.0.1+9-24, mixed mode, sharing)
  5. C:\Users\Administrator>cd ..
  6. C:\Users>java --version
  7. openjdk 16.0.1 2021-04-20
  8. OpenJDK Runtime Environment (build 16.0.1+9-24)
  9. OpenJDK 64-Bit Server VM (build 16.0.1+9-24, mixed mode, sharing)

java在任意目录都可以运行

  1. C:\Users\Administrator>set CLASSPATH
  2. CLASSPATH=C:\Users\Administrator\.jdks\openjdk-16.0.1\lib

无法运行bat

  1. C:\Users\Administrator\Downloads\kafka_2.13-2.8.0\kafka_2.13-2.8.0\bin\windows>kafka-topics.bat
  2. 输入行太长。
  3. 命令语法不正确。

参考:https://blog.csdn.net/chen__fei/article/details/108184203

  1. C:\kafka_2.13-2.8.0\bin>kafka-console-consumer.bat
  2. 'kafka-console-consumer.bat' 不是内部或外部命令,也不是可运行的程序
  3. 或批处理文件。

使用相对路径运行,出错,提示"不是内部或外部命令",使用绝对路径可以运行:

  1. C:\kafka_2.13-2.8.0\bin>C:\kafka_2.13-2.8.0\bin\windows\kafka-console-consumer.bat --version
  2. 2.8.0 (Commit:ebb1d6e21cc92130)

把这个C:\kafka_2.13-2.8.0\bin\windows\加入环境变量path

 

执行各种命令。

  1. PS C:\kafka_2.13-2.8.0> zookeeper-server-start.bat .\config\zookeeper.properties
  2. [2021-06-21 21:05:08,165] INFO Reading configuration from: .\config\zookeeper.properties (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
  3. [2021-06-21 21:05:08,168] WARN \tmp\zookeeper is relative. Prepend .\ to indicate that you're sure! (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
  4. [2021-06-21 21:05:08,173] INFO clientPortAddress is 0.0.0.0:2181 (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
  5. [2021-06-21 21:05:08,173] INFO secureClientPort is not set (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
  6. [2021-06-21 21:05:08,176] INFO autopurge.snapRetainCount set to 3 (org.apache.zookeeper.server.DatadirCleanupManager)
  7. [2021-06-21 21:05:08,177] INFO autopurge.purgeInterval set to 0 (org.apache.zookeeper.server.DatadirCleanupManager)
  8. [2021-06-21 21:05:08,178] INFO Purge task is not scheduled. (org.apache.zookeeper.server.DatadirCleanupManager)
  9. [2021-06-21 21:05:08,179] WARN Either no config or no quorum defined in config, running in standalone mode (org.apache.zookeeper.server.quorum.QuorumPeerMain)
  10. [2021-06-21 21:05:08,183] INFO Log4j 1.2 jmx support found and enabled. (org.apache.zookeeper.jmx.ManagedUtil)
  11. [2021-06-21 21:05:08,198] INFO Reading configuration from: .\config\zookeeper.properties (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
  12. [2021-06-21 21:05:08,198] WARN \tmp\zookeeper is relative. Prepend .\ to indicate that you're sure! (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
  13. [2021-06-21 21:05:08,200] INFO clientPortAddress is 0.0.0.0:2181 (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
  14. [2021-06-21 21:05:08,201] INFO secureClientPort is not set (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
  15. [2021-06-21 21:05:08,201] INFO Starting server (org.apache.zookeeper.server.ZooKeeperServerMain)
  16. [2021-06-21 21:05:08,205] INFO zookeeper.snapshot.trust.empty : false (org.apache.zookeeper.server.persistence.FileTxnSnapLog)
  17. [2021-06-21 21:05:08,220] INFO Server environment:zookeeper.version=3.5.9-83df9301aa5c2a5d284a9940177808c01bc35cef, built on 01/06/2021 20:03 GMT (org.apache.zookeeper.server.ZooKeeperServer)
  18. [2021-06-21 21:05:08,220] INFO Server environment:host.name=192.168.0.239 (org.apache.zookeeper.server.ZooKeeperServer)
  19. [2021-06-21 21:05:08,225] INFO Server environment:java.version=16.0.1 (org.apache.zookeeper.server.ZooKeeperServer)
  20. [2021-06-21 21:05:08,225] INFO Server environment:java.vendor=Oracle Corporation (org.apache.zookeeper.server.ZooKeeperServer)
  21. [2021-06-21 21:05:08,226] INFO Server environment:java.home=C:\Users\Administrator\.jdks\openjdk-16.0.1 (org.apache.zookeeper.server.ZooKeeperServer)
  22. [2021-06-21 21:05:08,226] INFO Server environment:java.class.path=C:\Users\Administrator\.jdks\openjdk-16.0.1\lib;C:\kafka_2.13-2.8.0\libs\activation-1.1.1.jar;C:\kafka_2.13-2.8.0\libs\aopalliance-repackaged-2.6.1.jar;C:\kafka_2.13-2.8.0\libs\argparse4j-0.7.0.jar;C:\kafka_2.13-2.8.0\libs\audience-annotations-0.5.0.jar;C:\kafka_2.13-2.8.0\libs\commons-cli-1.4.jar;C:\kafka_2.13-2.8.0\libs\commons-lang3-3.8.1.jar;C:\kafka_2.13-2.8.0\libs\connect-api-2.8.0.jar;C:\kafka_2.13-2.8.0\libs\connect-basic-auth-extension-2.8.0.jar;C:\kafka_2.13-2.8.0\libs\connect-file-2.8.0.jar;C:\kafka_2.13-2.8.0\libs\connect-json-2.8.0.jar;C:\kafka_2.13-2.8.0\libs\connect-mirror-2.8.0.jar;C:\kafka_2.13-2.8.0\libs\connect-mirror-client-2.8.0.jar;C:\kafka_2.13-2.8.0\libs\connect-runtime-2.8.0.jar;C:\kafka_2.13-2.8.0\libs\connect-transforms-2.8.0.jar;C:\kafka_2.13-2.8.0\libs\hk2-api-2.6.1.jar;C:\kafka_2.13-2.8.0\libs\hk2-locator-2.6.1.jar;C:\kafka_2.13-2.8.0\libs\hk2-utils-2.6.1.jar;C:\kafka_2.13-2.8.0\libs\jackson-annotations-2.10.5.jar;C:\kafka_2.13-2.8.0\libs\jackson-core-2.10.5.jar;C:\kafka_2.13-2.8.0\libs\jackson-databind-2.10.5.1.jar;C:\kafka_2.13-2.8.0\libs\jackson-dataformat-csv-2.10.5.jar;C:\kafka_2.13-2.8.0\libs\jackson-datatype-jdk8-2.10.5.jar;C:\kafka_2.13-2.8.0\libs\jackson-jaxrs-base-2.10.5.jar;C:\kafka_2.13-2.8.0\libs\jackson-jaxrs-json-provider-2.10.5.jar;C:\kafka_2.13-2.8.0\libs\jackson-module-jaxb-annotations-2.10.5.jar;C:\kafka_2.13-2.8.0\libs\jackson-module-paranamer-2.10.5.jar;C:\kafka_2.13-2.8.0\libs\jackson-module-scala_2.13-2.10.5.jar;C:\kafka_2.13-2.8.0\libs\jakarta.activation-api-1.2.1.jar;C:\kafka_2.13-2.8.0\libs\jakarta.annotation-api-1.3.5.jar;C:\kafka_2.13-2.8.0\libs\jakarta.inject-2.6.1.jar;C:\kafka_2.13-2.8.0\libs\jakarta.validation-api-2.0.2.jar;C:\kafka_2.13-2.8.0\libs\jakarta.ws.rs-api-2.1.6.jar;C:\kafka_2.13-2.8.0\libs\jakarta.xml.bind-api-2.3.2.jar;C:\kafka_2.13-2.8.0\libs\javassist-3.27.0-GA.jar;C:\kafka_2.13-2.8.0\libs\javax.servlet-api-3.1.0.jar;C:\kafka_2.13-2.8.0\libs\javax.ws.rs-api-2.1.1.jar;C:\kafka_2.13-2.8.0\libs\jaxb-api-2.3.0.jar;C:\kafka_2.13-2.8.0\libs\jersey-client-2.31.jar;C:\kafka_2.13-2.8.0\libs\jersey-common-2.31.jar;C:\kafka_2.13-2.8.0\libs\jersey-container-servlet-2.31.jar;C:\kafka_2.13-2.8.0\libs\jersey-container-servlet-core-2.31.jar;C:\kafka_2.13-2.8.0\libs\jersey-hk2-2.31.jar;C:\kafka_2.13-2.8.0\libs\jersey-media-jaxb-2.31.jar;C:\kafka_2.13-2.8.0\libs\jersey-server-2.31.jar;C:\kafka_2.13-2.8.0\libs\jetty-client-9.4.39.v20210325.jar;C:\kafka_2.13-2.8.0\libs\jetty-continuation-9.4.39.v20210325.jar;C:\kafka_2.13-2.8.0\libs\jetty-http-9.4.39.v20210325.jar;C:\kafka_2.13-2.8.0\libs\jetty-io-9.4.39.v20210325.jar;C:\kafka_2.13-2.8.0\libs\jetty-security-9.4.39.v20210325.jar;C:\kafka_2.13-2.8.0\libs\jetty-server-9.4.39.v20210325.jar;C:\kafka_2.13-2.8.0\libs\jetty-servlet-9.4.39.v20210325.jar;C:\kafka_2.13-2.8.0\libs\jetty-servlets-9.4.39.v20210325.jar;C:\kafka_2.13-2.8.0\libs\jetty-util-9.4.39.v20210325.jar;C:\kafka_2.13-2.8.0\libs\jetty-util-ajax-9.4.39.v20210325.jar;C:\kafka_2.13-2.8.0\libs\jline-3.12.1.jar;C:\kafka_2.13-2.8.0\libs\jopt-simple-5.0.4.jar;C:\kafka_2.13-2.8.0\libs\kafka-clients-2.8.0.jar;C:\kafka_2.13-2.8.0\libs\kafka-log4j-appender-2.8.0.jar;C:\kafka_2.13-2.8.0\libs\kafka-metadata-2.8.0.jar;C:\kafka_2.13-2.8.0\libs\kafka-raft-2.8.0.jar;C:\kafka_2.13-2.8.0\libs\kafka-shell-2.8.0.jar;C:\kafka_2.13-2.8.0\libs\kafka-streams-2.8.0.jar;C:\kafka_2.13-2.8.0\libs\kafka-streams-examples-2.8.0.jar;C:\kafka_2.13-2.8.0\libs\kafka-streams-scala_2.13-2.8.0.jar;C:\kafka_2.13-2.8.0\libs\kafka-streams-test-utils-2.8.0.jar;C:\kafka_2.13-2.8.0\libs\kafka-tools-2.8.0.jar;C:\kafka_2.13-2.8.0\libs\kafka_2.13-2.8.0-javadoc.jar;C:\kafka_2.13-2.8.0\libs\kafka_2.13-2.8.0-javadoc.jar.asc;C:\kafka_2.13-2.8.0\libs\kafka_2.13-2.8.0-sources.jar;C:\kafka_2.13-2.8.0\libs\kafka_2.13-2.8.0-sources.jar.asc;C:\kafka_2.13-2.8.0\libs\kafka_2.13-2.8.0-test-sources.jar;C:\kafka_2.13-2.8.0\libs\kafka_2.13-2.8.0-test-sources.jar.asc;C:\kafka_2.13-2.8.0\libs\kafka_2.13-2.8.0-test.jar;C:\kafka_2.13-2.8.0\libs\kafka_2.13-2.8.0-test.jar.asc;C:\kafka_2.13-2.8.0\libs\kafka_2.13-2.8.0.jar;C:\kafka_2.13-2.8.0\libs\kafka_2.13-2.8.0.jar.asc;C:\kafka_2.13-2.8.0\libs\log4j-1.2.17.jar;C:\kafka_2.13-2.8.0\libs\lz4-java-1.7.1.jar;C:\kafka_2.13-2.8.0\libs\maven-artifact-3.6.3.jar;C:\kafka_2.13-2.8.0\libs\metrics-core-2.2.0.jar;C:\kafka_2.13-2.8.0\libs\netty-buffer-4.1.62.Final.jar;C:\kafka_2.13-2.8.0\libs\netty-codec-4.1.62.Final.jar;C:\kafka_2.13-2.8.0\libs\netty-common-4.1.62.Final.jar;C:\kafka_2.13-2.8.0\libs\netty-handler-4.1.62.Final.jar;C:\kafka_2.13-2.8.0\libs\netty-resolver-4.1.62.Final.jar;C:\kafka_2.13-2.8.0\libs\netty-transport-4.1.62.Final.jar;C:\kafka_2.13-2.8.0\libs\netty-transport-native-epoll-4.1.62.Final.jar;C:\kafka_2.13-2.8.0\libs\netty-transport-native-unix-common-4.1.62.Final.jar;C:\kafka_2.13-2.8.0\libs\osgi-resource-locator-1.0.3.jar;C:\kafka_2.13-2.8.0\libs\paranamer-2.8.jar;C:\kafka_2.13-2.8.0\libs\plexus-utils-3.2.1.jar;C:\kafka_2.13-2.8.0\libs\reflections-0.9.12.jar;C:\kafka_2.13-2.8.0\libs\rocksdbjni-5.18.4.jar;C:\kafka_2.13-2.8.0
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/773532
推荐阅读
相关标签
  

闽ICP备14008679号