Hadoop 在单节点上以伪分布式模式运行,其中每个 Hadoop 守护进程在单独的 Java 进程中运行。
部署过程:
vim /etc/hosts
在最末尾添加
192.168.0.9 master
tar -xvzf hadoop-3.2.2.tar.gz
tar -xvzf jdk-8u202-linux-x64.tar.gz
vim /etc/profile
export JAVA_HOME=/usr/local/jdk1.8.0_202
export CLASSPATH=$:CLASSPATH:$JAVA_HOME/lib/
PATH=$PATH:$JAVA_HOME/bin
export HADOOP_HOME=/usr/local/hadoop
PATH=$PATH:$HADOOP_HOME/bin
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native
export HADOOP_OPTS="-Djava.library.path=$HADOOP_HOME/lib"
ssh-copy-id
连续按三次回车键就可以
ssh-copy-id master
中间过程需要输入yes,之后输入root密码
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://master:9000</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/usr/local/hadoop/data/tmp</value>
</property>
</configuration>
<configuration>
<property>
<name>dfs.namenode.name.dir</name>
<value>/usr/local/hadoop/data/namenode</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>/usr/local/hadoop/data/datanode</value>
</property>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.permissions</name>
<value>false</value>
<description>need not permissions</description>
</property>
</configuration>
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration>
<configuration>
<property>
<name>yarn.resourcemanager.hostname</name>
<value>master</value>
<description>指定resourcemanager所在的hostname</description>
</property>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
<description>NodeManager上运行的附属服务。需配置成mapreduce_shuffle,才可运行 MapReduce程序</description>
</property>
</configuration>
export JAVA_HOME=/usr/local/jdk1.8.0_202/
HDFS_DATANODE_USER=root
HDFS_NAMENODE_USER=root
HDFS_SECONDARYNAMENODE_USER=root
YARN_RESOURCEMANAGER_USER=root
YARN_NODEMANAGER_USER=root
vim workers
master
hdfs namenode -format
若成功会打印如下信息
has been successfully formatted
./start-dfs.sh
./start-yarn.sh
jps查看进程
[root@master ~]# jps
23153 NameNode
31432 Jps
26078 NodeManager
23295 DataNode
23535 SecondaryNameNode
25935 ResourceManager
查看HDFS web ui,端口9870
查看YARN web ui, 端口8088
到此hadoop单机伪分布式部署完成