Hadoop2.2 environment configuration and hadoop2.2 Configuration

Source: Internet
Author: User

Hadoop2.2 environment configuration and hadoop2.2 Configuration

Scenario: Host mac pro, installed with two virtual machines, both of which are Ubuntu Systems

Configure jdk in ubuntu

1. Download from Sun's official website

http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

2. decompress the downloaded file

lixiaojiao@ubuntu:~/software$ tar -zxvf jdk-7u79-linux-x64.tar.gz

3. Configure java environment variables

lixiaojiao@ubuntu:~/software$ vi ~/.bashrc 

 

Jump to the end of the file

Add

export JAVA_HOME=/home/lixiaojiao/software/jdk1.7.0_79export CLASS_PATH=.:$CLASS_PATH:$JAVA_HOME/libexport PATH=.:$PATH:$JAVA_HOME/bin

Save and exit

4. The configuration does not take effect immediately. Use the following command to take effect.

lixiaojiao@ubuntu:~/software$ source ~/.bashrc

 

5. verify whether the configuration is successful.

lixiaojiao@ubuntu:~/software$ java -version

 

Configure the hadoop2.6.1 environment on the mac machine (configured before the java environment)

1. decompress the hadoop download file

lixiaojiaodeMacBook-Pro:zipFiles lixiaojiao$ tar -zxvf hadoop-2.6.1.tar.gz 

2. I put cloud computing-related data into the directory cloudcomputing to view the directory structure.

3. Set ssh remote Logon

lixiaojiaodeMacBook-Pro:sbin lixiaojiao$ ssh-keygen -t rsa -P ""

Run the following command:

lixiaojiaodeMacBook-Pro:sbin lixiaojiao$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

Verify whether it is successful

lixiaojiaodeMacBook-Pro:sbin lixiaojiao$ ssh localhost

Appears, failed ..

The reason is that the system's ssh remote login is not enabled

First, choose System Preference Settings> share> remote logon to enable remote logon.

Execute the command again

lixiaojiaodeMacBook-Pro:sbin lixiaojiao$ ssh localhost

Proof of success

3. Switch to the etc directory to view the configuration file

lixiaojiaodeMacBook-Pro:cloudcomputing lixiaojiao$ cd hadoop-2.6.1/etc/hadoop/

4. modify the configuration file

Switch to/Users/lixiaojiao/software/cloudcomputing/hadoop-2.6.1/etc/hadoop directory

(1) Configure core-site.xml

lixiaojiaodeMacBook-Pro:hadoop lixiaojiao$ vi core-site.xml 

Add

<Configuration>

</Configuration> Add the following configuration in the middle

<property>    <name>fs.default.name</name>    <value>hdfs://localhost:9000</value></property>

(2) Configure yarn-site.xml

Add the following configuration

<property>                <name>yarn.noCHdemanager.aux-services</name>                <value>mapreduce_shuffle</value></property><property>                <name>yarn.nodemanager.aux-services.mapreduce.shuffle.class</name>                <value>org.apache.hadoop.mapred.ShuffleHandler</value></property>

(3) create and configure the mapred-site.xml, copy the mapred-site.xml.template in the directory to the mapred-site.xml and add the configuration as follows

<property>                <name>mapreduce.framework.name</name>                <value>yarn</value></property>

(4) Configure hdfs-site.xml, first in

/Users/lixiaojiao/software/cloudcomputing/new directory in hadoop-2.6.1/, hdfs/data and hdfs/name, and add the following configuration

<property>                <name>dfs.replication</name>                <value>1</value></property><property>                <name>dfs.namenode.name.dir</name>                <value>file:/Users/lixiaojiao/software/cloudcomputing/hadoop-2.6.1/hdfs/name</value></property><property>                <name>dfs.datanode.data.dir</name>                <value>file:/Users/lixiaojiao/software/cloudcomputing/hadoop-2.6.1/hdfs/data</value></property>

(5) format hdfs

lixiaojiaodeMacBook-Pro:bin lixiaojiao$ ./hdfs namenode -format

Appears

(6) Start hadoop

Switch to the sbin directory

lixiaojiaodeMacBook-Pro:bin lixiaojiao$ cd ../sbin/

Run

lixiaojiaodeMacBook-Pro:sbin lixiaojiao$ ./start-dfs.sh 

Run

lixiaojiaodeMacBook-Pro:sbin lixiaojiao$ ./start-yarn.sh 

Open http: // localhost: 50070/in the browser. The hdfs Management page is displayed.

Open http: // localhost: 8088/in the browser. The hadoop Process Management page is displayed.

Run in Part 6

lixiaojiaodeMacBook-Pro:sbin lixiaojiao$ ./start-dfs.sh 

The following prompt appears:

computing/hadoop-2.6.1/logs/hadoop-lixiaojiao-secondarynamenode-lixiaojiaodeMacBook-Pro.local.out2015-10-18 10:08:43.887 java[1871:37357] Unable to load realm info from SCDynamicStore15/10/18 10:08:43 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicablelixiaojiaodeMacBook-Pro:sbin lixiaojiao$ 

The reason is in the official lib directory. the so file is compiled in a 32-bit system. If your mac machine is a 64-bit system, you need to download the source code and recompile it on 64-bit, since I tried to download the source code for a long time and failed, I finally gave up. I downloaded the 64-bit package program compiled by Niu Ren.

lixiaojiaodeMacBook-Pro:sbin lixiaojiao$ ./start-all.sh 

When the preceding command is re-executed, the following problem occurs:

lixiaojiaodeMacBook-Pro:sbin lixiaojiao$ ./start-all.sh This script is Deprecated. Instead use start-dfs.sh and start-yarn.sh2015-10-19 21:18:29.414 java[5782:72819] Unable to load realm info from SCDynamicStore

The practice of the online cool man still does not work. In the end, only the jdk is changed and the jdk is re-installed.

#export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Homeexport JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/

Verify whether it is successful

Create input directory

lixiaojiaodeMacBook-Pro:hadoop-2.2.0 lixiaojiao$ hadoop fs -mkdir -p input

Upload local files to the hdfs File System

lixiaojiaodeMacBook-Pro:cloudcomputing lixiaojiao$ hadoop fs -copyFromLocal README.txt input

The following new problem occurs:

 

Change the IP address in fs. default. name To 127.0.0.1.

Switch to the share/hadoop/mapreduce directory and execute the following statement:

 hadoop jar hadoop-mapreduce-examples-2.2.0.jar wordcount input output

Run the following command to check whether the output directory is generated.

 hadoop fs -ls

Run the following command to view the specific result:

 hadoop fs -cat

 

Therefore, in order to directly copy the configured hadoop file to other Ubuntu systems and directly use the scp command, you need to enable ssh in Ubuntu.

lixiaojiaodeMacBook-Pro:cloudcomputing lixiaojiao$ scp -r hadoop-2.2.0 lixiaojiao@192.168.31.126:/home/lixiaojiao/software
lixiaojiaodeMacBook-Pro:cloudcomputing lixiaojiao$ scp -r hadoop-2.2.0 lixiaojiao@192.168.31.218:/home/lixiaojiao/software

Then, run the wordcount program on it to verify whether it is successful.

 

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.