could only be replicated to 0 nodes, instead of 1
今天在初始化DFS的遇到这样的问题:
[Jack@win bin]$ ./hadoop namenode -format
13/06/20 02:25:49 INFO namenode.NameNode: STARTUP_MSG:
/************************************************************
STARTUP_MSG: Starting NameNode
STARTUP_MSG: host = win.cn.ibm.com/9.115.13.217
STARTUP_MSG: args = [-format]
STARTUP_MSG: version = 1.0.3
STARTUP_MSG: build = https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1.0 -r 1335192; compiled by 'hortonfo' on Tue May 8 20:31:25 UTC 2012
************************************************************/
13/06/20 02:25:49 INFO util.GSet: VM type = 32-bit
13/06/20 02:25:49 INFO util.GSet: 2% max memory = 17.77875 MB
13/06/20 02:25:49 INFO util.GSet: capacity = 2^22 = 4194304 entries
13/06/20 02:25:49 INFO util.GSet: recommended=4194304, actual=4194304
13/06/20 02:25:49 INFO namenode.FSNamesystem: fsOwner=Jack
13/06/20 02:25:49 INFO namenode.FSNamesystem: supergroup=supergroup
13/06/20 02:25:49 INFO namenode.FSNamesystem: isPermissionEnabled=true
13/06/20 02:25:49 INFO namenode.FSNamesystem: dfs.block.invalidate.limit=100
13/06/20 02:25:49 INFO namenode.FSNamesystem: isAccessTokenEnabled=false accessKeyUpdateInterval=0 min(s), accessTokenLifetime=0 min(s)
13/06/20 02:25:49 INFO namenode.NameNode: Caching file names occuring more than 10 times
13/06/20 02:25:49 INFO common.Storage: Image file of size 110 saved in 0 seconds.
13/06/20 02:25:49 INFO common.Storage: Storage directory /home/Jack/dfs/dfs/name has been successfully formatted.
13/06/20 02:25:49 INFO namenode.NameNode: SHUTDOWN_MSG:
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at win.cn.ibm.com/9.115.13.217
************************************************************/
其返回的结果并不是像这样正常。
之后我开始进行文件上传测试,上传时报错:
org.apache.hadoop.ipc.RemoteException: java.io.IOException: File /user/Jack/input/file01 could only be replicated to 0 nodes, instead of 1
这个说没有可用的nodes。在开始格式化前我并没有进行core-site.xml文件的配置。
怀疑是这样导致的问题,于是进行了DFS文件路径的配置:
<?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://localhost:9000</value> </property> <property> <name>hadoop.tmp.dir</name> <value>/home/Jack/dfs</value> </property> </configuration>
之后重新进行FDS文件格式化。> ./hadoop namenode -format ----> 成功。
上传文件正常!