如何安装Hadoop?
时间: 2024-03-21 09:34:04 浏览: 55
以下是在RedHat Linux下安装Hadoop的步骤:
1.下载Hadoop压缩包并解压缩:
```shell
wget https://archive.apache.org/dist/hadoop/core/hadoop-0.20.2/hadoop-0.20.2.tar.gz
tar -zxvf hadoop-0.20.2.tar.gz
```
2.配置环境变量:
```shell
export HADOOP_HOME=/usr/local/hadoop
export PATH=$PATH:$HADOOP_HOME/bin
```
3.修改Hadoop配置文件:
```shell
cd $HADOOP_HOME/conf
cp mapred-site.xml.template mapred-site.xml
cp hadoop-env.sh.template hadoop-env.sh
```
4.修改hadoop-env.sh文件:
```shell
export JAVA_HOME=/usr/java/jdk1.8.0_181-amd64
```
5.修改core-site.xml文件:
```shell
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:9000</value>
</property>
</configuration>
```
6.修改hdfs-site.xml文件:
```shell
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.name.dir</name>
<value>/usr/local/hadoop/hadoop_data/hdfs/namenode</value>
</property>
<property>
<name>dfs.data.dir</name>
<value>/usr/local/hadoop/hadoop_data/hdfs/datanode</value>
</property>
</configuration>
```
7.修改mapred-site.xml文件:
```shell
<configuration>
<property>
<name>mapred.job.tracker</name>
<value>localhost:9001</value>
</property>
</configuration>
```
8.格式化HDFS:
```shell
hadoop namenode -format
```
9.启动Hadoop:
```shell
start-all.sh
```
10.检查Hadoop是否成功启动:
```shell
jps
```
阅读全文