问题描述
我试图在Hadoop中启动datanode时出现了一些问题,从日志中我可以看到datanode启动了两次(部分日志如下):
2012-05-22 16:25:00,369 INFO org.apache.hadoop.hdfs.server.datanode.DataNode:STARTUP_MSG:
/ ************ ****************************************
STARTUP_MSG:启动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;由'hortonfo'在2月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:启动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;由'hortonfo'在2月14日星期二08:15:38 UTC 2012编辑
****************************** ****************************** /
2012-05-22 16:25:00,490 INFO org.apache。 hadoop.metrics2.impl.MetricsConfig:从hadoop-metrics2.properties加载的属性
2012-05-22 16:25:00,500 INFO org.apache.hadoop.metrics2.impl.MetricsSourceAdapter:MBean for source MetricsSystem,sub =统计已注册。
2012-05-22 16:25:00,500 INFO org.apache.hadoop.metrics2.impl.MetricsSystemImpl:计划的快照期限为10秒(s)。
2012-05-22 16:25:00,500 INFO org.apache.hadoop.metrics2.impl.MetricsSystemImpl:DataNode指标系统启动
INFO org.apache。2012-05-22 16:25:00,512 INFO org.apache。 hadoop.metrics2.impl.MetricsConfig:从hadoop-metrics2.properties加载的属性
2012-05-22 16:25:00,523 INFO org.apache.hadoop.metrics2.impl.MetricsSourceAdapter:MBean for source MetricsSystem,sub =统计已注册。
2012-05-22 16:25:00,523 INFO org.apache.hadoop.metrics2.impl.MetricsSystemImpl:计划的10秒快照周期。
2012-05-22 16:25:00,524 INFO org.apache.hadoop.metrics2.impl.MetricsSystemImpl:DataNode度量系统启动
INFO org.apache。 hadoop.metrics2.impl.MetricsSourceAdapter:注册源ugi的MBean。
2012-05-22 16:25:00,724 INFO org.apache.hadoop.metrics2.impl.MetricsSourceAdapter:注册源ugi的MBean。
2012-05-22 16:25:00,727 WARN org.apache.hadoop.metrics2.impl.MetricsSystemImpl:源名称ugi已经存在!
2012-05-22 16:25:00,729 WARN org.apache.hadoop.metrics2.impl.MetricsSystemImpl:源名称ugi已经存在!
2012-05-22 16:20:15,894 INFO org.apache.hadoop.hdfs.server.common.Storage:无法锁定storage / app / hadoop / tmp / dfs / data。该目录已被锁定。
2012-05-22 16:20:16,008错误org.apache.hadoop.hdfs.server.datanode.DataNode:java.io.IOException:无法锁定存储/应用程序/ hadoop / tmp / dfs / data。该目录已被锁定。
位于org.apache.hadoop.hdfs.server.common.Storage $ StorageDirectory.lock(Storage.java:602)
位于org.apache.hadoop.hdfs.server.common.Storage $ StorageDirectory。在org.apache.hadoop.hdfs.server.datanode.DataStorage.recoverTransitionRead(DataStorage.java:111)上的analyzeStorage(Storage.java:455)
,位于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)
位于org.apache.hadoop.hdfs.server.datanode.DataNode.main(DataNode.java:1682)
我在网上搜索过,发现,但我没有用conf / hdfs-site.xml覆盖任何东西,如下所示,所以Hadoop应该使用default (如所述)不会导致任何锁失败。
这是我的conf / hdfs-site.xml:
<?xml version =1.0?> ;
<?xml-stylesheet type =text / xslhref =configuration.xsl?>
<配置>
<属性>
< name> dfs.replication< / name>
<值> 2< /值>
< description>默认块复制。
创建文件时可以指定实际的复制次数。
如果在创建时未指定复制,则使用默认值。
< / description>
< / property>
< / configuration>
这是我的conf / core-site.xml:
<?xml version =1.0?>
<?xml-stylesheet type =text / xslhref =configuration.xsl?>
<配置>
<属性>
< name> hadoop.tmp.dir< / name>
< value> / app / hadoop / tmp< / value>
< description>其他临时目录的基础。< / description>
< / property>
<属性>
<名称> fs.default.name< /名称>
< value> hdfs:// master:54310< / value>
< description>默认文件系统的名称。一个URI,其
模式和权限决定了FileSystem的实现。
uri的方案决定配置属性(fs.SEMEME.impl)命名
FileSystem实现类。 uri的权限用于
确定文件系统的主机,端口等。< / description>
< / property>
< / configuration>
这是hadoop / conf / slaves的内容:
master
奴隶
它应该工作得很好
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):
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.This is my 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:
<?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:
master
slave
- stop datanode
- remove the in_use.lock file from the dfs data dir
- location and start datanode
it should work just fine
这篇关于Hadoop datanode无法启动抛出org.apache.hadoop.hdfs.server.common.Storage:无法锁定存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!