目录
修改配置
当我们用Idea直接启动Hadoop NameNode是启动不了的,我们需要修改一些东西才能通过Idea的编译,要不然是会报错的。
然后修改配置:
1.core-site.xml 修改ip为local host.
2.hdfs-site.xml 修改ip为local host.
3.hdfs-default.xml增加配置.
4.拷贝webapps到resouces目录下面.
常见的错误1
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.HadoopIllegalArgumentException
编辑pom.xml,不然会报上面的错误
启动
Idea启动Hadoop NameNode的入口函数是
org.apache.hadoop.hdfs.server.namenode.NameNode
第一次启动
启动输出
Formatting using clusterid: CID-99331b63-93af-424a-b7b2-37f02125a014
第二次启动去掉 -format则可
常见问题2
20/01 09:23:29 DEBUG util.NativeCodeLoader: Trying to load the custom-built native-hadoop library...
20/01 09:23:29 DEBUG util.NativeCodeLoader: Failed to load native-hadoop with error: java.lang.UnsatisfiedLinkError: no hadoop in java.library.path
20/01 09:23:29 DEBUG util.NativeCodeLoader: java.library.path=D:\Program Files\Java\jdk1.8.0_31\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;D:\Program Files\Python36;D:\Program Files\Java\jdk1.8.0_31\bin;D:\Program Files\Java\jdk1.8.0_31\jre1.8.0_31\bin;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;D:\Android\SDK\platform-tools;D:\Android\SDK\ndk-bundle;D:\Program Files (x86)\mysql\bin;D:\Program Files\sqlplus;D:\Program Files\apache-maven-3.3.9\bin;D:\Program Files\CMake\bin;HADOOP_HOME\bin;D:\Program Files\Git\bin;D:\Program Files\Anaconda3;D:\home\scala-2.11.8\bin;D:\Program Files\sbt/bin;D:\Program Files\Android\gradle-5.0\bin;D:\Program Files\nodejs;D:\Program Files\nodejs\npm_modules;D:\Program Files\protoc-2.5.0-win32;D:\Program Files\go\bin;D:\Program Files\go\bin;D:\Program Files\nodejs\;D:\Program Files\findbugs-1.3.9\bin;D:\Program Files\zlib128-dll;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;D:\home\ant\bin;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;D:\Program Files (x86)\Canon\Easy-WebPrint EX\bin;C:\Users\Zhu.Ketao\AppData\Local\Microsoft\WindowsApps;C:\Users\Zhu.Ketao\go\bin;C:\Users\Zhu.Ketao\AppData\Local\BypassRuntm;C:\Users\Zhu.Ketao\AppData\Roaming\npm;.
20/01 09:23:29 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
20/01 09:23:29 INFO util.ExitUtil: Exiting with status 1
解决:
将hadoop-2.7.0-src\hadoop-common-project\hadoop-common\target\bin\hadoop.dll放入C:\Windows\System32目录下即可
Ok,到此就可以正常启动开始你的源码之旅了。