windows - 启动 kafka 服务器时出现“java.nio.channels.UnresolvedAddressException”
问题描述
之后我启动了 zookeeper,我运行了“kafka-server-start.bat mypath\server.properties”命令来启动 kafka 服务器。
在 kafka 服务器窗口中出现以下错误。
INFO Opening socket connection to server localhost/<unresolved>:2181. Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn)
WARN Session 0x0 for server localhost/<unresolved>:2181, unexpected error, closing socket connection and attempting reconnect (org.apache.zookeeper.ClientCnxn)
java.nio.channels.UnresolvedAddressException
at java.base/sun.nio.ch.Net.checkAddress(Net.java:149)
at java.base/sun.nio.ch.Net.checkAddress(Net.java:157)
at java.base/sun.nio.ch.SocketChannelImpl.checkRemote(SocketChannelImpl.java:815)
at java.base/sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:837)
at org.apache.zookeeper.ClientCnxnSocketNIO.registerAndConnect(ClientCnxnSocketNIO.java:277)
at org.apache.zookeeper.ClientCnxnSocketNIO.connect(ClientCnxnSocketNIO.java:287)
at org.apache.zookeeper.ClientCnxn$SendThread.startConnect(ClientCnxn.java:1021)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1064)
以下是 server.properties 中的属性
num.network.threads=3
num.io.threads=8
socket.send.buffer.bytes=102400
socket.receive.buffer.bytes=102400
socket.request.max.bytes=104857600
log.dirs=C:\KafkaLog
num.partitions=1
num.recovery.threads.per.data.dir=1
offsets.topic.replication.factor=1
transaction.state.log.replication.factor=1
transaction.state.log.min.isr=1
log.retention.hours=168
log.segment.bytes=1073741824
log.retention.check.interval.ms=300000
zookeeper.connect=localhost:2181
zookeeper.connection.timeout.ms=6000
confluent.support.metrics.enable=true
confluent.support.customer.id=anonymous
group.initial.rebalance.delay.ms=0
Zookeeper 属性是
dataDir=C:\ZookeeperLog
clientPort=2181
maxClientCnxns=0
解决方案
我们尝试检查以下事项以解决它们。
- 更新了配置文件中的
dataDir
&log.dirs
属性(用于匹配 windows 平台) - 使用命令验证
zookeeper
启动netstat -aon | findstr '2181'
zookeeper.connect
将网址更新为127.0.0.1:2181
- 在文件中添加了以下缺少的环回条目
hosts
并重新启动了系统。
127.0.0.1 localhost
推荐阅读
- python - 在python中调用函数和传递数组
- python-3.x - 如何进行触发其他“事件”的定时输入?
- django - 无法从字段名称有双下划线的 django 查询
- python - 如何“避免”内容安全策略?
- python-3.x - Flask 模板未呈现,并且不会插入到数据库中
- javascript - 如何在 Angular 8 项目中使用 Satellite.js
- python - 如何使用 print 在 python 中显示类实例
- python - 有没有办法解决 RecursionError:调用 Python 对象时超出最大递归深度?
- python - 从 csv 文件中读取数据,同时密切关注文件夹的更改
- python - 机器 epsilon 的倍数是什么意思?