当前位置: 首页 > 知识库问答 >
问题:

为什么我不能连接到Kafka/动物园管理员?(在码头)

伯洋
2023-03-14

我正在Mac(W/docker-machine)上的Docker中运行Kafka(0.10.0.0)。我从Spotify的Dockerfile中派生了我的Dockerfile,这意味着Kafka和Zookeeper在同一个图像中运行。

val numPartitions = 4
val replicationFactor = 1
val topicConfig = new java.util.Properties

// zookeeper = "192.168.99.100:32822"
val zkClient = ZkUtils(zookeeper, 10000, 10000, false)
try {
  AdminUtils.createTopic(zkClient, topic, numPartitions, replicationFactor, topicConfig)
} catch {
  case k: kafka.common.TopicExistsException => // do nothing...topic exists
}
zkClient.close()

这将产生以下错误输出:

DEBUG ZkConnection - Creating new ZookKeeper instance to connect to 192.168.99.100:32822.
INFO  ZkEventThread - Starting ZkClient event thread.
INFO  ZooKeeper - Client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT
INFO  ZooKeeper - Client environment:host.name=172.25.42.82
INFO  ZooKeeper - Client environment:java.version=1.8.0_60
INFO  ZooKeeper - Client environment:java.vendor=Oracle Corporation
INFO  ZooKeeper - Client environment:java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre
INFO  ZooKeeper - Client environment:java.class.path=/usr/local/Cellar/sbt/0.13.11/libexec/sbt-launch.jar
INFO  ZooKeeper - Client environment:java.library.path=/Users/wmy965/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
INFO  ZooKeeper - Client environment:java.io.tmpdir=/var/folders/ph/ccz4n1qs62n0bn8mqdg94gswt1jlwk/T/
INFO  ZooKeeper - Client environment:java.compiler=<NA>
INFO  ZooKeeper - Client environment:os.name=Mac OS X
INFO  ZooKeeper - Client environment:os.arch=x86_64
INFO  ZooKeeper - Client environment:os.version=10.11.5
INFO  ZooKeeper - Client environment:user.name=wmy965
INFO  ZooKeeper - Client environment:user.home=/Users/wmy965
INFO  ZooKeeper - Client environment:user.dir=/Users/wmy965/git/LateKafka
INFO  ZooKeeper - Initiating client connection, connectString=192.168.99.100:32822 sessionTimeout=10000 watcher=org.I0Itec.zkclient.ZkClient@55397e3
DEBUG ClientCnxn - zookeeper.disableAutoWatchReset is false
DEBUG ZkClient - Awaiting connection to Zookeeper server
INFO  ZkClient - Waiting for keeper state SyncConnected
INFO  ClientCnxn - Opening socket connection to server 192.168.99.100/192.168.99.100:32822. Will not attempt to authenticate using SASL (unknown error)
WARN  ClientCnxn - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
    at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)
DEBUG ClientCnxnSocketNIO - Ignoring exception during shutdown input
java.nio.channels.ClosedChannelException
    at sun.nio.ch.SocketChannelImpl.shutdownInput(SocketChannelImpl.java:780)
    at sun.nio.ch.SocketAdaptor.shutdownInput(SocketAdaptor.java:399)
    at org.apache.zookeeper.ClientCnxnSocketNIO.cleanup(ClientCnxnSocketNIO.java:200)
    at org.apache.zookeeper.ClientCnxn$SendThread.cleanup(ClientCnxn.java:1185)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1110)
DEBUG ClientCnxnSocketNIO - Ignoring exception during shutdown output
java.nio.channels.ClosedChannelException
    at sun.nio.ch.SocketChannelImpl.shutdownOutput(SocketChannelImpl.java:797)
    at sun.nio.ch.SocketAdaptor.shutdownOutput(SocketAdaptor.java:407)
    at org.apache.zookeeper.ClientCnxnSocketNIO.cleanup(ClientCnxnSocketNIO.java:207)
    at org.apache.zookeeper.ClientCnxn$SendThread.cleanup(ClientCnxn.java:1185)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1110)
INFO  ClientCnxn - Opening socket connection to server 192.168.99.100/192.168.99.100:32822. Will not attempt to authenticate using SASL (unknown error)
INFO  ClientCnxn - Socket connection established to 192.168.99.100/192.168.99.100:32822, initiating session
DEBUG ClientCnxn - Session establishment request sent on 192.168.99.100/192.168.99.100:32822
INFO  ClientCnxn - Session establishment complete on server 192.168.99.100/192.168.99.100:32822, sessionid = 0x155225c51720000, negotiated timeout = 10000
DEBUG ZkClient - Received event: WatchedEvent state:SyncConnected type:None path:null
INFO  ZkClient - zookeeper state changed (SyncConnected)
DEBUG ZkClient - Leaving process event
DEBUG ZkClient - State is SyncConnected
DEBUG ClientCnxn - Reading reply sessionid:0x155225c51720000, packet:: clientPath:null serverPath:null finished:false header:: 1,8  replyHeader:: 1,1,-101  request:: '/brokers/ids,F  response:: v{}

看起来我无法连接(大概是动物园管理员)。为什么不呢?

共有1个答案

韦安怡
2023-03-14

在新的Kafka流中,制片人的ip一定是Kafka(码头)知道的。Kafka发送他们的uuid(您可以在Kafka docker中的/etc/hosts中显示这一点),并从中观察响应。

摘要:

将uuid kafka docker映射到mac OS的/etc/host中的docker-machine。

为了帮助您,如何在Mac中更改etc/host文件:

https://www.tekrevue.com/tip/edit-hosts-file-mac-os-x/

 类似资料:
  • 我在用拉斯贝里圆周率和拉斯比安。我想用Kafka把数据从相机流到我的手机上。我从Kafka网站下载了这个包,里面包含Zookeeper和Kafka: https://www.apache.org/dyn/closer.cgi?path=/kafka/2.4.1/kafka2.12-2.4.1.tgz 我的假设是Kafka联系不到动物园管理员,但我真的不知道。 有没有办法我可以测试动物园管理员是否在

  • 我试图在本地机器上以分布式模式配置Apache Drill。为此,我已经使用配置文件(这里,sagar pc解析为我的wlan0 inet addr): Zookeeper服务成功运行,启动Apache Drill后,它能够根据文件。此外,状态检查告诉我: 钻头在运转 钻头的ZooManager输出: 文件内容: 然而,即使完成了所有这些步骤,当我试图在目录中运行命令时,它也会给我以下错误: 在Z

  • 分布式 Apache HBase 安装依赖于正在运行的 ZooKeeper 集群。所有参与节点和客户端都需要能够访问正在运行的 ZooKeeper 集合。 Apache HBase 默认为您管理 ZooKeeper“集群”。它将启动和停止 ZooKeeper 集合作为 HBase 启动/停止过程的一部分。您还可以独立于 HBase 管理 ZooKeeper 集合,只需将 HBase 指向它应该使用

  • 假设我有 3 台 Kafka 服务器。服务器 1 zoopkeeper1 服务器 2 zoopkeeper2 服务器 3 zoopkeeper3 在集群配置中,zoopkeepers 会发生什么?它们是为每个服务器单独维护的,还是会在群集配置中同步其数据?

  • 在Zookeeper和代理身份验证上启用SASL时,我面临以下错误。 以下配置在JAAS文件中给出,该文件作为KAFKA_OPTS传递,将其作为JVM参数:- Kafka经纪人的服务器。属性设置了以下额外字段:- Zookeeper属性如下所示: