Address family not supported by protocol family: connect

本文记录了一次使用Apache Zookeeper过程中遇到的连接错误,并详细解释了错误信息“Address family not supported by protocol family”。通过更改本机C盘hosts文件中localhost的映射解决了问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

问题:

Address family not supported by protocol family: connect

[html]  view plain  copy
  1. 15/05/09 10:44:22 INFO zookeeper.ZooKeeper: Initiating client connection, connectString=localhost:2000/storm sessionTimeout=20000 watcher=org.apache.curator.ConnectionState@612438f1  
  2. 15/05/09 10:44:22 INFO zookeeper.ClientCnxn: Opening socket connection to server 0:0:0:0:0:0:0:1/0:0:0:0:0:0:0:1:2000. Will not attempt to authenticate using SASL (无法定位登录配置)  
  3. 15/05/09 10:44:22 ERROR zookeeper.ClientCnxnSocketNIO: Unable to open socket to 0:0:0:0:0:0:0:1/0:0:0:0:0:0:0:1:2000  
  4. 15/05/09 10:44:22 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect  
  5. java.net.SocketException: Address family not supported by protocol family: connect  
  6.     at sun.nio.ch.Net.connect(Native Method)  
  7.     at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:507)  
  8.     at org.apache.zookeeper.ClientCnxnSocketNIO.registerAndConnect(ClientCnxnSocketNIO.java:266)  
  9.     at org.apache.zookeeper.ClientCnxnSocketNIO.connect(ClientCnxnSocketNIO.java:276)  
  10.     at org.apache.zookeeper.ClientCnxn$SendThread.startConnect(ClientCnxn.java:958)  
  11.     at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:993)  
  12. 15/05/09 10:44:22 INFO zookeeper.ClientCnxn: Opening socket connection to server 127.0.0.1/127.0.0.1:2000. Will not attempt to authenticate using SASL (无法定位登录配置)  
  13. 15/05/09 10:44:22 INFO zookeeper.ClientCnxn: Socket connection established to 127.0.0.1/127.0.0.1:2000, initiating session  
  14. 15/05/09 10:44:22 INFO server.NIOServerCnxnFactory: Accepted socket connection from /127.0.0.1:4923  
  15. 15/05/09 10:44:22 INFO server.ZooKeeperServer: Client attempting to establish new session at /127.0.0.1:4923  
  16. 15/05/09 10:44:22 INFO server.ZooKeeperServer: Established session 0x14d368f1954000b with negotiated timeout 20000 for client /127.0.0.1:4923  
  17. 15/05/09 10:44:22 INFO zookeeper.ClientCnxn: Session establishment complete on server 127.0.0.1/127.0.0.1:2000, sessionid = 0x14d368f1954000b, negotiated timeout = 20000  
  18. 15/05/09 10:44:22 INFO state.ConnectionStateManager: State change: CONNECTED  
  19. 15/05/09 10:44:22 WARN state.ConnectionStateManager: There are no ConnectionStateListeners registered.  

原因:

Zookeeper无法连接localhost(127.0.0.1)。

解决方案:

修改本机C盘hosts文件,将127.0.0.1映射成localhost。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值