说明:这里我们以本地模式和伪分布模式伪列,为大家介绍如何搭建Hadoop环境。有了这个基础,大家可以自行搭建Hadoop的全分布模式。
需要使用的安装介质:
?
class="命令脚本" name="code">systemctl stop firewalld.service systemctl disable firewalld.service
?
bigdata111 192.168.157.111
?
ssh-keygen -t rsa ssh-copy-id -i .ssh/id_rsa.pub root@bigdata111
?
?
tar -zxvf jdk-8u181-linux-x64.tar.gz -C /root/training/
vi /root/.bash_profile
JAVA_HOME=/root/training/jdk1.8.0_181 export JAVA_HOME PATH=$JAVA_HOME/bin:$PATH export PATH
?
source /root/.bash_profile
?
?
tar -zxvf hadoop-2.7.3.tar.gz -C ~/training/
HADOOP_HOME=/root/training/hadoop-2.7.3 export HADOOP_HOME PATH=$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$PATH export PATH
?
source ~/.bash_profile
?
export JAVA_HOME=/root/training/jdk1.8.0_181
?
?
hadoop jar hadoop-mapreduce-examples-2.7.3.jar wordcount /root/temp /root/output/wc
?
?
?
?
mkdir /root/training/hadoop-2.7.3/tmp
?
cd /root/training/hadoop-2.7.3/etc/hadoop
?
<property> <name>dfs.replication</name> <value>1</value> </property>
?
?
<!--配置NameNode的地址--> <!--9000是RPC通信的端口--> <property> <name>fs.defaultFS</name> <value>hdfs://bigdata111:9000</value> </property> <!--HDFS对应的操作系统目录--> <!--默认值是Linux的tmp目录--> <property> <name>hadoop.tmp.dir</name> <value>/root/training/hadoop-2.7.3/tmp</value> </property>
?
?
<property> <name>mapreduce.framework.name</name> <value>yarn</value> </property>
?
?
<!--配置ResourceManager的地址--> <property> <name>yarn.resourcemanager.hostname</name> <value>bigdata111</value> </property> <!--MapReduce运行的方式是洗牌--> <property> <name>yarn.nodemanager.aux-services</name> <value>mapreduce_shuffle</value> </property>
?
?
hdfs namenode -format
?
start-all.sh
?
http://192.168.157.111:50070 http://192.168.157.111:8088
?
?
?