【发布时间】:2015-09-17 20:39:04
【问题描述】:
我在 Google Cloud Platform 上运行 Hadoop 集群,使用 Google Cloud Storage 作为持久数据的后端。我能够从远程机器 ssh 到主节点并运行 hadoop fs 命令。无论如何,当我尝试执行以下代码时,我得到一个超时错误。
代码
FileSystem hdfs =FileSystem.get(new URI("hdfs://mymasternodeip:8020"),new Configuration());
Path homeDir=hdfs.getHomeDirectory();
//Print the home directory
System.out.println("Home folder: " +homeDir);
// Create a directory
Path workingDir=hdfs.getWorkingDirectory();
Path newFolderPath= new Path("/DemoFolder");
newFolderPath=Path.mergePaths(workingDir, newFolderPath);
if(hdfs.exists(newFolderPath))
{
hdfs.delete(newFolderPath, true); //Delete existing Directory
}
//Create new Directory
hdfs.mkdirs(newFolderPath);
执行 hdfs.exists() 命令时出现超时错误。
错误
org.apache.hadoop.net.ConnectTimeoutException:调用从 gl051-win7/192.xxx.1.xxx 到 111.222.333.444.bc.googleusercontent.com:8020 在套接字超时异常上失败:org.apache .hadoop.net.ConnectTimeoutException:等待通道准备好连接时超时 20000 毫秒。 ch : java.nio.channels.SocketChannel[connection-pending remote=111.222.333.444.bc.googleusercontent.com/111.222.333.444:8020]
您是否知道针对 Google Cloud Platform 上的 Hadoop 使用 Java Hadoop API 的任何限制?
谢谢!
【问题讨论】:
标签: api hadoop google-hadoop