HMaster日志中频繁打印出FileNotFoundException信息
问题
当集群重启后会进行split WAL操作,在splitWAL期间,HMaster出现不能close log,日志中频繁打印出FileNotFoundException及no lease信息。
2017-06-10 09:50:27,586 | ERROR | split-log-closeStream-2 | Couldn't close log at hdfs://hacluster/hbase/data/default/largeT1/2b48346d087275fe751fc049334fda93/recovered.edits/0000000000000000000.temp | org.apache.hadoop.hbase.wal.WALSplitter$LogRecoveredEditsOutputSink$2.call(WALSplitter.java:1330) java.io.FileNotFoundException: No lease on /hbase/data/default/largeT1/2b48346d087275fe751fc049334fda93/recovered.edits/0000000000000000000.temp (inode 1092653): File does not exist. [Lease. Holder: DFSClient_NONMAPREDUCE_1202985678_1, pendingcreates: 1936] ?at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.checkLease(FSNamesystem.java:3432) ?at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.analyzeFileState(FSNamesystem.java:3223) ?at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getNewBlockTargets(FSNamesystem.java:3057) ?at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getAdditionalBlock(FSNamesystem.java:3011) ?at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.addBlock(NameNodeRpcServer.java:842) ?at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.addBlock(ClientNamenodeProtocolServerSideTranslatorPB.java:526) ?at org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java) ?at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:616) ?at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:973) ?at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2260) ?at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2256) ?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:1769) ?at org.apache.hadoop.ipc.Server$Handler.run(Server.java:2254) ?at sun.reflect.GeneratedConstructorAccessor40.newInstance(Unknown Source) ?at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ?at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ?at org.apache.hadoop.ipc.RemoteException.instantiateException(RemoteException.java:106) ?at org.apache.hadoop.ipc.RemoteException.unwrapRemoteException(RemoteException.java:73) ?at org.apache.hadoop.hdfs.DataStreamer.locateFollowingBlock(DataStreamer.java:1842) ?at org.apache.hadoop.hdfs.DataStreamer.nextBlockOutputStream(DataStreamer.java:1639) ?at org.apache.hadoop.hdfs.DataStreamer.run(DataStreamer.java:665)
回答
在splitWAL的过程中,参数“hbase.splitlog.manager.timeout”控制splitWAL的超时时间,若该时间内splitWAL无法完成,则会再次提交相同的任务,在一定时间内多次提交了相同的任务,当其中某次任务执行完毕时会删除这个temp文件,所以在后来的任务执行时无法找到这个文件,故出现FileNotFoudException。需做如下调整:
当前“hbase.splitlog.manager.timeout”的默认时间为“600000ms”,集群规格为每个regionserver上有2000~3000个region,在集群正常情况下(HBase无异常,HDFS无大量的读写操作等),建议此参数依据集群的规格进行调整,若实际规格(实际平均每个regonserver上region的个数)大于默认规格(默认平均每个regionserver上region的个数,即2000),则调整方案为(实际规格 / 默认规格)* 默认时间。
在服务端的“hbase-site.xml”文件中配置splitlog参数,如表1所示。