我遇到连接拒绝错误的问题,我试图使用Horton作为Hadoop服务器进行项目测试但是我收到以下错误:
java.net.ConnectException: Call From PC/192.168.56.1 to 192.168.0.3:54310 failed on connection exception: java.net.ConnectException: Connection refused: no further information; For more details see: http://wiki.apache.org/hadoop/ConnectionRefused
查看维基后,我可以完成所有步骤,包括Telnet到服务器。
设置是 VM虚拟盒与Horton在192.168.0.3上的桥接连接上运行 与我的本地连接尝试运行以下Java代码。
//1. Get the instance of COnfiguration
Configuration configuration = new Configuration();
//2. Create an InputStream to read the data from local file
//3. Get the HDFS instance
FileSystem hdfs = FileSystem.get(new URI("hdfs://192.168.0.3:54310"), configuration);
//4. Open a OutputStream to write the data, this can be obtained from the FileSytem
outputStream = hdfs.create(new Path("hdfs://192.168.0.3:54310/user/hadoop/raw/" + dateToday + "//" + timeStamp.getName()),
new Progressable() {
@Override
public void progress() {
System.out.println("....");
}
});
在尝试连接之前,有没有办法让Java程序登录Horton服务器?