[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]#
unknownhost,不是dns炸了就是你的hosts文件不对,当然还有可能是server挂了
解析不了zookeeper这个域名。如果你希望能解析这个域名,请自己写hosts。
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。