




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
hadoopeclipseWindowseclipseeclipse的插 plugins下需要注意的是插件版本(jar包)hadoop一致,否则EOFException异常。重启eclipse,打开windows->open->other->map/reduce可以看map/reduce开发视图。后弹出的框(Generaltab)进行参数的添加:Locationname:map/reducemastermapred-site.xml里面mapred.job.trackerUsername:core-site.xml设置一致。mapred.job.trackermapred-site.xml里面mapred.job.tracker设置一致。dfs.replicationhdfs-site.xml里面的dfs.replication一致。hadoop.tmp.dircore-site.xml里hadoop.tmp.dir设置一致。hadoop.job.ugi:并不是设置用户名与。是用户与组名,所以这里填hadoop.job.ugi和dfs.replicationProjectExplorer中DFSLocations,应该可以年看到文件系统中的结构了。但是在/hadoop/mapred/system下却没有查看权限,如下图:的)进行hadoop系统操作,没有权限。此时再打开“Advancedparameters”设置面板,应该可以看到hadoop.job.ugi了,这了,将hadoop加在第一个,并用逗号分隔。如:OK。hadoophadoop安装包下面的所有jar包都导到eclipse文件内容读为字符串,将字符串写入文件。同时有个main函数,可以修改测试:packagepackageimportjava.io.IOException;importjava.io.InputStream;importimportorg.apache.hadoop.conf.Configuration;importorg.apache.hadoop.fs.FileSystem;import*Theutilitiestooperatefileonhadoop*@authorluolihui2011-07-publicclassDFSOperatorprivatestaticfinalStringROOT_PATH="hdfs:///";privatestaticfinalintBUFFER_SIZE=4096;*publicCreateafileonhdfs.Therootpathis thefilenameto@paramoverwriteifafilewiththisnamealreadyexists,theniftrue,thefilewill@returntrueifdeleteissuccessfulelsepublicstaticbooleancreateFile(Stringpath,booleanoverwrite)throws{//Stringuri=Configurationconf=newConfiguration();FileSystemfs=FileSystem.get(conf);Pathf=newPath(ROOT_PATH+path);fs.create(f,overwrite);returntrue;}Deleteafileonhdfs.Therootpathis/.@parampaththepathto@paramrecursive ifpathisadirectoryandsettotrue,thedirectoryisdeletedelsethrowsanexception.Incaseofafiletherecursivecanbesettoeithertrueorfalse.@returntrueifdeleteissuccessfulelsepublicstaticbooleandeleteFile(Stringpath,booleanrecursive)throws{//Stringuri=Configurationconf=newConfiguration();FileSystemfs=FileSystem.get(conf);Pathf=newPath(ROOT_PATH+path);fs.delete(f,recursive);returntrue;}Readafiletostringonhadoophdfs.Fromstreamtostring. @parampaththepathto@returntrueifreadissuccessfulelse{Configurationconf=newConfiguration();FileSystemfs=FileSystem.get(conf);InputStreamin=null;Stringstr=null;StringBuildersb=newStringBuilder(BUFFER_SIZE);if(fs.exists(f)){in=while((str=bf.readLine())!={}return}{return}}Writestringtoahadoophdfsfile.forexample:DFSOperator.writeStringToDFSFile("/lory/test1.txt","Youarea@parampaththefilewherethestringtowrite@paramstringthecontexttowriteina@returntrueifwriteissuccessfulelse{Configurationconf=newConfiguration();FileSystemfs=FileSystem.get(conf);FSDataOutputStreamos=null;Pathf=newPath(ROOT_PATH+path);os=fs.create(f,true);returntrue;}publicstaticvoidmain(String[]{try }}catch(IOExceptione)//TODOAuto-generatedcatchblock}}}RunAs→RunonHadoop→Chooseanexitsingserverfromthelist11/07/1611/07/1618:44:32WARNconf.Configuration:DEPRECATED:hadoop-site.xmlfoundintheclasspath.Usageofhadoop-site.xmlisdeprecated.Insteadusecore-site.xml,mapred-site.xmlandhdfs-site.xmltooverridepropertiesofcore-default.xml,mapred-default.xmlandhdfs-default.xmlYouareabadman.参数,然后同样“Runonhadoop每“Runonhadoopworkspace\.metadata\.plugins\org.apache.hadoop.eclipse下生成临时jarRunonhadoop,以后只需要点击那运行的绿色按钮了。eclipseDFSNameNode在安全模式中,其解决方案也一并给出。类似的运行hadoop程序时,有时候会报以下错误:Namenodeisinsafebin/hadoopdfsadmin-safemodedfsadmin-safemodevaluevalueenter-leave-NameNode离开安全模式get-返回安全模式是否开启的信息wait-等待,一直到安全模式结束。开发错Permissionorg.apache.hadoop.security.AccessControlException:Permissiondenied:user=Administrator,access=WRITE,atsun.reflect.NativeConstructorAccessorImpl.newInstance0(Nativeatatorg.apache.hadoop.fs.FileSystem.create(FileSystem.java:484)atorg.apache.hadoop.fs.FileSystem.create(FileSystem.java:465)atorg.apache.hadoop.fs.FileSystem.create(FileSystem.java:372)atcom.kingdee.hadoop.DFSOperato
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 亭湖中考模拟考试题目及答案
- 田径2期末考试题及答案
- 数字化渲染与建筑设计表达-洞察及研究
- 2025年公职人员考试时事政治考试题库(附答案)
- 高中学校巡课工作方案
- 虚拟模块仓库管理办法
- qc质量改善管理办法
- 中国铁塔工程管理办法
- 上海工程招标管理办法
- 人身险代理人管理办法
- 2023-2025年中考语文试题分类汇编:记叙文阅读(辽宁专用)解析版
- 2025年公路检测工程师《水运结构与地基》试题及答案
- 2025年教科版新教材科学三年级上册全册教案设计(含教学计划)
- 从+“心”+出发遇见更好的自己-开学第一课暨心理健康教育主题班会-2025-2026学年高中主题班会
- 隔爆水棚替换自动隔爆装置方案及安全技术措施
- 2025年苏教版新教材数学二年级上册教学计划(含进度表)
- 叙事医学培训课件
- 催产素引产术的护理PPT课件
- 2022年会计师事务所预算管理制度
- 车辆使用完全手册
- 林地恢复施工组织设计方案
评论
0/150
提交评论