1. 程式人生 > >生產環境Tomcat伺服器訪問HDFS報錯

生產環境Tomcat伺服器訪問HDFS報錯

下載Tomcat日誌檔案 runtime_info.log檢視資訊:

[WARN ][19-01-11 18:07:19][http-nio-8080-exec-3][*]Exception encountered while connecting to the server : java.lang.IllegalArgumentException: Server has invalid Kerberos principal: hdfs/[email protected]
[WARN ][19-01-11 18:07:19][http-nio-8080-exec-3][*]Exception while invoking class org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolTranslatorPB.getFileInfo over svldl043.csvw.com/10.122.3.61:8020. Not retrying because failovers (15) exceeded maximum allowed (15)
java.io.IOException: Failed on local exception: java.io.IOException: java.lang.IllegalArgumentException: Server has invalid Kerberos principal: hdfs/
[email protected]
; Host Details : local host is: "svlvm128/10.122.31.36"; destination host is: "test043.lhx.com":8020; at org.apache.hadoop.net.NetUtils.wrapException(NetUtils.java:772) at org.apache.hadoop.ipc.Client.call(Client.java:1472) at org.apache.hadoop.ipc.Client.call(Client.java:1399) at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:232) at com.sun.proxy.$Proxy108.getFileInfo(Unknown Source) at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolTranslatorPB.getFileInfo(ClientNamenodeProtocolTranslatorPB.java:752) at sun.reflect.GeneratedMethodAccessor224.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:187) at org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:102) at com.sun.proxy.$Proxy109.getFileInfo(Unknown Source)

同樣程式碼部署到測試環境是OK的,初步判斷是叢集解析問題

#namenode
10.122.3.60 test042.lhx.com
10.122.3.61 test043.lhx.com
10.122.3.62 test044.lhx.com
10.122.3.63 test045.lhx.com

把叢集IP對映配置到Tomcat伺服器中即可。