Installing hadoop in Windows

Source: Internet
Author: User
Tags hadoop fs

First, install cygwin. See "download and install cygwin. MHT" in the same directory, or search for the keyword "download and install cygwin. MHT" on Google ".
Then install the hadoop-0.21.0, steps are as follows:
1. Open cygwin
Go to the hadoop Folder: cd d:/hadoop under the d directory.
2. Install hadoop: tar-zvxf hadoop-0.20.1.tar.gz
3. After decompression, enter the hadoop-0.20.1 configuration directory, open the core-site.xml, add the following content. The namenode running address and port are defined here.
<Property>
<Name> fs. Default. Name </Name>
<Value> HDFS :/// localhost: 9000 </value>
</Property>
4. Open hdfs-site.xml and add the following content
<Property>
<Name> DFS. Replication </Name>
<Value> 1 </value>
</Property>

<Property>
<Name> DFS. Name. dir </Name>
<Value>/hadoop/namenode </value>
</Property>

<Property>
<Name> DFS. Data. dir </Name>
<Value>/hadoop/datanode </value>
</Property>
5. Finally modify the hadoop-env.sh, open the line commented below and set it to your JDK path.
If your Java program is under program files, enclose the entire JDK path with quotation marks. It is best to set the JDK directory to the following: D: \ Java \ jdk1.6.0 _ 26
But you can do this:
In the hadoop configuration file, the path to the Java SDK needs to be added in the hadoop-env.sh.
You know, if Java is not installed in cygwin, you can only use JDK installed in windows.
After reading the online article, I just mentioned that the path after the export needs to be enclosed in double quotation marks,
Generally, JDK is installed under "Program Files. But after I add it, it will not work,
The error "java_home is not set" or "... Program cannot found,
An error is reported when hadoop is started. After research, we know that cygwin cannot be accessed directly using a Windows path,
It must be a Linux-style directory. If you access JDK installed on drive C, you cannot use "C:/program files/Java/jdk1.6.0 _ 22 ",
However, you need to use "/cygdrive/C/program files/Java/jdk1.6.0 _ 22". Secondly, hadoop does not seem to be able to identify directory paths with spaces,
What should I do? I thought of the symbolic link. By creating a symbolic link under cygwin, I pointed to my JDK installation directory,
Run the following command: ln "C:/program files/Java/jdk1.6.0 _ 22"/usr/local/jdk1.6.0 _ 22.
In this way, a symbolic link of the JDK directory in Windows is created under/usr/local/. If you use: CD/usr/local/jdk1.6.0 _ 22,
Then, ls will find that it is already in the JDK installation directory. Then in the hadoop-env.sh export java_home =/usr/local/jdk1.6.0 _ 22,
So OK.

This is because I did not successfully install it in program files during installation. Modify to the following content:
# The JAVA Implementation to use. required.
Export java_home =/cygdrive/D/Java/jdk1.6.0 _ 26
6. Enter the bin directory under cygwin. First, you need to format namenode.
D: \ hadoop \ hadoop-0.21.0 \ bin
./Hadoop namenode-format
This error is reported here:
Java. Lang. noclassdeffounderror: ORG/Apache/hadoop/util/platformname
Caused by: Java. Lang. classnotfoundexception: org. Apache. hadoop. util. platformname

At java.net. urlclassloader $ 1.run( urlclassloader. Java: 202)
At java. Security. accesscontroller. doprivileged (native method)
At java.net. urlclassloader. findclass (urlclassloader. Java: 190)
At java. Lang. classloader. loadclass (classloader. Java: 307)
At sun. Misc. launcher $ appclassloader. loadclass (launcher. Java: 301)
At java. Lang. classloader. loadclass (classloader. Java: 248)
Cocould not find the main class: org. Apache. hadoop. util. platformname. program will exit.
The solution is as follows:
Just put $ {hadoop_home}/bin/the contents of line 190th in the hadoop-config.sh File
Java_platform = 'classpath =$ {classpath }$ {Java}-xmx32m $ {hadoop_java_platform_opts} Org. apache. hadoop. util. platformname | sed-e "S // _/g "'

Change
Java_platform = 'classpath =$ {classpath }$ {Java}-xmx32m-classpath $ {hadoop_common_home}/hadoop-common-0.21.0.jar Org. apache. hadoop. util. platformname | sed-e "S // _/g "'

7. Start namenode:./hadoop namenode
8. Start datanode:./hadoop datanode
9. Try to upload the file:./hadoop FS-Put d:/download/test.rar/TT/vm.rar
Then list
./Hadoop FS-LSR/TT
The result is as follows:
-RW-r -- 1 administrator supergroup 20793970 2010-01-18 :52/TT/vm.rar
It can be in a local file (remember this configuration/hadoop/datanode? Data File storage location)
D: \ hadoop \ datanode \ current \ finalized. The copied file is displayed, but the file name is blk_6098336667462040. You can check the file size...
10. conclusion. I wish you all success.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.