﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-T、IS-随笔分类-Hadoop</title><link>http://www.blogjava.net/AntiquMan/category/54916.html</link><description /><language>zh-cn</language><lastBuildDate>Wed, 19 Aug 2015 06:27:56 GMT</lastBuildDate><pubDate>Wed, 19 Aug 2015 06:27:56 GMT</pubDate><ttl>60</ttl><item><title>Hadoop格式化HDFS报错java.net.UnknownHostException: localhost.localdomain: localhost.localdomain</title><link>http://www.blogjava.net/AntiquMan/archive/2015/08/19/426895.html</link><dc:creator>AntiquMan</dc:creator><author>AntiquMan</author><pubDate>Wed, 19 Aug 2015 06:24:00 GMT</pubDate><guid>http://www.blogjava.net/AntiquMan/archive/2015/08/19/426895.html</guid><wfw:comment>http://www.blogjava.net/AntiquMan/comments/426895.html</wfw:comment><comments>http://www.blogjava.net/AntiquMan/archive/2015/08/19/426895.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/AntiquMan/comments/commentRss/426895.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/AntiquMan/services/trackbacks/426895.html</trackback:ping><description><![CDATA[<span style="color: #666666; font-family: 宋体, Arial; font-size: 12px; line-height: 26px; background-color: #ffffff;">SHUTDOWN_MSG: Shutting down NameNode at java.net.UnknownHostException: datanode: datanode: unknown error</span><br style="word-wrap: break-word; color: #666666; font-family: 宋体, Arial; font-size: 12px; line-height: 26px; background-color: #ffffff;" /><br style="word-wrap: break-word; color: #666666; font-family: 宋体, Arial; font-size: 12px; line-height: 26px; background-color: #ffffff;" /><span style="word-wrap: break-word; font-family: 宋体, Arial; font-size: 12px; line-height: 26px; color: #e53333; background-color: #ffffff;">如果忽略该错误启动DFS，会发现datanode无法正常启动。</span><br style="word-wrap: break-word; color: #666666; font-family: 宋体, Arial; font-size: 12px; line-height: 26px; background-color: #ffffff;" /><br style="word-wrap: break-word; color: #666666; font-family: 宋体, Arial; font-size: 12px; line-height: 26px; background-color: #ffffff;" /><span style="color: #666666; font-family: 宋体, Arial; font-size: 12px; line-height: 26px; background-color: #ffffff;">原因：</span><br style="word-wrap: break-word; color: #666666; font-family: 宋体, Arial; font-size: 12px; line-height: 26px; background-color: #ffffff;" /><span style="color: #666666; font-family: 宋体, Arial; font-size: 12px; line-height: 26px; background-color: #ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;hadoop在格局化HDFS的时辰，经由过程hostname号令获取到的主机名在/etc/hosts文件中进行映射的时辰，没有找到，也就是名字不一样。</span><br style="word-wrap: break-word; color: #666666; font-family: 宋体, Arial; font-size: 12px; line-height: 26px; background-color: #ffffff;" /><br style="word-wrap: break-word; color: #666666; font-family: 宋体, Arial; font-size: 12px; line-height: 26px; background-color: #ffffff;" /><span style="color: #666666; font-family: 宋体, Arial; font-size: 12px; line-height: 26px; background-color: #ffffff;">即：</span><br style="word-wrap: break-word; color: #666666; font-family: 宋体, Arial; font-size: 12px; line-height: 26px; background-color: #ffffff;" /><span style="color: #666666; font-family: 宋体, Arial; font-size: 12px; line-height: 26px; background-color: #ffffff;">&nbsp; &nbsp; 配置文件slaves 填写的 主机名 &nbsp;要与 节点的主机名一致(节点机上hostname查看)</span><br style="word-wrap: break-word; color: #666666; font-family: 宋体, Arial; font-size: 12px; line-height: 26px; background-color: #ffffff;" /><br style="word-wrap: break-word; color: #666666; font-family: 宋体, Arial; font-size: 12px; line-height: 26px; background-color: #ffffff;" /><span style="color: #666666; font-family: 宋体, Arial; font-size: 12px; line-height: 26px; background-color: #ffffff;">查看本身用户的主机名：hostname</span><br style="word-wrap: break-word; color: #666666; font-family: 宋体, Arial; font-size: 12px; line-height: 26px; background-color: #ffffff;" /><br style="word-wrap: break-word; color: #666666; font-family: 宋体, Arial; font-size: 12px; line-height: 26px; background-color: #ffffff;" /><span style="color: #666666; font-family: 宋体, Arial; font-size: 12px; line-height: 26px; background-color: #ffffff;">查看/etc/hosts内容：cat /etc/hosts</span><br style="word-wrap: break-word; color: #666666; font-family: 宋体, Arial; font-size: 12px; line-height: 26px; background-color: #ffffff;" /><br style="word-wrap: break-word; color: #666666; font-family: 宋体, Arial; font-size: 12px; line-height: 26px; background-color: #ffffff;" /><span style="color: #666666; font-family: 宋体, Arial; font-size: 12px; line-height: 26px; background-color: #ffffff;">hosts文件 里面我们自己随意起的主机名字是不可以的，必须与 节点主机hostname一致。</span><br style="word-wrap: break-word; color: #666666; font-family: 宋体, Arial; font-size: 12px; line-height: 26px; background-color: #ffffff;" /><br style="word-wrap: break-word; color: #666666; font-family: 宋体, Arial; font-size: 12px; line-height: 26px; background-color: #ffffff;" /><span style="color: #666666; font-family: 宋体, Arial; font-size: 12px; line-height: 26px; background-color: #ffffff;">结论：</span><br style="word-wrap: break-word; color: #666666; font-family: 宋体, Arial; font-size: 12px; line-height: 26px; background-color: #ffffff;" /><span style="color: #666666; font-family: 宋体, Arial; font-size: 12px; line-height: 26px; background-color: #ffffff;">节点主机： hostname &nbsp;、 &nbsp; &nbsp;个主机中的/etc/hosts 下的hostname &nbsp; 、 &nbsp;配置文件slaves 中的hostname &nbsp;必须完全一致。<br /><br /></span><h3 style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">解决方法</h3><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;"><br /></p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">修改/etc/sysconfig/network中HOSTNAME的值为localhost，或者自己指定的主机名，保证localhost在/etc/hosts文件中映射为正确的IP地址，然后重新启动网络服务.</p><span style="font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">/etc/rc.d/init.d/network&nbsp;restart&nbsp;</span><img src ="http://www.blogjava.net/AntiquMan/aggbug/426895.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/AntiquMan/" target="_blank">AntiquMan</a> 2015-08-19 14:24 <a href="http://www.blogjava.net/AntiquMan/archive/2015/08/19/426895.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>