2017-04-05 46 views
1

如果您想知道我如何解決它,請轉至hereRemoteException(org.apache.hadoop.ipc.StandbyException):操作類別READ在狀態備用中不受支持

我有一個oozie工作流程。裏面有一個shell動作。

<action name="start_fair_usage"> 
    <shell xmlns="uri:oozie:shell-action:0.1"> 
     <job-tracker>${JOB_TRACKER}</job-tracker> 
     <name-node>${NAME_NODE}</name-node> 
     <exec>${start_fair_usage}</exec>  
     <argument>${today_without_dash}</argument> 
     <argument>${yesterday_with_dash}</argument> 
     <file>${start_fair_usage_path}#${start_fair_usage}</file> 
     <capture-output/> 
    </shell> 
    <ok to="END"/> 
    <error to="KILL"/> 
    </action> 

此操作啓動腳本。 start_fair_usage.sh

echo "today_without_dash="$today_without_dash 
echo "yeasterday_with_dash="$yeasterday_with_dash 

echo "-----------RUN copy mta-------------" 
bash copy_file.sh mta $today_without_dash 
echo "-----------RUN copy rcr-------------" 
bash copy_file.sh rcr $today_without_dash 
echo "-----------RUN copy sub-------------" 
bash copy_file.sh sub $today_without_dash 

繼而啓動另一個腳本。 copy_file.sh

# directories in which where sub mtr rcr files are kept 
echo "directories" 
dirs=(
    /user/comverse/data/${2}_B 
    ) 

# clear the hdfs directory of old files and copy new files 
echo "remove old files "${1} 

hadoop fs -rm -skipTrash /apps/hive/warehouse/amd.db/fair_usage/fct_evkuzmin/file_${1}/* 

for i in $(hadoop fs -ls "${dirs[@]}" | egrep ${1}.gz | awk -F " " '{print $8}') 
do 
    hadoop fs -cp $i /apps/hive/warehouse/amd.db/fair_usage/fct_evkuzmin/file_${1} 
    echo "copy file - "${i} 
done 

echo "end copy "${1}" files" 

如何啓動工作流程以便它可以複製文件?

+0

異常來自Hadoop環境。 Oozie正試圖連接Active Namenode的Standby Namenode。檢查Namenode主機信息是否正確。 – franklinsijo

+0

@frank我無法找到StandBy和Active節點之間有什麼不同。但是當我嘗試在同一個節點上運行一個簡單的腳本'echo'hi''時,它就可以工作。 –

+0

閱讀關於HDFS高可用性 – franklinsijo

回答

0

我遇到了同樣的問題,下面是堆棧跟蹤:

2017-07-03 18:07:24,208 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: reportBadBlock encountered RemoteException for block: BP-455427998-10.120.117.100-1466433731629:blk_1140369410_67364810 
org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.ipc.StandbyException): Operation category WRITE is not supported in state standby 
     at org.apache.hadoop.hdfs.server.namenode.ha.StandbyState.checkOperation(StandbyState.java:87) 
     at org.apache.hadoop.hdfs.server.namenode.NameNode$NameNodeHAContext.checkOperation(NameNode.java:1774) 
     at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.checkOperation(FSNamesystem.java:1313) 
     at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.reportBadBlocks(FSNamesystem.java:6263) 
     at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.reportBadBlocks(NameNodeRpcServer.java:798) 
     at org.apache.hadoop.hdfs.protocolPB.DatanodeProtocolServerSideTranslatorPB.reportBadBlocks(DatanodeProtocolServerSideTranslatorPB.java:272) 
     at org.apache.hadoop.hdfs.protocol.proto.DatanodeProtocolProtos$DatanodeProtocolService$2.callBlockingMethod(DatanodeProtocolProtos.java:28766) 
     at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:616) 
     at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:969) 
     at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2049) 
     at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2045) 
     at java.security.AccessController.doPrivileged(Native Method) 
     at javax.security.auth.Subject.doAs(Subject.java:422) 
     at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1657) 
     at org.apache.hadoop.ipc.Server$Handler.run(Server.java:2045) 

     at org.apache.hadoop.ipc.Client.call(Client.java:1475) 
     at org.apache.hadoop.ipc.Client.call(Client.java:1412) 
     at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:229) 
     at com.sun.proxy.$Proxy14.reportBadBlocks(Unknown Source) 
     at org.apache.hadoop.hdfs.protocolPB.DatanodeProtocolClientSideTranslatorPB.reportBadBlocks(DatanodeProtocolClientSideTranslatorPB.java:290) 
     at org.apache.hadoop.hdfs.server.datanode.ReportBadBlockAction.reportTo(ReportBadBlockAction.java:62) 
     at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.processQueueMessages(BPServiceActor.java:988) 
     at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.offerService(BPServiceActor.java:727) 
     at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.run(BPServiceActor.java:824) 
     at java.lang.Thread.run(Thread.java:745) 

如果您熟悉Hadoop的RPC,你就會知道,上面的錯誤日誌happends當RPC客戶端(DataNode)試圖使遠程RPC調用RPC服務器(NameNode),NodeNode拋出一個異常,因爲它是一個備用的。因此,上面的一些stacktrace是服務器端堆棧,一些是客戶端堆棧跟蹤。

但關鍵是,它對你有沒有任何不良影響HDFS系統? 答案是絕對的

BPOffsetService.java

void notifyNamenodeReceivingBlock(ExtendedBlock block, String storageUuid) { 
checkBlock(block); 
ReceivedDeletedBlockInfo bInfo = new ReceivedDeletedBlockInfo(
    block.getLocalBlock(), BlockStatus.RECEIVING_BLOCK, null); 

for (BPServiceActor actor : bpServices) { 
    actor.notifyNamenodeBlock(bInfo, storageUuid, false); 
} 

}

bpServices商店都namenodes的RPC列表中,包括活性和one.Obviously備用,將其發送到兩個namenodes一個相同的請求,至少一個請求會報告「類別WRITE不支持狀態備用***」錯誤,另一個請求會成功。 所以,不用擔心。 在你的HDFS HA configurtion,如果配置是這樣的:

 <property> 
      <name>dfs.ha.namenodes.datahdfsmaster</name> 
      <value>namenode1,namenode2</value> 
    </property> 

不幸的是,如果namenode1是待機之一,那麼你會收到很多信息級別的日誌,因爲namenode1將被要求對一些操作和肯定NameNode方checkOperation()將引發INFO級異常。

相關問題