1. 程式人生 > >Hadoop初學者常見錯誤

Hadoop初學者常見錯誤

錯誤一:本地執行Java 程式碼時出出現:

2018-09-14 19:45:07,266 DEBUG org.apache.hadoop.util.Shell.checkHadoopHome() - Failed to detect a valid hadoop home directory

java.io.IOException: HADOOP_HOME or hadoop.home.dir are not set.

2018-09-14 19:45:07,275 ERROR org.apache.hadoop.util.Shell.getWinUtilsPath() - Failed to locate the winutils binary in the hadoop binary path

java.io.IOException: Could not locate executable null\bin\winutils.exe in the Hadoop binaries.

解決:把hadoop安裝目錄下的hadoop.dll考到system32目錄下

錯誤二:執行mapreduce

Job job_1536830416611_0021 failed with state FAILED due to: Application application_1536830416611_0021 failed 2 times due to Error launching appattempt_1536830416611_0021_000002. Got exception: org.apache.hadoop.yarn.exceptions.YarnException: Unauthorized request to start container.

This token is expired. current time is 1536878358609 found 1536837804741

Note: System times on machines may be out of sync. Check system time and time zones.

沒有同步時間

解決:

在namenode 和datanode所在的伺服器上都輸入:

cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

ntpdate pool.ntp.org 進行時間同步

如果在ntpdate pool.ntp.org 時 出現 the NTP socket is in use, exiting

用 ps -ef|grep ntp 查出程序後 殺死

錯誤三:

啟動zookeeper 服務時

zkServer.sh status

ZooKeeper JMX enabled by default

Using config: /usr/local/zookeeper-3.4.10/bin/…/conf/zoo.cfg

Error contacting service. It is probably not running.

刪除 /etc/hosts 中的 127.0.0.0拿一行

錯誤四:

linux的shell指令碼執行出現失敗

shell 指令碼在/usr/local/bin 下 不管在哪執行都可以不用寫路徑

-bash: /usr/local/bin/xcall.sh: /bin/bash^M: bad interpreter:

在行末模式下輸入set ff回車,檢視當前的模式,如果時doc就通過set fileformat=unix修改成unix

錯誤五:

Connection refused

​ at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)

​ at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)

​ at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)

​ at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)

18/09/19 19:41:53 INFO ipc.Client: Retrying connect to server: hadoop03/192.168.136.130:8485. Already tried 0 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)(所有journalnode都得開啟,才能format namenode)

錯誤六:

2018-09-19 20:22:04,275 FATAL org.apache.hadoop.ha.ZKFailoverController: Unable to start failover controller. Parent znode does not exist.

Run with -formatZK flag to initialize ZooKeeper.

(要保證所有設定的zookeper叢集的zookeeper服務都開啟 才能 格式化 )