2
Membros
Only Deus pode mim julga
2 years ago
Opa!
Esses dias uma pessoa entrou em contato comigo sobre o provisionamento do Hadoop no ubuntu.
Eu tinha um tutorial para a versão 2:
https://alissonmachado.com.br/u/alisson.machado/hadoop-cluster
Mas o Hadoop ja esta na versão 3 e algumas coisas precisam ser atualizadas.
Claro que algumas coisas mudaram da versão 2 quando eu escrevi para a 3.
Servidores:
master: 192.168.0.178
Node: 192.168.0.172
Primeiro voce tem que garantir que os nomes podem ser resolvidos em todas as maquinas, caso contrario o hadoop nao funciona:
root@master:/opt/hadoop/etc/hadoop# cat /etc/hosts
127.0.0.1 localhost
192.168.0.178 master
192.168.0.172 node
Rodar em todas as maquinas:
apt install default-jre vim -y
So no master:
wget http://ftp.unicamp.br/pub/apache/hadoop/common/stable/hadoop-3.3.5.tar.gz
tar -xf hadoop-3.3.5.tar.gz
mv hadoop-3.3.5 /opt/hadoop
update-alternatives --list java
/usr/lib/jvm/java-11-openjdk-arm64/
O ultimo comando é só pra pegar o caminho do JAVA_HOME
Adicionar no final do: /etc/profile
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-arm64/
export HADOOP_HOME=/opt/hadoop
export HADOOP_MAPRED_HOME=$HADOOP_HOME
export HADOOP_COMMON_HOME=$HADOOP_HOME
export HADOOP_HDFS_HOME=$HADOOP_HOME
export YARN_HOME=$HADOOP_HOME
export HDFS_NAMENODE_USER="root"
export HDFS_DATANODE_USER="root"
export HDFS_SECONDARYNAMENODE_USER="root"
export YARN_RESOURCEMANAGER_USER="root"
export YARN_NODEMANAGER_USER="root"
PATH=$PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin
Executar no master
Accesso ssh sem senha:
ssh-keygen
ssh-copy-id root@node
ssh-copy-id root@master
scp /etc/profile root@192.168.0.172:/etc/profile
root@master:/opt/hadoop/etc/hadoop# cat 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://192.168.0.178:8082</value>
</property>
</configuration>
root@master:/opt/hadoop/etc/hadoop# cat hdfs-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>dfs.namenode.name.dir</name>
<value>file:/opt/hadoop/hdfs/namenode</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>file:/opt/hadoop/hdfs/datanode</value>
</property>
<property>
<name>dfs.replication</name>
<value>2</value>
</property>
</configuration>
root@master:/opt/hadoop/etc/hadoop# mapred-site.xml
<?xml version="1.0"?>
<?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>mapreduce.framework.name</name>
<value>yarn</value>
</property>
<property>
<name>mapreduce.jobhistory.webapp.address</name>
<value>192.168.0.178:19888</value>
</property>
</configuration>
root@master:/opt/hadoop/etc/hadoop# yarn-site.xml
<?xml version="1.0"?>
<!--
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.
-->
<configuration>
<property>
<name>yarn.resourcemanager.hostname</name>
<value>master</value>
</property>
<property>
<name>yarn.resourcemanager.bind-host</name>
<value>0.0.0.0</value>
</property>
<property>
<name>yarn.nodemanager.bind-host</name>
<value>0.0.0.0</value>
</property>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<property>
<name>yarn.nodemanager.remote-app-log-dir</name>
<value>hdfs://192.168.0.178:8020/var/log/hadoop-yarn/apps</value>
</property>
</configuration>
Arquivo masters
192.168.0.178
Aquivo workers/slaves
192.168.0.172
Adicionar linhas no: hadoop-env.sh
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-arm64/
export HADOOP_HOME=/opt/hadoop
Copiar tudo para o DataNode
scp -r /opt/* root@192.168.0.172:/opt/
Iniciando o hadoop
source /etc/profile
hdfs namenode -format
start-dfs.sh