1. 程式人生 > >cm叢集增加新datanode 無法通訊,報錯:Datanode denied communication with namenode because the host is not in the

cm叢集增加新datanode 無法通訊,報錯:Datanode denied communication with namenode because the host is not in the

問題描述:在CM上新增一臺Dataode主機後,啟動datanode時,一直報下面的錯誤:

“ERROR org.apache.hadoop.hdfs.server.datanode.DataNode: Initialization failed for Block pool BP-1251007601-10.162.3.171-1464682677169 (Datanode Uuid 88ab81cd-ddb8-4ca4-8652-b631937aacec) service to DSJ-RTB-4T-202/10.162.3.172:8022 Datanode denied communication with namenode because the host is not in the include-list: DatanodeRegistration(10.162.2.225, datanodeUuid=88ab8

1cd-ddb8-4ca4-8652-b631937aacec, infoPort=50075, infoSecurePort=0, ipcPort=50020, storageInfo=lv=-56;cid=cluster16;nsid=565627482;c=0)”

並且CM頁面上“最新命令”顯示active namenode與standby namenode“重新整理節點列表”失敗,報超時錯誤。

 

問題原因:造成此問題的原因大部分是由於主機IP方面有問題。報錯上面提示的是與active namenode拒絕連線。

問題解決辦法有

方法一:檢查namenode節點的/etc/hosts配置,看是否有新新增的datanode資訊(其實所有機器都應該新增這臺IP)

方法二:CM - HDFS -> Namenode instance -> Actions => Refresh node list   //這個可能執行不成功,因為嘗試從CM上重新整理節點列表, 但是報timeout,所以CM和Namenode之間的通訊可能有些問題。

方法三:在namenode主機上進行手動重新整理

hdfs dfsadmin  -fs hdfs://DSJ-RTB-4T-201:8020 –refreshNodes   //其中的DSJ-RTB-4T-201為standby namenode的IP,如果有報錯active namenode,那就在active namenode上進行手動重新整理。最終使用這個方法能成功重新整理,並且新增的新datanode也能正常啟動了。

 

關於使用方法三的過程:

由於報錯上面提示的是與active namenode拒絕連線,所以手動在namenode節點上重新整理主機列表:

hadoop dfsadmin -fs hdfs://10.162.3.172:8020 -refreshNodes   //其中10.162.3.172是active namenode的IP

此時在active namenode也是能看到新新增的機器的:

/opt/cm-5.5.4/run/cloudera-scm-agent/process/135920-hdfs-NAMENODE-refresh目錄下去執行如下:

cat  dfs_hosts_allow.txt | grep 10.162.2.223 

https://img-blog.csdnimg.cn/20181128150309387.png

可以看出是有新加的節點的。

然後再次重啟datanode,發現datanode還是報以前一樣的錯誤,只不過裡面報的是與standby namenode節點拒絕連線,這次還是手動在standby namenode上重新整理主機列表:

hadoop dfsadmin -fs hdfs://10.162.3.171:8020 -refreshNodes   //其中10.162.3.171是active namenode的IP

最後重啟datanode,發現終於不報錯,也能正常使用了。

 

cloudera建議重啟cm agent的命令順序為:

/opt/cm-5.5.4/etc/init.d/cloudera-scm-agent next_stop_hard

/opt/cm-5.5.4/etc/init.d/cloudera-scm-agent stop

/opt/cm-5.5.4/etc/init.d/cloudera-scm-agent start