摘要: hadoop可以创建自己的归档文件 即har文件(hadoop archive file)。下面的一个shell命令展示如何创建归档文件:$ hadoop archive -archiveName geoway_portal.har /user/Administrator/geoway_portal/(对这个目录下的文件进行归档) /tmp/(要保存的位置)12/11/07 22:04:28 INFO mapred.JobClient: Running job: job_201211070851_000112/11/07 22:04:29 INFO mapred.JobClient: map. 阅读全文
posted @ 2012-11-07 22:25 李克华 阅读(1047) 评论(0) 推荐(0)
摘要: //将本地文件上传到hdfs。String target="hdfs://localhost:9000/user/Administrator/geoway_portal/tes2.dmp";FileInputStream fis=new FileInputStream(new File("C:\\tes2.dmp"));//读取本地文件Configuration config=new Configuration();FileSystem fs=FileSystem.get(URI.create(target), config);OutputStream 阅读全文
posted @ 2012-11-07 21:57 李克华 阅读(15284) 评论(0) 推荐(0)
摘要: 使用HDFS java api 下载文件到本地的代码如下: String file="hdfs://localhost:9000/user/Administrator/fooo/j-spatial.zip";//hdfs文件 地址Configuration config=new Configuration();FileSystem fs=FileSystem.get(URI.create(file),config);//构建FileSystemInputStream is=fs.open(new Path(file));//读取文件IOUtils.copyBytes(is, 阅读全文
posted @ 2012-11-07 21:43 李克华 阅读(10922) 评论(0) 推荐(0)
摘要: 我机子上的hadoop安装有一阶段了,由于前几天发现机子上垃圾太多,自己给清理了一下,一不小心不知道清除了什么,导致我的hadoop无法正常启动了。每次执行start-all.sh都会报错,而且还让我重新输入密码。今天早上过来,我又试试,输入SSH localhost命令(纯属凑巧),发现让我输入密码。我当时就想,这个玩意儿在安装hadoop环境的时候不是已经安装过吗?而且还是防止以后重复输入密码的方式。于是我又重新执行了一遍:ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa 。估计问题是找到了。试了下start-all.sh,ok一切都正常!A 阅读全文
posted @ 2012-11-07 09:12 李克华 阅读(601) 评论(0) 推荐(0)