阿里云服务器下hadoop安装与配置
时间: 2023-11-13 19:53:47 浏览: 93
阿里云服务器下Hadoop安装与配置步骤如下:
1. 安装Java环境:
yum install java-1.8.0-openjdk-devel
2. 下载Hadoop安装包:
wget https://mirrors.tuna.tsinghua.edu.cn/apache/hadoop/common/hadoop-3.3.0/hadoop-3.3.0.tar.gz
3. 解压安装包:
tar -zxvf hadoop-3.3.0.tar.gz
4. 配置环境变量:
a. 编辑hadoop-env.sh文件:
cd hadoop-3.3.0/etc/hadoop/
vim hadoop-env.sh
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk
b. 编辑bashrc文件:
vim ~/.bashrc
export HADOOP_HOME=/root/hadoop-3.3.0
export PATH=$PATH:$HADOOP_HOME/bin
source ~/.bashrc
5. 配置Hadoop:
a. 配置hdfs-site.xml:
cd hadoop-3.3.0/etc/hadoop/
cp hdfs-site.xml.template hdfs-site.xml
vim hdfs-site.xml
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>
b. 配置core-site.xml:
cp core-site.xml.template core-site.xml
vim core-site.xml
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://localhost:9000</value>
</property>
</configuration>
6. 格式化HDFS:
hdfs namenode -format
7. 启动Hadoop:
start-all.sh
8. 检查Hadoop状态:
jps
9. 停止Hadoop:
stop-all.sh
阅读全文