简体   繁体   English

Hadoop datanode无法开始抛出org.apache.hadoop.hdfs.server.common.Storage:无法锁定存储

[英]Hadoop datanode fails to start throwing org.apache.hadoop.hdfs.server.common.Storage: Cannot lock storage

I have some problems trying to start a datanode in Hadoop, from the log I can see that datanode is started twice (partial log follows): 我在尝试在Hadoop中启动datanode时遇到一些问题,从日志中我可以看到datanode启动了两次(部分日志跟随):

2012-05-22 16:25:00,369 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: STARTUP_MSG: 
/************************************************************
STARTUP_MSG: Starting DataNode
STARTUP_MSG:   host = master/192.168.0.1
STARTUP_MSG:   args = []
STARTUP_MSG:   version = 1.0.1
STARTUP_MSG:   build = https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1.0 -r 1243785; compiled by 'hortonfo' on Tue Feb 14 08:15:38 UTC 2012
************************************************************/
2012-05-22 16:25:00,375 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: STARTUP_MSG: 
/************************************************************
STARTUP_MSG: Starting DataNode
STARTUP_MSG:   host = master/192.168.0.1
STARTUP_MSG:   args = []
STARTUP_MSG:   version = 1.0.1
STARTUP_MSG:   build = https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1.0 -r 1243785; compiled by 'hortonfo' on Tue Feb 14 08:15:38 UTC 2012
************************************************************/
2012-05-22 16:25:00,490 INFO org.apache.hadoop.metrics2.impl.MetricsConfig: loaded properties from hadoop-metrics2.properties
2012-05-22 16:25:00,500 INFO org.apache.hadoop.metrics2.impl.MetricsSourceAdapter: MBean for source MetricsSystem,sub=Stats registered.
2012-05-22 16:25:00,500 INFO org.apache.hadoop.metrics2.impl.MetricsSystemImpl: Scheduled snapshot period at 10 second(s).
2012-05-22 16:25:00,500 INFO org.apache.hadoop.metrics2.impl.MetricsSystemImpl: DataNode metrics system started
2012-05-22 16:25:00,512 INFO org.apache.hadoop.metrics2.impl.MetricsConfig: loaded properties from hadoop-metrics2.properties
2012-05-22 16:25:00,523 INFO org.apache.hadoop.metrics2.impl.MetricsSourceAdapter: MBean for source MetricsSystem,sub=Stats registered.
2012-05-22 16:25:00,523 INFO org.apache.hadoop.metrics2.impl.MetricsSystemImpl: Scheduled snapshot period at 10 second(s).
2012-05-22 16:25:00,524 INFO org.apache.hadoop.metrics2.impl.MetricsSystemImpl: DataNode metrics system started
2012-05-22 16:25:00,722 INFO org.apache.hadoop.metrics2.impl.MetricsSourceAdapter: MBean for source ugi registered.
2012-05-22 16:25:00,724 INFO org.apache.hadoop.metrics2.impl.MetricsSourceAdapter: MBean for source ugi registered.
2012-05-22 16:25:00,727 WARN org.apache.hadoop.metrics2.impl.MetricsSystemImpl: Source name ugi already exists!
2012-05-22 16:25:00,729 WARN org.apache.hadoop.metrics2.impl.MetricsSystemImpl: Source name ugi already exists!
2012-05-22 16:20:15,894 INFO org.apache.hadoop.hdfs.server.common.Storage: Cannot lock storage /app/hadoop/tmp/dfs/data. The directory is already locked.
2012-05-22 16:20:16,008 ERROR org.apache.hadoop.hdfs.server.datanode.DataNode: java.io.IOException: Cannot lock storage /app/hadoop/tmp/dfs/data. The directory is already locked.
        at org.apache.hadoop.hdfs.server.common.Storage$StorageDirectory.lock(Storage.java:602)
        at org.apache.hadoop.hdfs.server.common.Storage$StorageDirectory.analyzeStorage(Storage.java:455)
        at org.apache.hadoop.hdfs.server.datanode.DataStorage.recoverTransitionRead(DataStorage.java:111)
        at org.apache.hadoop.hdfs.server.datanode.DataNode.startDataNode(DataNode.java:385)
        at org.apache.hadoop.hdfs.server.datanode.DataNode.<init>(DataNode.java:299)
        at org.apache.hadoop.hdfs.server.datanode.DataNode.makeInstance(DataNode.java:1582)
        at org.apache.hadoop.hdfs.server.datanode.DataNode.instantiateDataNode(DataNode.java:1521)
        at org.apache.hadoop.hdfs.server.datanode.DataNode.createDataNode(DataNode.java:1539)
        at org.apache.hadoop.hdfs.server.datanode.DataNode.secureMain(DataNode.java:1665)
        at org.apache.hadoop.hdfs.server.datanode.DataNode.main(DataNode.java:1682)

I've searched online and I found this question , but I didn't overwrite anything using conf/hdfs-site.xml, that is shown below, so Hadoop should use default values that (as described here ) cannot cause any failed lock. 我在网上搜索,我发现这个问题 ,但使用的conf / HDFS-site.xml中我没有覆盖任何东西,也就是如下图所示,这样的Hadoop应该使用(如描述默认值这里 )不能引起任何故障的锁。 This is my conf/hdfs-site.xml: 这是我的conf / hdfs-site.xml:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<!-- Put site-specific property overrides in this file. -->

<configuration>
  <property>
    <name>dfs.replication</name>
    <value>2</value>
    <description>Default block replication.
    The actual number of replications can be specified when the file is created.
    The default is used if replication is not specified in create time.
    </description>
  </property>
</configuration>

This is my conf/core-site.xml: 这是我的conf / core-site.xml:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<!-- Put site-specific property overrides in this file. -->

<configuration>
  <property>
    <name>hadoop.tmp.dir</name>
    <value>/app/hadoop/tmp</value>
    <description>A base for other temporary directories.</description>
  </property>

  <property>
    <name>fs.default.name</name>
    <value>hdfs://master:54310</value>
    <description>The name of the default file system.  A URI whose
    scheme and authority determine the FileSystem implementation.  The
    uri's scheme determines the config property (fs.SCHEME.impl) naming
    the FileSystem implementation class.  The uri's authority is used to
    determine the host, port, etc. for a filesystem.</description>
  </property>
</configuration>

This is the content of hadoop/conf/slaves: 这是hadoop / conf / slaves的内容:

master
slave
  • stop datanode 停止datanode
  • remove the in_use.lock file from the dfs data dir 从dfs数据目录中删除in_use.lock文件
  • location and start datanode 位置和启动datanode

it should work just fine 它应该工作得很好

Also add the following 2 properties in your hdfs-site.xml file.. 还要在hdfs-site.xml文件中添加以下2个属性。

<property>
        <name>dfs.name.dir</name>
        <value>/some_path</value>
    </property>

    <property>
        <name>dfs.data.dir</name>
        <value>/some_path</value>
    </property>

their default location is /tmp..because of this you lose data on each restart. 它们的默认位置是/tmp ..因此,每次重启都会丢失数据。

I was facing a similar issue, but I read a post that said the dfs.name.dir and dfs.data.dir should be different from each other. 我遇到了类似的问题,但我读了一篇文章说dfs.name.dir和dfs.data.dir应该彼此不同。 I had the two to be the same, and changing these values to be different from each other fixed my issue. 我让这两个是相同的,并将这些值更改为彼此不同修复了我的问题。

我有同样的问题,并在shell中将umask设置为0022,我在运行测试时为我解决了问题。

sudo rm -r /tmp/hadoop-[YourNameHere]/dfs/data/

并重新启动dfs。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:找不到或加载主类org.apache.hadoop.hdfs.server.datanode.DataNode - Error: Could not find or load main class org.apache.hadoop.hdfs.server.datanode.DataNode 调用主org.apache.hadoop.hdfs.server.datanode.DataNode失败 - Call to master failed org.apache.hadoop.hdfs.server.datanode.DataNode DataNode 无法与名称节点连接 - “org.apache.hadoop.ipc.Client: Retrying connect to server” - DataNode cannot connect with Name Node - "org.apache.hadoop.ipc.Client: Retrying connect to server" DataNode无法在Hadoop中启动 - DataNode failing to Start in Hadoop org.apache.hadoop.hdfs.DFSInputStream中的NoSuchMethodError - NoSuchMethodError at org.apache.hadoop.hdfs.DFSInputStream mac vist docker hadoop hdfs datanode 失败 - mac vist docker hadoop hdfs datanode failed org.apache.hadoop.fs.FileSystem:提供者org.apache.hadoop.hdfs.DistributedFileSystem不是子类型 - org.apache.hadoop.fs.FileSystem: Provider org.apache.hadoop.hdfs.DistributedFileSystem not a subtype 无法创建代理提供程序类 org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider - Couldn't create proxy provider class org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider 方案没有文件系统:找不到 hdfs 和类 org.apache.hadoop.DistributedFileSystem - No FileSystem for scheme:hdfs and Class org.apache.hadoop.DistributedFileSystem not found 导入org.apache.hadoop无法解析 - The import org.apache.hadoop cannot be resolved
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM