对hadoop3.1.3的搭建详细说明
时间: 2024-02-23 18:56:37 浏览: 100
好的,下面我会为您详细介绍一下如何搭建hadoop3.1.3:
1.准备工作:
安装jdk1.8或以上版本,配置好环境变量。
2.下载hadoop3.1.3:
从官网(https://hadoop.apache.org/releases.html)下载hadoop-3.1.3.tar.gz文件,解压到任意目录。
3.配置hadoop:
a.修改hadoop-env.sh文件:
修改JAVA_HOME为JDK的安装路径:
export JAVA_HOME=/usr/local/java/jdk1.8.0_131
b.修改core-site.xml文件:
添加以下内容:
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://localhost:9000</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/usr/local/hadoop/tmp</value>
</property>
</configuration>
c.修改hdfs-site.xml文件:
添加以下内容:
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>/usr/local/hadoop/dfs/name</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>/usr/local/hadoop/dfs/data</value>
</property>
</configuration>
d.修改mapred-site.xml.template文件:
将文件名改为mapred-site.xml:
mv mapred-site.xml.template mapred-site.xml
添加以下内容:
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration>
e.修改yarn-site.xml文件:
添加以下内容:
<configuration>
<property>
<name>yarn.nodemanager.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>
<property>
<name>yarn.resourcemanager.hostname</name>
<value>localhost</value>
</property>
<property>
<name>yarn.nodemanager.local-dirs</name>
<value>/usr/local/hadoop/yarn_local</value>
</property>
<property>
<name>yarn.nodemanager.log-dirs</name>
<value>/usr/local/hadoop/yarn_log</value>
</property>
</configuration>
f.将hadoop拷贝到指定目录:
将解压后的hadoop文件夹拷贝到/usr/local/目录下。
4.启动hadoop:
a.格式化namenode:
cd /usr/local/hadoop/bin
./hdfs namenode -format
b.启动hadoop:
./start-all.sh
c.查看启动状态:
jps
如果能看到以下进程,则说明hadoop已经启动成功:
NameNode
SecondaryNameNode
DataNode
ResourceManager
NodeManager
5.测试hadoop:
a.创建文件夹:
./hdfs dfs -mkdir /test
b.上传文件:
./hdfs dfs -put /usr/local/hadoop/LICENSE.txt /test/
c.查看文件:
./hdfs dfs -ls /test
d.下载文件:
./hdfs dfs -get /test/LICENSE.txt /usr/local/hadoop/
e.删除文件:
./hdfs dfs -rm /test/LICENSE.txt
f.停止hadoop:
./stop-all.sh
以上就是hadoop3.1.3的搭建详细说明,希望对您有所帮助。
阅读全文
相关推荐
![-](https://img-home.csdnimg.cn/images/20241231044955.png)
![-](https://img-home.csdnimg.cn/images/20241231045021.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![txt](https://img-home.csdnimg.cn/images/20241231045021.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![-](https://img-home.csdnimg.cn/images/20250102104920.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)