windows下设置hadoop3.1.4环境

打印 上一主题 下一主题

主题 576|帖子 576|积分 1728

说明

目前情况

现在在做一个hadoop集群,本机是windows11环境,hadoop集群是centos环境,已经搭建好了一个四节点的集群,分别是master、slave1、slave2、slave3,分别在四台假造机上。现在对集群的文件举行下载操作遇到报错没有Hadoop环境。于是举行环境设置
检查Java环境

运行命令行
  1. java -version
复制代码

设置Hadoop环境

下载解压hadoop3.1.4


下载插件

winutils 是 Hadoop 在 Windows 操作系统上运行时所需的一个工具集。它重要用于提供一些 Unix/Linux 系统上默认存在的功能和命令的替代实现,由于 Hadoop 大部分是在这些系统上开辟和运行的
下载地点 链接: link
必要这两个文件,放入hadoop的bin文件夹下

设置环境变量


报错

设置完环境变量,命令行输入hadoop version
发现报错
  1. hadoop version
复制代码
报错

办理报错,原因是Java_Home目次中含有空格,hadoop识别不了空格
具体原因大概是 在很多编程环境和脚本中,空格被用作参数分隔符。当路径中包含空格时,系统大概会将其误解为多个参数,而不是一个完整的路径。例如,路径 C:\Program Files\Java\jdk 会被剖析为三个差异的部分。
查察我们的java环境

换个位置,修改环境

命令行再次输入

到这根本能用了,办理了开头说的下载操作,想在window下启动可以继续往下看
修改Hadoop设置文件

修改的文件都在这个目次下面

修改core-site.xml文件

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
  3. <!--
  4.   Licensed under the Apache License, Version 2.0 (the "License");
  5.   you may not use this file except in compliance with the License.
  6.   You may obtain a copy of the License at
  7.     http://www.apache.org/licenses/LICENSE-2.0
  8.   Unless required by applicable law or agreed to in writing, software
  9.   distributed under the License is distributed on an "AS IS" BASIS,
  10.   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11.   See the License for the specific language governing permissions and
  12.   limitations under the License. See accompanying LICENSE file.
  13. -->
  14. <!-- Put site-specific property overrides in this file. -->
  15. <configuration>
  16.         <property>
  17.                 <name>fs.defaultFS</name>
  18.                 <value>hdfs://localhost:9000</value>
  19.         </property>
  20. </configuration>
复制代码

修改hdfs-site.xml文件

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
  3. <!--
  4.   Licensed under the Apache License, Version 2.0 (the "License");
  5.   you may not use this file except in compliance with the License.
  6.   You may obtain a copy of the License at
  7.     http://www.apache.org/licenses/LICENSE-2.0
  8.   Unless required by applicable law or agreed to in writing, software
  9.   distributed under the License is distributed on an "AS IS" BASIS,
  10.   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11.   See the License for the specific language governing permissions and
  12.   limitations under the License. See accompanying LICENSE file.
  13. -->
  14. <!-- Put site-specific property overrides in this file. -->
  15. <configuration>
  16.     <property>      
  17.         <name>dfs.replication</name>      
  18.         <value>1</value>   
  19.     </property>   
  20.     <property>      
  21.         <name>dfs.namenode.name.dir</name>      
  22.         <value>file:///C:/hadoop/hadoop-3.1.4/data/namenode</value>
  23.     </property>   
  24.     <property>      
  25.         <name>dfs.datanode.data.dir</name>     
  26.         <value>file:///C:/hadoop/hadoop-3.1.4/data/datanode</value>
  27.     </property>
  28. </configuration>
复制代码
这里会存在问题
1 必要自己在hadoop下新建文件夹data(可以换成其他名字),在新datanode和namenode文件夹
2 注意路径写法,hadoop不能读取windows下的路径,我们必要把原来的路径换成URI格式

修改yarn-site.xml文件

  1. <?xml version="1.0"?>
  2. <!--
  3.   Licensed under the Apache License, Version 2.0 (the "License");
  4.   you may not use this file except in compliance with the License.
  5.   You may obtain a copy of the License at
  6.     http://www.apache.org/licenses/LICENSE-2.0
  7.   Unless required by applicable law or agreed to in writing, software
  8.   distributed under the License is distributed on an "AS IS" BASIS,
  9.   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10.   See the License for the specific language governing permissions and
  11.   limitations under the License. See accompanying LICENSE file.
  12. -->
  13. <configuration>
  14.         <property>
  15.                 <name>yarn.nodemanager.aux-services</name>
  16.                 <value>mapreduce_shuffle</value>
  17.         </property>
  18.         <property>
  19.                 <name>yarn.nodemanager.auxservices.mapreduce.shuffle.class</name>
  20.                 <value>org.apache.hadoop.mapred.ShuffleHandler</value>
  21.         </property>
  22. </configuration>
复制代码

修改mapred-site.xml文件

  1. <?xml version="1.0"?>
  2. <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
  3. <!--
  4.   Licensed under the Apache License, Version 2.0 (the "License");
  5.   you may not use this file except in compliance with the License.
  6.   You may obtain a copy of the License at
  7.     http://www.apache.org/licenses/LICENSE-2.0
  8.   Unless required by applicable law or agreed to in writing, software
  9.   distributed under the License is distributed on an "AS IS" BASIS,
  10.   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11.   See the License for the specific language governing permissions and
  12.   limitations under the License. See accompanying LICENSE file.
  13. -->
  14. <!-- Put site-specific property overrides in this file. -->
  15. <configuration>   
  16.         <property>      
  17.         <name>mapreduce.framework.name</name>      
  18.         <value>yarn</value>   
  19.         </property>
  20. </configuration>
复制代码

修改hadoop-env.sh文件


修改hadoop-env.cmd文件


格式化

命令行进入bin目次,实行格式化命令
  1. hdfs namenode –format
复制代码


启动集群

命令行进入sbin目次运行start-all脚本
  1. .\start-all.cmd
复制代码
实行完命令弹出4个窗口

查察第一个窗口有无报错

没有报错根本就运行成功了
我这里jps没有输出,不知道什么原因,求解
游览器访问

打开游览器访问localhost:9870


免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

梦应逍遥

金牌会员
这个人很懒什么都没写!

标签云

快速回复 返回顶部 返回列表