Hodoop碰到的問題628

摸魚2023發表於2018-06-28

windows執行mapreduce報錯資訊如下

Exception in thread "main" java.net.UnknownHostException: Invalid host name: local host is: (unknown); destination host is: "hadoop1":8032; java.net.UnknownHostException;
複製程式碼

重啟下電腦沒什麼事了...莫名其妙

Exception message: /bin/bash: line 0: fg: no job control

Stack trace: ExitCodeException exitCode=1: /bin/bash: line 0: fg: no job control
複製程式碼

設定Configura如下

conf.set("mapreduce.app-submission.cross-platform","true");
複製程式碼

報錯如下

Exception in thread "main" java.io.IOException: java.net.ConnectException: Call From SKY-20180605RQV/192.168.0.172 to 0.0.0.0:10020 failed on connection exception: java.net.ConnectException: Connection refused: no further information;
複製程式碼

執行MapReduce時異常

自定義map輸出物件 報錯如下

java.lang.Exception: java.lang.RuntimeException: java.lang.NoSuchMethodException: com.Information.<init>()
   at org.apache.hadoop.mapred.LocalJobRunner$Job.runTasks(LocalJobRunner.java:462)
   at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:529)
複製程式碼

原因 沒有在自定義的writeble中設定無參建構函式

2.mapreduce輸出中文變成亂碼

新增如下程式碼

 public static Text transformTextToUTF8(Text text, String encoding) {
       String value = null;
       try {
           value = new String(text.getBytes(), 0, text.getLength(), encoding);
       } catch (UnsupportedEncodingException e) {
           e.printStackTrace();
       }
       return new Text(value);
   }
複製程式碼

map中

 Text newText = transformTextToUTF8(value, "GBK");
        String  a= newText.toString();
複製程式碼

相關文章