Hadoop name node 目录更改, NameNode 进程启动失败

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>/usr/local/hadoop/tmp</value>
<description>if  you change this dir,  you should format it again, else you will fail to start name node </description>
</property>
<property>
<name>fs.default.name</name>
<value>hdfs://hadoop:9000</value>
</property>
<property>
<name>dfs.permission</name>
<value>false</value>
</property>

</configuration>

问题步骤:

1.   <value>/homel/hadoop/tmp</value>   =>   <value>/usr/local/hadoop/tmp</value>

2. 执行 start-all.sh 启动hadoop.

[root@hadoop bin]# start-all.sh
starting namenode, logging to /usr/local/hadoop/libexec/../logs/hadoop-root-namenode-hadoop.out
localhost: starting datanode, logging to /usr/local/hadoop/libexec/../logs/hadoop-root-datanode-hadoop.out
localhost: starting secondarynamenode, logging to /usr/local/hadoop/libexec/../logs/hadoop-root-secondarynamenode-hadoop.out
starting jobtracker, logging to /usr/local/hadoop/libexec/../logs/hadoop-root-jobtracker-hadoop.out
localhost: starting tasktracker, logging to /usr/local/hadoop/libexec/../logs/hadoop-root-tasktracker-hadoop.out

3.执行 jps 查看hadoop进程启动情况

[root@hadoop bin]# jps
3777 DataNode
3974 JobTracker
4089 TaskTracker
3892 SecondaryNameNode
4168 Jps

发现少了个NameNode进程。


问题跟踪:

查看 /usr/local/hadoop/logs/hadoop-root-namenode-hadoop.log

2014-07-22 07:13:14,289 INFO org.apache.hadoop.hdfs.server.common.Storage: Storage directory /usr/local/hadoop/tmp/dfs/name does not exist.
2014-07-22 07:13:14,298 ERROR org.apache.hadoop.hdfs.server.namenode.FSNamesystem: FSNamesystem initialization failed.
org.apache.hadoop.hdfs.server.common.InconsistentFSStateException: Directory /usr/local/hadoop/tmp/dfs/name is in an inconsistent state: storage directory does not exist or is not accessible.
at org.apache.hadoop.hdfs.server.namenode.FSImage.recoverTransitionRead(FSImage.java:303)
at org.apache.hadoop.hdfs.server.namenode.FSDirectory.loadFSImage(FSDirectory.java:100)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.initialize(FSNamesystem.java:411)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.<init>(FSNamesystem.java:379)
at org.apache.hadoop.hdfs.server.namenode.NameNode.initialize(NameNode.java:284)
at org.apache.hadoop.hdfs.server.namenode.NameNode.<init>(NameNode.java:536)
at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1410)
at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1419)
2014-07-22 07:13:14,303 ERROR org.apache.hadoop.hdfs.server.namenode.NameNode: org.apache.hadoop.hdfs.server.common.InconsistentFSStateException: Directory /usr/local/hadoop/tmp/dfs/name is in an inconsistent state: storage directory does not exist or is not accessible.
at org.apache.hadoop.hdfs.server.namenode.FSImage.recoverTransitionRead(FSImage.java:303)
at org.apache.hadoop.hdfs.server.namenode.FSDirectory.loadFSImage(FSDirectory.java:100)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.initialize(FSNamesystem.java:411)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.<init>(FSNamesystem.java:379)
at org.apache.hadoop.hdfs.server.namenode.NameNode.initialize(NameNode.java:284)
at org.apache.hadoop.hdfs.server.namenode.NameNode.<init>(NameNode.java:536)
at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1410)
at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1419)


猜想是不是 name node 目录更改后是否,要重新格式化。于是,执行:

[root@hadoop bin]# hadoop namenode -format
14/07/22 07:36:29 INFO namenode.NameNode: STARTUP_MSG:
/************************************************************
STARTUP_MSG: Starting NameNode
STARTUP_MSG:   host = hadoop/192.168.80.100
STARTUP_MSG:   args = [-format]
STARTUP_MSG:   version = 1.1.2
STARTUP_MSG:   build = https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1.1 -r 1440782; compiled by 'hortonfo' on Thu Jan 31 02:03:24 UTC 2013
************************************************************/
Re-format filesystem in /usr/local/hadoop/tmp/dfs/name ? (Y or N) y
Format aborted in /usr/local/hadoop/tmp/dfs/name
14/07/22 07:36:56 INFO namenode.NameNode: SHUTDOWN_MSG:
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at hadoop/192.168.80.100
************************************************************/

log显示,格式化流产。


网上查资料,推荐方法:

 删除 tmp 目录 ,重新格式化:

[root@hadoop bin]# hadoop namenode -format
14/07/22 07:41:03 INFO namenode.NameNode: STARTUP_MSG:
/************************************************************
STARTUP_MSG: Starting NameNode
STARTUP_MSG:   host = hadoop/192.168.80.100
STARTUP_MSG:   args = [-format]
STARTUP_MSG:   version = 1.1.2
STARTUP_MSG:   build = https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1.1 -r 1440782; compiled by 'hortonfo' on Thu Jan 31 02:03:24 UTC 2013
************************************************************/
14/07/22 07:41:03 INFO util.GSet: VM type       = 32-bit
14/07/22 07:41:03 INFO util.GSet: 2% max memory = 19.33375 MB
14/07/22 07:41:03 INFO util.GSet: capacity      = 2^22 = 4194304 entries
14/07/22 07:41:03 INFO util.GSet: recommended=4194304, actual=4194304
14/07/22 07:41:04 INFO namenode.FSNamesystem: fsOwner=root
14/07/22 07:41:04 INFO namenode.FSNamesystem: supergroup=supergroup
14/07/22 07:41:04 INFO namenode.FSNamesystem: isPermissionEnabled=true
14/07/22 07:41:04 INFO namenode.FSNamesystem: dfs.block.invalidate.limit=100
14/07/22 07:41:04 INFO namenode.FSNamesystem: isAccessTokenEnabled=false accessKeyUpdateInterval=0 min(s), accessTokenLifetime=0 min(s)
14/07/22 07:41:04 INFO namenode.NameNode: Caching file names occuring more than 10 times
14/07/22 07:41:04 INFO common.Storage: Image file of size 110 saved in 0 seconds.
14/07/22 07:41:04 INFO namenode.FSEditLog: closing edit log: position=4, editlog=/usr/local/hadoop/tmp/dfs/name/current/edits
14/07/22 07:41:04 INFO namenode.FSEditLog: close success: truncate to 4, editlog=/usr/local/hadoop/tmp/dfs/name/current/edits
14/07/22 07:41:04 INFO common.Storage: Storage directory /usr/local/hadoop/tmp/dfs/name has been successfully formatted.
14/07/22 07:41:04 INFO namenode.NameNode: SHUTDOWN_MSG:
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at hadoop/192.168.80.100
************************************************************/
[root@hadoop bin]# start-all.sh
starting namenode, logging to /usr/local/hadoop/libexec/../logs/hadoop-root-namenode-hadoop.out
localhost: starting datanode, logging to /usr/local/hadoop/libexec/../logs/hadoop-root-datanode-hadoop.out
localhost: starting secondarynamenode, logging to /usr/local/hadoop/libexec/../logs/hadoop-root-secondarynamenode-hadoop.out
starting jobtracker, logging to /usr/local/hadoop/libexec/../logs/hadoop-root-jobtracker-hadoop.out
localhost: starting tasktracker, logging to /usr/local/hadoop/libexec/../logs/hadoop-root-tasktracker-hadoop.out
[root@hadoop bin]# jps
7907 TaskTracker
7574 DataNode
7700 SecondaryNameNode
7792 JobTracker
8023 Jps
7460 NameNode


成功。

没有更多推荐了,返回首页