开发者社区> 问答> 正文

为何无法启动zookeeper客户端脚本,报错如下??报错

[root@novalocal tomcat8]# cd ../
[root@novalocal local]# cd zookeeper/bin/
[root@novalocal bin]# ./zkCli.sh -server zookeeper:2181
Connecting to zookeeper:2181
2016-04-29 22:05:42,365 [myid:] - INFO  [main:Environment@100] - Client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT
2016-04-29 22:05:42,369 [myid:] - INFO  [main:Environment@100] - Client environment:host.name=novalocal
2016-04-29 22:05:42,369 [myid:] - INFO  [main:Environment@100] - Client environment:java.version=1.8.0_77
2016-04-29 22:05:42,371 [myid:] - INFO  [main:Environment@100] - Client environment:java.vendor=Oracle Corporation
2016-04-29 22:05:42,371 [myid:] - INFO  [main:Environment@100] - Client environment:java.home=/usr/local/java/jdk1.8.0_77/jre
2016-04-29 22:05:42,371 [myid:] - INFO  [main:Environment@100] - Client environment:java.class.path=/usr/local/zookeeper/bin/../build/classes:/usr/local/zookeeper/bin/../build/lib/.jar:/usr/local/zookeeper/bin/../lib/slf4j-log4j12-1.6.1.jar:/usr/local/zookeeper/bin/../lib/slf4j-api-1.6.1.jar:/usr/local/zookeeper/bin/../lib/netty-3.7.0.Final.jar:/usr/local/zookeeper/bin/../lib/log4j-1.2.16.jar:/usr/local/zookeeper/bin/../lib/jline-0.9.94.jar:/usr/local/zookeeper/bin/../zookeeper-3.4.6.jar:/usr/local/zookeeper/bin/../src/java/lib/.jar:/usr/local/zookeeper/bin/../conf:.:/usr/local/java/jdk1.8.0_77/lib/dt.jar:/usr/local/java/jdk1.8.0_77/lib/tools.jar:/usr/local/java/jdk1.8.0_77/jre/lib
2016-04-29 22:05:42,372 [myid:] - INFO  [main:Environment@100] - Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
2016-04-29 22:05:42,372 [myid:] - INFO  [main:Environment@100] - Client environment:java.io.tmpdir=/tmp
2016-04-29 22:05:42,372 [myid:] - INFO  [main:Environment@100] - Client environment:java.compiler=<NA>
2016-04-29 22:05:42,372 [myid:] - INFO  [main:Environment@100] - Client environment:os.name=Linux
2016-04-29 22:05:42,372 [myid:] - INFO  [main:Environment@100] - Client environment:os.arch=amd64
2016-04-29 22:05:42,372 [myid:] - INFO  [main:Environment@100] - Client environment:os.version=3.10.0-229.14.1.el7.x86_64
2016-04-29 22:05:42,372 [myid:] - INFO  [main:Environment@100] - Client environment:user.name=root
2016-04-29 22:05:42,372 [myid:] - INFO  [main:Environment@100] - Client environment:user.home=/root
2016-04-29 22:05:42,372 [myid:] - INFO  [main:Environment@100] - Client environment:user.dir=/usr/local/zookeeper/bin
2016-04-29 22:05:42,373 [myid:] - INFO  [main:ZooKeeper@438] - Initiating client connection, connectString=zookeeper:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@799f7e29
Exception in thread "main" java.net.UnknownHostException: zookeeper: unknown error
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
at java.net.InetAddress.getAllByName0(InetAddress.java:1276)
at java.net.InetAddress.getAllByName(InetAddress.java:1192)
at java.net.InetAddress.getAllByName(InetAddress.java:1126)
at org.apache.zookeeper.client.StaticHostProvider.<init>(StaticHostProvider.java:61)
at org.apache.zookeeper.ZooKeeper.<init>(ZooKeeper.java:445)
at org.apache.zookeeper.ZooKeeperMain.connectToZK(ZooKeeperMain.java:273)
at org.apache.zookeeper.ZooKeeperMain.<init>(ZooKeeperMain.java:288)
at org.apache.zookeeper.ZooKeeperMain.main(ZooKeeperMain.java:281)
[root@novalocal bin]# 

展开
收起
爱吃鱼的程序员 2020-06-09 14:59:26 787 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    unknownhost,不是dns炸了就是你的hosts文件不对,当然还有可能是server挂了

    解析不了zookeeper这个域名。如果你希望能解析这个域名,请自己写hosts。


    2020-06-09 14:59:43
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
《MSE 微服务网关》 立即下载
微服务引擎 MSE 治理中心重磅发布 立即下载
阿里云微服务引擎 MSE 2.0 线上发布 立即下载