安装hadoop

发布时间 2023-12-01 23:39:17作者: DogLeftover

hadoop:https://blog.csdn.net/weixin_44898710/article/details/109832031

  • 将压缩包上传到服务器
# 上传到/home/software路径
# 设置权限
chmod 755 hadoop-3.2.1.tar.gz
# 解压
tar -zxvf hadoop-3.2.1.tar.gz
# 配置
vim /etc/profile

export HADOOP_HOME=/home/software/hadoop-3.2.1
export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin

export HADOOP_CONF_DIR=/home/software/hadoop-3.2.1/etc/hadoop
export PATH=$PATH:$HADOOP_CONF_DIR/bin
export YARN_CONF_DIR=/home/software/hadoop-3.2.1/etc/hadoop

# 生效
source /etc/profile
  • 替换文件
# 进入如下路径
cd /home/software/hadoop-3.2.1/etc/hadoop
# 删除默认文件
rm -rf core-site.xml  yarn-site.xml mapred-site.xml yarn-site.xml
查看详情
  • core-site.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License. See accompanying LICENSE file.
-->

<!-- Put site-specific property overrides in this file. -->

<configuration>
   <property>
            <name>fs.defaultFS</name>
            <value>hdfs://hadoop01:9000</value>
   </property>
   <property>
            <name>hadoop.tmp.dir</name>
            <value>/home/software/hadoop-3.2.1/tmp</value>
   </property>
   <property>
	    <name>hadoop.proxyuser.root.hosts</name>
	    <value>*</value>
   </property>
   <property>
	    <name>hadoop.proxyuser.root.groups</name>
	    <value>*</value>
   </property>
</configuration>
  • 修改hosts
[root@master sbin]# vim /etc/hosts
192.168.128.130 hadoop01
# 新建文件夹
mkdir -p data
  • 验证
# cd /sbin
start-dfs.sh
stop-dfs.sh
jps

# 验证方式2:3个端口启动
[root@master software]# netstat -nltp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 192.168.128.78:9000     0.0.0.0:*               LISTEN      3090/java           
tcp        0      0 0.0.0.0:9870            0.0.0.0:*               LISTEN      3090/java           
tcp        0      0 192.168.128.78:50070    0.0.0.0:*               LISTEN      3450/java 

浏览器访问
# http://192.168.128.78:9870/
  • 其他问题
# 清空
hdfs namenode -format

# 日志
cd logs

端口占用
替换失败