新人再次求教,hdfs无法cdh hdfs 格式化化

查看: 2677|回复: 3
HDFS格式化完成后,不能访问,请高手赐教。
论坛徽章:1
/06/05 23:15:18 INFO common.Storage: Image file of size 96 saved in 0 seconds.
13/06/05 23:15:18 INFO common.Storage: Storage directory /home/hadoop/name/name1&&has been successfully formatted.
下面为配置信息:
[hadoop@localhost conf]$ more 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&fs.default.name&/name&
& && &&&&value&http://localhost:9000&/value&
&&&/property&
&/configuration&
[hadoop@localhost conf]$ cat 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&1&/value&
&/property&
&property&
& & &name&dfs.data.dir&/name&
& & &value&/home/hadoop/date/date1&/value&
&/property&
&property&
& & &name&dfs.name.dir&/name&
& & &value&/home/hadoop/name/name1&/value&
&/property&
&/configuration&
[hadoop@localhost conf]$ cat mapred-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&mapred.job.tracker&/name&
& & &value&localhost:9001&/value&
&&&/property&
&&&property&
& & &name&mapred.tasktracker.map.tasks.maximum&/name&
& & &value&8&/value&
&&&/property&
&&&property&
& & &name&mapred.tasktracker.reduce.tasks.maximum&/name&
& & &value&6&/value&
&&&/property&
&/configuration&
使用hadoop fs -ls / 提示信息如下:
[hadoop@localhost date]$ hadoop fs -ls /
Bad connection to FS. command aborted.
论坛徽章:1
本帖最后由 xiaotianle2 于
15:11 编辑
进程都启动了,怎还是反问不了。
hadoop fs version
[root@localhost software]# $JAVA_HOME/bin/jps
9862 NameNode
10126 JobTracker
10216 TaskTracker
9964 DataNode
论坛徽章:1
fs.default.name这里是hdfs://
而不是http:
&property&
& && &&&&name&fs.default.name&/name&
& && &&&&value&http://localhost:9000&/value&
&&&/property&
论坛徽章:1
wxxiaoyang 发表于
fs.default.name这里是hdfs://
而不是http:
多谢!搞定了
itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有    
 北京市公安局海淀分局网监中心备案编号:10 广播电视节目制作经营许可证:编号(京)字第1149号在对HDFS格式化,执行hadoop namenode -format命令时 -
- ITeye博客
博客分类:
在对HDFS格式化,执行hadoop namenode -format命令时,出现未知的主机名的问题,异常信息如下所示:
[shirdrn@localhost bin]$ hadoop namenode -format11/06/22 07:33:31 INFO namenode.NameNode: STARTUP_MSG: /************************************************************STARTUP_MSG: Starting NameNodeSTARTUP_MSG:
host = java.net.UnknownHostException: localhost.localdomain: localhost.localdomainSTARTUP_MSG:
args = [-format]STARTUP_MSG:
version = 0.20.0STARTUP_MSG:
-r 763504; compiled by 'ndaley' on Thu Apr
9 05:18:40 UTC 2009************************************************************/Re-format filesystem in /tmp/hadoop/hadoop-shirdrn/dfs/name ? (Y or N) Y11/06/22 07:33:36 INFO namenode.FSNamesystem: fsOwner=shirdrn,shirdrn11/06/22 07:33:36 INFO namenode.FSNamesystem: supergroup=supergroup11/06/22 07:33:36 INFO namenode.FSNamesystem: isPermissionEnabled=true11/06/22 07:33:36 INFO metrics.MetricsUtil: Unable to obtain hostNamejava.net.UnknownHostException: localhost.localdomain: localhost.localdomain
at java.net.InetAddress.getLocalHost(InetAddress.java:1353)
at org.apache.hadoop.metrics.MetricsUtil.getHostName(MetricsUtil.java:91)
at org.apache.hadoop.metrics.MetricsUtil.createRecord(MetricsUtil.java:80)
at org.apache.hadoop.hdfs.server.namenode.FSDirectory.initialize(FSDirectory.java:73)
at org.apache.hadoop.hdfs.server.namenode.FSDirectory.&init&(FSDirectory.java:68)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.&init&(FSNamesystem.java:370)
at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:853)
at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:947)
at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:964)11/06/22 07:33:36 INFO common.Storage: Image file of size 97 saved in 0 seconds.11/06/22 07:33:36 INFO common.Storage: Storage directory /tmp/hadoop/hadoop-shirdrn/dfs/name has been successfully formatted.11/06/22 07:33:36 INFO namenode.NameNode: SHUTDOWN_MSG: /************************************************************SHUTDOWN_MSG: Shutting down NameNode at java.net.UnknownHostException: localhost.localdomain: localhost.localdomain************************************************************/
我们通过执行hostname命令可以看到:
[shirdrn@localhost bin]# hostnamelocalhost.localdomain
也就是说,Hadoop在格式化HDFS的时候,通过hostname命令获取到的主机名是localhost.localdomain,然后在/etc/hosts文件中进行映射的时候,没有找到,看下我的/etc/hosts内容:
[root@localhost bin]# cat /etc/hosts# Do not remove the following line, or various programs# that require network functionality will fail.127.0.0.1
localhost192.168.1.103
也就说,通过localhost.localdomain根本无法映射到一个IP地址,所以报错了。
此时,我们查看一下/etc/sysconfig/network文件:
NETWORKING=yesNETWORKING_IPV6=yesHOSTNAME=localhost.localdomain
可见,执行hostname获取到这里配置的HOSTNAME的值。
解决办法:
修改/etc/sysconfig/network中HOSTNAME的值为localhost,或者自己指定的主机名,保证localhost在/etc/hosts文件中映射为正确的IP地址,然后重新启动网络服务:
[root@localhost bin]# /etc/rc.d/init.d/network restartShutting down interface eth0:
]Shutting down loopback interface:
]Bringing up loopback interface:
]Bringing up interface eth0:
Determining IP information for eth0... done.[
这时,再执行格式化HDFS命令,以及启动HDFS集群就正常了:
[shirdrn@localhost bin]$ hadoop namenode -format11/06/22 08:02:37 INFO namenode.NameNode: STARTUP_MSG: /************************************************************STARTUP_MSG: Starting NameNodeSTARTUP_MSG:
host = localhost/127.0.0.1STARTUP_MSG:
args = [-format]STARTUP_MSG:
version = 0.20.0STARTUP_MSG:
-r 763504; compiled by 'ndaley' on Thu Apr
9 05:18:40 UTC 2009************************************************************/11/06/22 08:02:37 INFO namenode.FSNamesystem: fsOwner=shirdrn,shirdrn11/06/22 08:02:37 INFO namenode.FSNamesystem: supergroup=supergroup11/06/22 08:02:37 INFO namenode.FSNamesystem: isPermissionEnabled=true11/06/22 08:02:37 INFO common.Storage: Image file of size 97 saved in 0 seconds.11/06/22 08:02:37 INFO common.Storage: Storage directory /tmp/hadoop/hadoop-shirdrn/dfs/name has been successfully formatted.11/06/22 08:02:37 INFO namenode.NameNode: SHUTDOWN_MSG: /************************************************************SHUTDOWN_MSG: Shutting down NameNode at localhost/127.0.0.1************************************************************/
[shirdrn@localhost bin]$ start-all.sh starting namenode, logging to /home/shirdrn/eclipse/eclipse-3.5.2/hadoop/hadoop-0.20.0/logs/hadoop-shirdrn-namenode-localhost.outlocalhost: starting datanode, logging to /home/shirdrn/eclipse/eclipse-3.5.2/hadoop/hadoop-0.20.0/logs/hadoop-shirdrn-datanode-localhost.outlocalhost: starting secondarynamenode, logging to /home/shirdrn/eclipse/eclipse-3.5.2/hadoop/hadoop-0.20.0/logs/hadoop-shirdrn-secondarynamenode-localhost.outstarting jobtracker, logging to /home/shirdrn/eclipse/eclipse-3.5.2/hadoop/hadoop-0.20.0/logs/hadoop-shirdrn-jobtracker-localhost.outlocalhost: starting tasktracker, logging to /home/shirdrn/eclipse/eclipse-3.5.2/hadoop/hadoop-0.20.0/logs/hadoop-shirdrn-tasktracker-localhost.out
[shirdrn@localhost bin]$ jps8192 TaskTracker7905 DataNode7806 NameNode8065 JobTracker8002 SecondaryNameNode8234 Jps
浏览 40365
浏览: 263679 次
来自: 北京
很棒,在其他大神的博客上理清了思路看懂之后,来lz这里用例子学 ...
yanf4j check不下来 ?
又是抄来的 - -
为什么不说下支持的数据库呢?
表示没看懂匿名用户不能发表回复!|
每天回帖即可获得10分可用分!小技巧:
你还可以输入10000个字符
(Ctrl+Enter)
请遵守CSDN,不得违反国家法律法规。
转载文章请注明出自“CSDN(www.csdn.net)”。如是商业用途请联系原作者。1016人阅读
hadoop(14)
1,虚机每次重启后,如果不格式化namenode,就错误,日志如下:
INFO&org.apache.hadoop.hdfs.server.namenode.FSNamesystem:&Registered&FSNamesystemStateMBean&and&NameNodeMXBean&&
INFO&org.apache.hadoop.hdfs.server.namenode.NameNode:&Caching&file&names&occuring&more&than&10&times&&INFO&org.apache.hadoop.mon.Storage:&Storage&directory&/tmp/hadoop-sylar/dfs/name&does&not&exist.&ERROR&org.apache.hadoop.hdfs.server.namenode.FSNamesystem:&FSNamesystem&initialization&failed.&org.apache.hadoop.mon.InconsistentFSStateException:&Directory&/tmp/hadoop-sylar/dfs/name&is&in&an&inconsistent&state:&storage&directory&does&not&exist&or&is&not&accessible.&
2,解决方法,重新格式化:
~]$bin/hadoop namenode -format
3, 如果想彻底消除错误,并且每次重启机器不格式化,需要修改core-site.xml 和 hdfs-site.xml, 如下:
vm1:~/hadoop/conf$ cat 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&fs.default.name&/name&
&value&hdfs://192.168.1.105:9000&/value&
&/property&
&property& &
&&& &name&hadoop.tmp.dir&/name& &
&&& &value&/home/hadoop/filesystem/tmp&/value& &
&&& &description& temporary directories.&/description& &
&/property& &
&property& &
&&& &name&dfs.name.dir&/name& &
&&& &value&/home/hadoop/filesystem/name&/value& &
&&& &description&where on the local filesystem the DFS name node should store the name table&/description& &
&/property& &
&property& &
&&& &name&dfs.data.dir&/name& &
&&& &value&/home/hadoop/filesystem/data&/value& &
&&& &description&where on the local filesystem an DFS data node should store its blocks.&/description& &
&/property& &
&/configuration&
vm1:~/hadoop/conf$
~/hadoop/conf$ cat 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&1&/value&
&name&dfs.permissions&/name&
&value&false&/value&
&/property&
&/configuration&
&&相关文章推荐
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:24213次
排名:千里之外
原创:24篇
转载:10篇
(3)(2)(4)(11)(14)
(window.slotbydup = window.slotbydup || []).push({
id: '4740881',
container: s,
size: '200,200',
display: 'inlay-fix'

我要回帖

更多关于 hadoop格式化hdfs 的文章

 

随机推荐