本篇內(nèi)容介紹了“hadoop+hive使用中遇到的問題怎么解決”的有關(guān)知識,在實(shí)際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!
公司主營業(yè)務(wù):成都網(wǎng)站設(shè)計(jì)、網(wǎng)站建設(shè)、移動網(wǎng)站開發(fā)等業(yè)務(wù)。幫助企業(yè)客戶真正實(shí)現(xiàn)互聯(lián)網(wǎng)宣傳,提高企業(yè)的競爭能力。創(chuàng)新互聯(lián)是一支青春激揚(yáng)、勤奮敬業(yè)、活力青春激揚(yáng)、勤奮敬業(yè)、活力澎湃、和諧高效的團(tuán)隊(duì)。公司秉承以“開放、自由、嚴(yán)謹(jǐn)、自律”為核心的企業(yè)文化,感謝他們對我們的高要求,感謝他們從不同領(lǐng)域給我們帶來的挑戰(zhàn),讓我們激情的團(tuán)隊(duì)有機(jī)會用頭腦與智慧不斷的給客戶帶來驚喜。創(chuàng)新互聯(lián)推出潘集免費(fèi)做網(wǎng)站回饋大家。
1.datanode無法正常啟動
添加datanode后,datanode無法正常啟動,進(jìn)程一會莫名其妙掛掉,查看namenode日志顯示如下:
2013-06-21 18:53:39,182 FATAL org.apache.hadoop.hdfs.StateChange: BLOCK* NameSystem.getDatanode: Data node x.x.x.x:50010 is attempting to report storage ID DS-1357535176-x.x.x.x-50010-1371808472808. Node y.y.y.y:50010 is expected to serve this storage.
原因分析:
拷貝hadoop安裝包時,包含data與tmp文件夾,未成功格式化datanode
解決辦法:
rm -rf /data/hadoop/hadoop-1.1.2/datarm -rf /data/hadoop/hadoop-1.1.2/tmphadoop datanode -format
2. safe mode
2013-06-20 10:35:43,758 ERROR org.apache.hadoop.security.UserGroupInformation: PriviledgedActionException as:hadoop cause:org.apache.hadoop.hdfs.server.namenode.SafeModeException: Cannot renew lease for DFSClient_hb_rs_wdev1.corp.qihoo.net,60020,1371631589073. Name node is in safe mode.
解決方案:
hadoop dfsadmin -safemode leave
3.連接異常
2013-06-21 19:55:05,801 WARN org.apache.hadoop.hdfs.server.datanode.DataNode: java.io.IOException: Call to homename/x.x.x.x:9000 failed on local exception: java.io.EOFException
可能原因:
namenode監(jiān)聽127.0.0.1:9000,而非0.0.0.0:9000或外網(wǎng)IP:9000 iptables限制
解決方案:
檢查/etc/hosts配置,使得hostname綁定到非127.0.0.1的IP上 iptables放開端口
4. namenode id
ERROR org.apache.hadoop.hdfs.server.datanode.DataNode: java.io.IOException: Incompatible namespaceIDs in /var/lib/hadoop-0.20/cache/hdfs/dfs/data: namenode namespaceID = 240012870; datanode namespaceID = 1462711424 .
問題:Namenode上namespaceID與datanode上namespaceID不一致。
問題產(chǎn)生原因:每次namenode format會重新創(chuàng)建一個namenodeId,而tmp/dfs/data下包含了上次format下的id,namenode format清空了namenode下的數(shù)據(jù),但是沒有清空datanode下的數(shù)據(jù),所以造成namenode節(jié)點(diǎn)上的namespaceID與datanode節(jié)點(diǎn)上的namespaceID不一致。啟動失敗。
解決辦法:參考該網(wǎng)址 http://blog.csdn.net/wh72592855/archive/2010/07/21/5752199.aspx 給出兩種解決方法,我們使用的是第一種解決方法:即:
(1)停掉集群服務(wù)
(2)在出問題的datanode節(jié)點(diǎn)上刪除data目錄,data目錄即是在hdfs-site.xml文件中配置的dfs.data.dir目錄,本機(jī)器上那個是/var/lib/hadoop-0.20/cache/hdfs/dfs/data/ (注:我們當(dāng)時在所有的datanode和namenode節(jié)點(diǎn)上均執(zhí)行了該步驟。以防刪掉后不成功,可以先把data目錄保存一個副本).
(3)格式化namenode.
(4)重新啟動集群。
問題解決。
這種方法帶來的一個副作用即是,hdfs上的所有數(shù)據(jù)丟失。如果hdfs上存放有重要數(shù)據(jù)的時候,不建議采用該方法,可以嘗試提供的網(wǎng)址中的第二種方法。
5. 目錄權(quán)限
start-dfs.sh執(zhí)行無錯,顯示啟動datanode,執(zhí)行完后無datanode。查看datanode機(jī)器上的日志,顯示因dfs.data.dir目錄權(quán)限不正確導(dǎo)致:
expected: drwxr-xr-x,current:drwxrwxr-x
解決辦法:
查看dfs.data.dir的目錄配置,修改權(quán)限即可。
hive錯誤
1.NoClassDefFoundError
Could not initialize class java.lang.NoClassDefFoundError: Could not initialize class org.apache.hadoop.hbase.io.HbaseObjectWritable
將protobuf-***.jar添加到j(luò)ars路徑
//$HIVE_HOME/conf/hive-site.xmlhive.aux.jars.path file:///data/hadoop/hive-0.10.0/lib/hive-hbase-handler-0.10.0.jar,file:///data/hadoop/hive-0.10.0/lib/hbase-0.94.8.jar,file:///data/hadoop/hive-0.10.0/lib/zookeeper-3.4.5.jar,file:///data/hadoop/hive-0.10.0/lib/guava-r09.jar,file:///data/hadoop/hive-0.10.0/lib/hive-contrib-0.10.0.jar,file:///data/hadoop/hive-0.10.0/lib/protobuf-java-2.4.0a.jar
2.hive動態(tài)分區(qū)異常
[Fatal Error] Operator FS_2 (id=2): Number of dynamic partitions exceeded hive.exec.max.dynamic.partitions.pernode
hive> set hive.exec.max.dynamic.partitions.pernode = 10000;
3.mapreduce進(jìn)程超內(nèi)存限制——hadoop Java heap space
vim mapred-site.xml添加:
//mapred-site.xmlmapred.child.java.opts -Xmx2048m
#$HADOOP_HOME/conf/hadoop_env.shexport HADOOP_HEAPSIZE=5000
4.hive文件數(shù)限制
[Fatal Error] total number of created files now is 100086, which exceeds 100000
hive> set hive.exec.max.created.files=655350;
5.metastore連接超時
FAILED: SemanticException org.apache.thrift.transport.TTransportException: java.net.SocketTimeoutException: Read timed out
解決方案:
hive> set hive.metastore.client.socket.timeout=500;
6. java.io.IOException: error=7, Argument list too long
Task with the most failures(5): -----Task ID: task_201306241630_0189_r_000009URL: http://namenode.godlovesdog.com:50030/taskdetails.jsp?jobid=job_201306241630_0189&tipid=task_201306241630_0189_r_000009-----Diagnostic Messages for this Task:java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime Error while processing row (tag=0) {"key":{"reducesinkkey0":"164058872","reducesinkkey1":"djh,S1","reducesinkkey2":"20130117170703","reducesinkkey3":"xxx"},"value":{"_col0":"1","_col1":"xxx","_col2":"20130117170703","_col3":"164058872","_col4":"xxx,S1"},"alias":0}at org.apache.hadoop.hive.ql.exec.ExecReducer.reduce(ExecReducer.java:270)at org.apache.hadoop.mapred.ReduceTask.runOldReducer(ReduceTask.java:520)at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:421)at org.apache.hadoop.mapred.Child$4.run(Child.java:255)at java.security.AccessController.doPrivileged(Native Method)at javax.security.auth.Subject.doAs(Subject.java:415)at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1149)at org.apache.hadoop.mapred.Child.main(Child.java:249)Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime Error while processing row (tag=0) {"key":{"reducesinkkey0":"164058872","reducesinkkey1":"xxx,S1","reducesinkkey2":"20130117170703","reducesinkkey3":"xxx"},"value":{"_col0":"1","_col1":"xxx","_col2":"20130117170703","_col3":"164058872","_col4":"djh,S1"},"alias":0}at org.apache.hadoop.hive.ql.exec.ExecReducer.reduce(ExecReducer.java:258)... 7 moreCaused by: org.apache.hadoop.hive.ql.metadata.HiveException: [Error 20000]: Unable to initialize custom script.at org.apache.hadoop.hive.ql.exec.ScriptOperator.processOp(ScriptOperator.java:354)at org.apache.hadoop.hive.ql.exec.Operator.process(Operator.java:474)at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:800)at org.apache.hadoop.hive.ql.exec.SelectOperator.processOp(SelectOperator.java:84)at org.apache.hadoop.hive.ql.exec.Operator.process(Operator.java:474)at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:800)at org.apache.hadoop.hive.ql.exec.ExtractOperator.processOp(ExtractOperator.java:45)at org.apache.hadoop.hive.ql.exec.Operator.process(Operator.java:474)at org.apache.hadoop.hive.ql.exec.ExecReducer.reduce(ExecReducer.java:249)... 7 moreCaused by: java.io.IOException: Cannot run program "/usr/bin/python2.7": error=7, 參數(shù)列表過長at java.lang.ProcessBuilder.start(ProcessBuilder.java:1042)at org.apache.hadoop.hive.ql.exec.ScriptOperator.processOp(ScriptOperator.java:313)... 15 moreCaused by: java.io.IOException: error=7, 參數(shù)列表過長at java.lang.UNIXProcess.forkAndExec(Native Method)at java.lang.UNIXProcess.(UNIXProcess.java:135)at java.lang.ProcessImpl.start(ProcessImpl.java:130)at java.lang.ProcessBuilder.start(ProcessBuilder.java:1023)... 16 moreFAILED: Execution Error, return code 20000 from org.apache.hadoop.hive.ql.exec.MapRedTask. Unable to initialize custom script.
解決方案:
升級內(nèi)核或減少分區(qū)數(shù)
“hadoop+hive使用中遇到的問題怎么解決”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識可以關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實(shí)用文章!