我想创建java代码来保存我的文本内容或将其附加到hdfs中的文件中,但它返回错误,流是我的java代码来将我的文本内容附加到hdfs中的文件中 HDFS
系统:
public class FileAppend {
public static final String uri = "hdfs://192.168.3.152:9000/work/log.txt";
public static void main(String[] args) throws IOException {
String content = "bonjour";
Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(URI.create(uri), conf);
boolean flag = Boolean.getBoolean(fs.getConf().get("dfs.support.append"));
System.out.println("dfs.support.append is set to be " + flag);
if (true) {
FSDataOutputStream fsout = fs.append(new Path(uri));
PrintWriter writer = new PrintWriter(fsout);
writer.append(content);
writer.close();
} else {
System.err.println("please set the dfs.support.append to be true");
}
fs.close();
我的报税代码是:
juil. 04, 2016 10:01:32 AM org.apache.hadoop.ipc.Client$Connection handleConnectionFailure
INFOS: Retrying connect to server: /192.168.3.152:9000. Already tried 0 time(s).
juil. 04, 2016 10:01:33 AM org.apache.hadoop.ipc.Client$Connection handleConnectionFailure
INFOS: Retrying connect to server: /192.168.3.152:9000. Already tried 1 time(s).
juil. 04, 2016 10:01:34 AM org.apache.hadoop.ipc.Client$Connection handleConnectionFailure
INFOS: Retrying connect to server: /192.168.3.152:9000. Already tried 2 time(s).
juil. 04, 2016 10:01:35 AM org.apache.hadoop.ipc.Client$Connection handleConnectionFailure
INFOS: Retrying connect to server: /192.168.3.152:9000. Already tried 3 time(s).
暂无答案!
目前还没有任何答案,快来回答吧!