nfslock 导致 namenode无法format
接上一篇,接挂载nfs硬盘后,重新启动namenode,以便所有元数据能够顺利写到nfs硬盘中。过程为首先namenode 发现nfs硬盘没有format,先进行format在将fsimage 写入nfs中。在启动过程中发现如下错误:
ERROR org.apache.hadoop.hdfs.server.common.Storage: Cannot create lock on /×××/in_use.lock
java.io.IOException: No locks available
at sun.nio.ch.FileChannelImpl.lock0(Native Method)
at sun.nio.ch.FileChannelImpl.tryLock(FileChannelImpl.java:871)
at java.nio.channels.FileChannel.tryLock(FileChannel.java:962)
at org.apache.hadoop.hdfs.server.common.Storage$StorageDirectory.tryLock(Storage.java:627)
at org.apache.hadoop.hdfs.server.common.Storage$StorageDirectory.lock(Storage.java:605)
at org.apache.hadoop.hdfs.server.common.Storage$StorageDirectory.analyzeStorage(Storage.java:463)
at org.apache.hadoop.hdfs.server.namenode.FSImage.recoverTransitionRead(FSImage.java:300)
at org.apache.hadoop.hdfs.server.namenode.FSDirectory.loadFSImage(FSDirectory.java:99)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.initialize(FSNamesystem.java:358)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.<init>(FSNamesystem.java:327)
at org.apache.hadoop.hdfs.server.namenode.NameNode.initialize(NameNode.java:271)
at org.apache.hadoop.hdfs.server.namenode.NameNode.<init>(NameNode.java:465)
at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1224)
at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1233)
错误原因,nfslock服务启动有问题。解决方法在nfs的客户端和服务器端都运行sudo service nfslock start或者sudo service nfslock restart