适用于以下情形
- 想要立马开始上手hadoop
- 想要立马在docker这种虚拟环境中使用
root@hanss:wget http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz?AuthParam=1502545143_41b9e32dd218de2ae077c06f1a077026
root@hanss:sudo mkdir /usr/lib/jdk
root@hanss:mkdir /usr/lib/jdk
root@hanss:mv jdk-8u144-linux-x64.tar.gz\?AuthParam\=1502545143_41b9e32dd218de2ae077c06f1a077026 jdk-8u144-linux-x64.tar.gz
root@hanss:tar -zxvf jdk-8u144-linux-x64.tar.gz -C /usr/lib/jdk
root@hanss:vim /etc/profile
#/etc/profile
export JAVA_HOME=/usr/lib/jdk/jdk1.8.0_144
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
#
root@hanss:ls /usr/lib/jdk/
root@hanss:vim /etc/profile
root@hanss:vim ~/.bashrc
#~/.bashrc
export JAVA_HOME=/usr/lib/jdk/jdk1.8.0_144
#
root@hanss:source /etc/profile
root@hanss:source ~/.bashrc
root@hanss:wget http://apache.fayea.com/hadoop/common/hadoop-2.8.1/hadoop-2.8.1.tar.gz
root@hanss:mkdir /usr/lib/hadoop
root@hanss:tar -zxvf hadoop-2.8.1.tar.gz -C /usr/lib/hadoop/
root@hanss:vim ~/.bashrc
#~/.bashrc
export PATH=$PATH:/usr/lib/hadoop/hadoop-2.8.1/bin:/usr/lib/hadoop/hadoop-2.8.1/sbin
root@hanss:vim /etc/profile
#/etc/profile
export PATH=$PATH:/usr/lib/hadoop/hadoop-2.8.1/bin:/usr/lib/hadoop/hadoop-2.8.1/sbin
#
root@hanss:vi /etc/hostname
#/etc/hostname
master
root@hanss:vi /etc/hosts
#/etc/hosts
144.122.133.12 master
root@master$: vim core-site.xml
#core-site.xml
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://master:9000</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>file:/usr/lib/hadoop-2.8.1/tmp</value>
<description>Abase for other temporary directories.</description>
</property>
</configuration>
root@master$: vim hdfs-site.xml
#hdfs-site.xml
<configuration>
<property>
<name>dfs.namenode.secondary.http-address</name>
<value>master:50090</value>
</property>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>file:/usr/lib/hadoop-2.8.1/tmp/dfs/name</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>file:/usr/lib/hadoop-2.8.1/tmp/dfs/data</value>
</property>
</configuration>
root@master$: vim mapred-site.xml
#mapred-site.xml
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
<property>
<name>mapreduce.jobhistory.address</name>
<value>master:10020</value>
</property>
<property>
<name>mapreduce.jobhistory.webapp.address</name>
<value>master:19888</value>
</property>
</configuration>
root@master$: vim yarn-site.xml
<configuration>
#yarn-site.xml
<!-- Site specific YARN configuration properties -->
<property>
<name>yarn.resourcemanager.hostname</name>
<value>master</value>
</property>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
</configuration>
配置Java_Hadoop.sh文件: