Our goal is to build a Hadoop development environment that can be used everywhere.
Create a MAVEN project
Create a MAVEN project, what type of project to introduce Hadoop dependencies to your own needs, in Pom.xml.
Introducing a Hadoop configuration file
Copy the Hadoop configuration file into the Src/main/resources file, only the useful on the line, Core-site.xml,hdfs-site.xml,mapred-site.xml,yarn-site.xml and so on.
Setting environment variables
The configuration files in the Hadoop configuration folder can be divided into two categories: XML (. properties), a type of. SH (. cmd), XML-typed files introduced by the top way, and. SH type files are mainly set environment variables, cannot be introduced, if you use the environment variable, Then this setting:
When you run the Main method, select Run configuration and set the required environment variables in environment.
There is an environment variable that must be set: Hadoop_user_name=hdfs
See the following links for reasons:
Http://www.linuxidc.com/Linux/2014-08/105335.htm
This way, when you get the congratulation object in the program, just use the following code:
ConfigurationnewConfiguration();
Eclipse+maven Build Hadoop Local development environment