Namenode没有启动

发布于 2024-12-14 20:02:42 字数 203 浏览 4 评论 0原文

我以伪分布式模式使用 Hadoop,一切正常。但后来由于某种原因我不得不重新启动计算机。现在,当我尝试启动 Namenode 和 Datanode 时,我只能发现 Datanode 正在运行。谁能告诉我这个问题的可能原因?或者我做错了什么?

我尝试了 bin/start-all.shbin/start-dfs.sh

I was using Hadoop in a pseudo-distributed mode and everything was working fine. But then I had to restart my computer because of some reason. And now when I am trying to start Namenode and Datanode I can find only Datanode running. Could anyone tell me the possible reason of this problem? Or am I doing something wrong?

I tried both bin/start-all.sh and bin/start-dfs.sh.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(22

朱染 2024-12-21 20:02:42

我遇到了 namenode 未启动的问题。我找到了使用以下方法的解决方案:

  1. 首先删除临时文件夹中的所有内容:rm -Rf(我的是/usr/local/hadoop/tmp)
  2. 格式化名称节点:bin /hadoop namenode -format
  3. 再次启动所有进程:bin/start-all.sh

您也可以考虑使用检查点回滚(如果您启用了它)。

I was facing the issue of namenode not starting. I found a solution using following:

  1. first delete all contents from temporary folder: rm -Rf <tmp dir> (my was /usr/local/hadoop/tmp)
  2. format the namenode: bin/hadoop namenode -format
  3. start all processes again:bin/start-all.sh

You may consider rolling back as well using checkpoint (if you had it enabled).

楠木可依 2024-12-21 20:02:42

core-site.xml 中的 hadoop.tmp.dir默认/tmp/hadoop-${user.name},每次重新启动后都会清除。将其更改为其他目录,该目录在重新启动时不会被清除。

hadoop.tmp.dir in the core-site.xml is defaulted to /tmp/hadoop-${user.name} which is cleaned after every reboot. Change this to some other directory which doesn't get cleaned on reboot.

戴着白色围巾的女孩 2024-12-21 20:02:42

以下STEPS对hadoop 2.2.0有用,

STEP 1停止hadoop

hduser@prayagupd$ /usr/local/hadoop-2.2.0/sbin/stop-dfs.sh

STEP 2删除tmp文件夹

hduser@prayagupd$ sudo rm -rf /app/hadoop/tmp/

STEP 3创建 /app/hadoop/tmp/

hduser@prayagupd$ sudo mkdir -p /app/hadoop/tmp
hduser@prayagupd$ sudo chown hduser:hadoop /app/hadoop/tmp
hduser@prayagupd$ sudo chmod 750 /app/hadoop/tmp

STEP 4 格式化 namenode

hduser@prayagupd$ hdfs namenode -format

STEP 5 启动 dfs

hduser@prayagupd$ /usr/local/hadoop-2.2.0/sbin/start-dfs.sh

STEP 6 检查 jps

hduser@prayagupd$ $ jps
11342 Jps
10804 DataNode
11110 SecondaryNameNode
10558 NameNode

Following STEPS worked for me with hadoop 2.2.0,

STEP 1 stop hadoop

hduser@prayagupd$ /usr/local/hadoop-2.2.0/sbin/stop-dfs.sh

STEP 2 remove tmp folder

hduser@prayagupd$ sudo rm -rf /app/hadoop/tmp/

STEP 3 create /app/hadoop/tmp/

hduser@prayagupd$ sudo mkdir -p /app/hadoop/tmp
hduser@prayagupd$ sudo chown hduser:hadoop /app/hadoop/tmp
hduser@prayagupd$ sudo chmod 750 /app/hadoop/tmp

STEP 4 format namenode

hduser@prayagupd$ hdfs namenode -format

STEP 5 start dfs

hduser@prayagupd$ /usr/local/hadoop-2.2.0/sbin/start-dfs.sh

STEP 6 check jps

hduser@prayagupd$ $ jps
11342 Jps
10804 DataNode
11110 SecondaryNameNode
10558 NameNode
陈年往事 2024-12-21 20:02:42

在conf/hdfs-site.xml中,您应该有一个类似属性

<property>
    <name>dfs.name.dir</name>
    <value>/home/user/hadoop/name/data</value>
</property>

“dfs.name.dir”的属性,允许您控制Hadoop写入NameNode元数据的位置。
给它另一个目录而不是 /tmp 可确保重新启动时 NameNode 数据不会被删除。

In conf/hdfs-site.xml, you should have a property like

<property>
    <name>dfs.name.dir</name>
    <value>/home/user/hadoop/name/data</value>
</property>

The property "dfs.name.dir" allows you to control where Hadoop writes NameNode metadata.
And giving it another dir rather than /tmp makes sure the NameNode data isn't being deleted when you reboot.

潦草背影 2024-12-21 20:02:42

打开一个新终端并使用 path-to-your-hadoop-install/bin/hadoop namenode 启动 namenode

使用 jps 和 namenode 的检查应该正在运行

Open a new terminal and start the namenode using path-to-your-hadoop-install/bin/hadoop namenode

The check using jps and namenode should be running

单挑你×的.吻 2024-12-21 20:02:42

为什么这里的大多数答案都假设所有数据都需要删除、重新格式化,然后重新启动 Hadoop?
我们怎么知道namenode没有进展,而是花费了大量时间。
当HDFS中有大量数据时就会这样做。
在假设任何内容挂起或卡住之前,请检查日志中的进度。

$ [kadmin@hadoop-node-0 logs]$ tail hadoop-kadmin-namenode-hadoop-node-0.log

...
016-05-13 18:16:44,405 INFO org.apache.hadoop.hdfs.server.namenode.FSEditLogLoader: replaying edit log: 117/141 transactions completed. (83%)
2016-05-13 18:16:56,968 INFO org.apache.hadoop.hdfs.server.namenode.FSEditLogLoader: replaying edit log: 121/141 transactions completed. (86%)
2016-05-13 18:17:06,122 INFO org.apache.hadoop.hdfs.server.namenode.FSEditLogLoader: replaying edit log: 122/141 transactions completed. (87%)
2016-05-13 18:17:38,321 INFO org.apache.hadoop.hdfs.server.namenode.FSEditLogLoader: replaying edit log: 123/141 transactions completed. (87%)
2016-05-13 18:17:56,562 INFO org.apache.hadoop.hdfs.server.namenode.FSEditLogLoader: replaying edit log: 124/141 transactions completed. (88%)
2016-05-13 18:17:57,690 INFO org.apache.hadoop.hdfs.server.namenode.FSEditLogLoader: replaying edit log: 127/141 transactions completed. (90%)

这是在某个特定系统上等待了近一个小时之后。
每次我看它时,它仍然在进步。
在启动系统时对 Hadoop 要有耐心,并在假设某些内容挂起或没有进展之前检查日志。

Why do most answers here assume that all data needs to be deleted, reformatted, and then restart Hadoop?
How do we know namenode is not progressing, but taking lots of time.
It will do this when there is a large amount of data in HDFS.
Check progress in logs before assuming anything is hung or stuck.

$ [kadmin@hadoop-node-0 logs]$ tail hadoop-kadmin-namenode-hadoop-node-0.log

...
016-05-13 18:16:44,405 INFO org.apache.hadoop.hdfs.server.namenode.FSEditLogLoader: replaying edit log: 117/141 transactions completed. (83%)
2016-05-13 18:16:56,968 INFO org.apache.hadoop.hdfs.server.namenode.FSEditLogLoader: replaying edit log: 121/141 transactions completed. (86%)
2016-05-13 18:17:06,122 INFO org.apache.hadoop.hdfs.server.namenode.FSEditLogLoader: replaying edit log: 122/141 transactions completed. (87%)
2016-05-13 18:17:38,321 INFO org.apache.hadoop.hdfs.server.namenode.FSEditLogLoader: replaying edit log: 123/141 transactions completed. (87%)
2016-05-13 18:17:56,562 INFO org.apache.hadoop.hdfs.server.namenode.FSEditLogLoader: replaying edit log: 124/141 transactions completed. (88%)
2016-05-13 18:17:57,690 INFO org.apache.hadoop.hdfs.server.namenode.FSEditLogLoader: replaying edit log: 127/141 transactions completed. (90%)

This was after nearly an hour of waiting on a particular system.
It is still progressing each time I look at it.
Have patience with Hadoop when bringing up the system and check logs before assuming something is hung or not progressing.

且行且努力 2024-12-21 20:02:42

在 core-site.xml 中:

    <configuration>
       <property>
          <name>fs.defaultFS</name>
          <value>hdfs://localhost:9000</value>
       </property>
       <property>
          <name>hadoop.tmp.dir</name>
          <value>/home/yourusername/hadoop/tmp/hadoop-${user.name}
         </value>
  </property>
</configuration>

namenode 的格式为:

hdfs namenode -format

适用于 hadoop 2.8.1

In core-site.xml:

    <configuration>
       <property>
          <name>fs.defaultFS</name>
          <value>hdfs://localhost:9000</value>
       </property>
       <property>
          <name>hadoop.tmp.dir</name>
          <value>/home/yourusername/hadoop/tmp/hadoop-${user.name}
         </value>
  </property>
</configuration>

and format of namenode with :

hdfs namenode -format

worked for hadoop 2.8.1

Spring初心 2024-12-21 20:02:42

如果有人使用hadoop1.2.1版本并且无法运行namenode,请转到core-site.xml,并将dfs.default.name更改为fs.default .name.

然后使用 $hadoop namenode -format 格式化 namenode。

最后使用 start-dfs.sh 运行 hdfs 并使用 jps 检查服务。

If anyone using hadoop1.2.1 version and not able to run namenode, go to core-site.xml, and change dfs.default.name to fs.default.name.

And then format the namenode using $hadoop namenode -format.

Finally run the hdfs using start-dfs.sh and check for service using jps..

莫言歌 2024-12-21 20:02:42

如果在运行 hadoop 时保留默认配置,namenode 的端口将为 50070。您需要找到在此端口上运行的任何进程并首先终止它们。

  • 停止所有正在运行的hadoop:bin/stop-all.sh

    检查端口 50070 中运行的所有进程

  • sudo netstat -tulpn | 50070 grep :50070 #检查正在运行的任何进程
    端口 50070,如果有的话/会
    出现在输出的右侧。

  • sudo Kill -9; #kill_the_process.

  • sudo rm -r /app/hadoop/tmp #删除临时文件夹

  • sudo mkdir /app/hadoop/tmp #重新创建它

  • sudo chmod 777 –R /app/hadoop/tmp(777 仅用于此示例目的)

  • bin/hadoop namenode –format #format hadoop namenode

  • bin/start-all.sh #启动所有hadoop服务

请参阅此博客< /a>

If you kept default configurations when running hadoop the port for the namenode would be 50070. You will need to find any processes running on this port and kill them first.

  • Stop all running hadoop with : bin/stop-all.sh

    check all processes running in port 50070

  • sudo netstat -tulpn | grep :50070 #check any processes running in
    port 50070, if there are any the / will
    appear at the RHS of the output.

  • sudo kill -9 <process_id> #kill_the_process.

  • sudo rm -r /app/hadoop/tmp #delete the temp folder

  • sudo mkdir /app/hadoop/tmp #recreate it

  • sudo chmod 777 –R /app/hadoop/tmp (777 is given for this example purpose only)

  • bin/hadoop namenode –format #format hadoop namenode

  • bin/start-all.sh #start-all hadoop services

Refer this blog

荒芜了季节 2024-12-21 20:02:42

您是否更改了conf/hdfs-site.xmldfs.name.dir

更改名称节点后对其进行格式化。

$ bin/hadoop namenode -format
$ bin/hadoop start-all.sh

Did you change conf/hdfs-site.xml dfs.name.dir?

Format namenode after you change it.

$ bin/hadoop namenode -format
$ bin/hadoop start-all.sh
夏末 2024-12-21 20:02:42

如果您在重新启动系统后遇到此问题,那么以下步骤将可以很好地

解决问题。

1) 格式化 namenode:bin/hadoop namenode -format

2) 再次启动所有进程:bin/start-all.sh

对于 Perm 修复: -

1) 转到 / conf/core-site.xml 将 fs.default.name 更改为您的自定义名称。

2) 格式化namenode:bin/hadoop namenode -format

3) 再次启动所有进程:bin/start-all.sh

If you facing this issue after rebooting the system, Then below steps will work fine

For workaround.

1) format the namenode: bin/hadoop namenode -format

2) start all processes again:bin/start-all.sh

For Perm fix: -

1) go to /conf/core-site.xml change fs.default.name to your custom one.

2) format the namenode: bin/hadoop namenode -format

3) start all processes again:bin/start-all.sh

栩栩如生 2024-12-21 20:02:42

面临同样的问题。

(1) 在配置 .xml 文件时经常检查是否有输入错误,特别是 xml 标签。

(2) 进入bin目录。并输入 ./start-all.sh

(3) 然后输入 jps ,检查进程是否正常工作

Faced the same problem.

(1) Always check for the typing mistakes in the configuring the .xml files, especially the xml tags.

(2) go to bin dir. and type ./start-all.sh

(3) then type jps , to check if processes are working

山川志 2024-12-21 20:02:42

在 core-site.xml 中添加 hadoop.tmp.dir 属性

<configuration>
  <property>
    <name>fs.defaultFS</name>
    <value>hdfs://localhost:9000</value>
  </property>
  <property>
    <name>hadoop.tmp.dir</name>
    <value>/home/yourname/hadoop/tmp/hadoop-${user.name}</value>
  </property>
</configuration>

并格式化 hdfs (hadoop 2.7.1):

$ hdfs namenode -format

core-default.xml 是 /tmp/hadoop-${user.name},这将是重启后删除。

Add hadoop.tmp.dir property in core-site.xml

<configuration>
  <property>
    <name>fs.defaultFS</name>
    <value>hdfs://localhost:9000</value>
  </property>
  <property>
    <name>hadoop.tmp.dir</name>
    <value>/home/yourname/hadoop/tmp/hadoop-${user.name}</value>
  </property>
</configuration>

and format hdfs (hadoop 2.7.1):

$ hdfs namenode -format

The default value in core-default.xml is /tmp/hadoop-${user.name}, which will be deleted after reboot.

若沐 2024-12-21 20:02:42

试试这个,

1) 停止所有 hadoop 进程:stop-all.sh

2) 手动删除 tmp 文件夹

3) 格式化 namenode:hadoop namenode -format

4) 启动所有进程: start-all.sh

Try this,

1) Stop all hadoop processes : stop-all.sh

2) Remove the tmp folder manually

3) Format namenode : hadoop namenode -format

4) Start all processes : start-all.sh

烟─花易冷 2024-12-21 20:02:42

对我来说,更改名称节点的目录后,以下内容有效
hdfs-site.xml 中的 datanode

- 在执行以下步骤之前,使用 stop-all.sh 停止所有服务,或者在我的情况下,我使用 stop- dfs.sh 停止 dfs

  1. 在新配置的目录上,对于每个节点(名称节点和数据节点),删除其中的每个文件夹/文件(在我的例子中是“当前”目录)。
  2. 删除Hadoop临时目录:$rm -rf /tmp/haddop-$USER
  3. 格式化Namenode:hadoop/bin/hdfs namenode -format
  4. start-dfs。 sh

在我按照这些步骤操作后,我的名称节点和数据节点使用新配置的目录处于活动状态。

For me the following worked after I changed the directory of the namenode
and datanode in hdfs-site.xml

-- before executing the following steps stop all services with stop-all.sh or in my case I used the stop-dfs.sh to stop the dfs

  1. On the new configured directory, for every node (namenode and datanode), delete every folder/files inside it (in my case a 'current' directory).
  2. delete the Hadoop temporary directory: $rm -rf /tmp/haddop-$USER
  3. format the Namenode: hadoop/bin/hdfs namenode -format
  4. start-dfs.sh

After I followed those steps my namenode and datanodes were alive using the new configured directory.

若言繁花未落 2024-12-21 20:02:42

我运行 $hadoop namenode 在前台手动启动 namenode。

从日志中我发现 50070 已被占用,默认由 dfs.namenode.http-address 使用。在 hdfs-site.xml 中配置 dfs.namenode.http-address 后,一切顺利。

I ran $hadoop namenode to start namenode manually at foreground.

From the logs I figured out that 50070 is ocuupied, which was defaultly used by dfs.namenode.http-address. After configuring dfs.namenode.http-address in hdfs-site.xml, everything went well.

不回头走下去 2024-12-21 20:02:42
I got the solution just share with you that will work who got the errors:

1. First check the /home/hadoop/etc/hadoop path, hdfs-site.xml and

 check the path of namenode and datanode 

<property>
  <name>dfs.name.dir</name>
    <value>file:///home/hadoop/hadoopdata/hdfs/namenode</value>
</property>

<property>
  <name>dfs.data.dir</name>
    <value>file:///home/hadoop/hadoopdata/hdfs/datanode</value>
</property>

2.Check the permission,group and user of namenode and datanode of the particular path(/home/hadoop/hadoopdata/hdfs/datanode), and check if there are any problems in all of them and if there are any mismatch then correct it. ex .chown -R hadoop:hadoop in_use.lock, change user and group

chmod -R 755 <file_name> for change the permission
I got the solution just share with you that will work who got the errors:

1. First check the /home/hadoop/etc/hadoop path, hdfs-site.xml and

 check the path of namenode and datanode 

<property>
  <name>dfs.name.dir</name>
    <value>file:///home/hadoop/hadoopdata/hdfs/namenode</value>
</property>

<property>
  <name>dfs.data.dir</name>
    <value>file:///home/hadoop/hadoopdata/hdfs/datanode</value>
</property>

2.Check the permission,group and user of namenode and datanode of the particular path(/home/hadoop/hadoopdata/hdfs/datanode), and check if there are any problems in all of them and if there are any mismatch then correct it. ex .chown -R hadoop:hadoop in_use.lock, change user and group

chmod -R 755 <file_name> for change the permission
可可 2024-12-21 20:02:42

删除资源管理器的数据文件夹后,问题就消失了。
即使你格式化也无法解决这个问题。

After deleting a resource managers' data folder, the problem is gone.
Even if you have formatting cannot solve this problem.

苍白女子 2024-12-21 20:02:42

如果您的 namenode 陷入安全模式,您可以 ssh 到 namenode,su hdfs 用户并运行以下命令来关闭安全模式:

hdfs dfsadmin -fs hdfs://server.com:8020 -safemode leave

If your namenode is stuck in safemode you can ssh to namenode, su hdfs user and run the following command to turn off safemode:

hdfs dfsadmin -fs hdfs://server.com:8020 -safemode leave
画尸师 2024-12-21 20:02:42

您可以使用以下命令重新启动名称节点,而不是格式化名称节点。它对我有用:

sudo service hadoop-master restart

  1. hadoop dfsadmin -safemode left

Instead of formatting namenode, may be you can use the below command to restart the namenode. It worked for me:

sudo service hadoop-master restart

  1. hadoop dfsadmin -safemode leave
夜光 2024-12-21 20:02:42

我遇到了同样的问题,namenode 没有从 Hadoop-3.2.1**** 版本开始。我执行了解决该问题的步骤:

  1. 从名称节点目录中删除临时文件夹中的内容。在我的例子中,由 root 用户创建的“当前”目录: rm -rf (dir name)

  2. 格式化名称节点:hdfs namenode -format

  3. 再次启动进程:start-dfs.sh

hdfs-site.xml 文件中的第 1 点已更改。

<property>
    <name>dfs.namenode.name.dir</name>
    <value>file:///opt/hadoop/node-data/hdfs/namenode</value>
</property>

I was facing the same issue of namenode not starting with Hadoop-3.2.1**** version. I did the steps to resolve the issue:

  1. Delete the contents from temporary folder from the name node directory. In my case the "current" directory made by root user: rm -rf (dir name)

  2. Format the namenode: hdfs namenode -format

  3. start the processes again:start-dfs.sh

Point #1 has change in the hdfs-site.xml file.

<property>
    <name>dfs.namenode.name.dir</name>
    <value>file:///opt/hadoop/node-data/hdfs/namenode</value>
</property>
謌踐踏愛綪 2024-12-21 20:02:42

重新启动后我遇到了同样的事情。

对于hadoop-2.7.3,我所要做的就是格式化名称节点:

<HadoopRootDir>/bin/hdfs namenode -format

然后 jps 命令显示

6097 DataNode
755 RemoteMavenServer
5925 NameNode
6293 SecondaryNameNode
6361 Jps

I ran into the same thing after a restart.

for hadoop-2.7.3 all I had to do was format the namenode:

<HadoopRootDir>/bin/hdfs namenode -format

Then a jps command shows

6097 DataNode
755 RemoteMavenServer
5925 NameNode
6293 SecondaryNameNode
6361 Jps
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文