一、appps/zookeeper3.4.5/conf/zoo.cfg配置
二、防火墙状态
2.1、Windows防火墙状态
2.2、Linux防火墙状态
三、Windows可ping通虚拟机IP
四、通过SecureCRT对打开zookeeper(三个虚拟机中zookeeper均正常)
五、Java代码
package cn.itcast.bigdata.zk;
import java.io.IOException;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.ZooDefs.Ids;
public class SimpleZKClient_1 {
private static final String connectString = "192.168.64.102:2181,192.168.64.103:2181,192.168.64.104:2181";
private static final int sessionTimeout = 2000;
public static void main(String[] args) throws Exception {
ZooKeeper zkClient = new ZooKeeper(connectString,sessionTimeout, new Watcher() {
@Override
public void process(WatchedEvent event) {
// TODO Auto-generated method stub
System.out.println(event.getType() + "---" + event.getPath());
}
});
String nodeCreated = zkClient.create("/eclipse", "hellozk".getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
}
}
六、运行,报错
求大神帮助。。。。。