在Linux環境下搭建Hadoop集群時,以下是一些關鍵的技巧和步驟:
sudo apt-get update
sudo apt-get install openjdk-8-jdk
ssh-keygen -t rsa
ssh-copy-id user@node2
ssh-copy-id user@node3
wget https://archive.apache.org/dist/hadoop/common/hadoop-3.3.1/hadoop-3.3.1.tar.gz
tar -xzvf hadoop-3.3.1.tar.gz -C /usr/local/
~/.bashrc
或/etc/profile
:export HADOOP_HOME=/usr/local/hadoop-3.3.1
export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin
source ~/.bashrc
core-site.xml
:<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://namenode:9000</value>
</property>
</configuration>
hdfs-site.xml
:<configuration>
<property>
<name>dfs.replication</name>
<value>3</value>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>/path/to/namenode/dir</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>/path/to/datanode/dir</value>
</property>
</configuration>
yarn-site.xml
:<configuration>
<property>
<name>yarn.resourcemanager.hostname</name>
<value>resourcemanager</value>
</property>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
</configuration>
mapred-site.xml
:<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration>
hdfs namenode -format
start-dfs.sh
start-yarn.sh
hdfs dfsadmin -report
yarn node -list
通過以上步驟和技巧,你可以更順利地在Linux環境下搭建一個穩定且高效的Hadoop集群。