Search code examples
hadoophdfsfirewallhadoop3datanode

Hadoop 3.1.1 showing only one live datanode


I installed hadoop 3.1.1 on 3 virtual machines with VMware on Ubuntu. When I run hdfs namenode -format and start-all.sh then jps works correctly on my master and two slaves nodes.

However, with the command hdfs dfsadmin -report, I can see only one live data node (I get the same result when I check on master:50070 or 8088).

I tried to disable firewall as follows: ufw disable but it didn't solve the problem. The 3 machines can connect with each other (without passwd) with ping and ssh. I also deleted the hadoop tmp folder with datanode and namenode folders but it didn't work as well. There are also no issues shown in the log files.

Do you have any solutions to get three live datanode instead of one? Thanks.


These are my configurations files:

yarn-site.xml

<configuration>
<property>
  <name>yarn.resourcemanager.hostname</name>
  <value>master</value>
</property>
<property>
    <name>yarn.resourcemanager.resource-tracker.address</name>
    <value>master:8025</value>
</property>
<property>
    <name>yarn.resourcemanager.scheduler.address</name>
    <value>master:8035</value>
</property>
<property>
    <name>yarn.resourcemanager.address</name>
    <value>master:8050</value>
</property>
</configuration>

hdfs-site.xml

<configuration>
<property>
    <name>dfs.datanode.data.dir</name>
<value>/usr/local/hadoop_tmp/hdfs/datanode</value>
    <final>true</final>
</property>
<property>
    <name>dfs.namenode.name.dir</name>
    <value>/usr/local/hadoop_tmp/hdfs/namenode</value>
    <final>true</final>
</property>
<property>
    <name>dfs.namenode.http-address</name>
    <value>master:50070</value>
</property>
<property>
    <name>dfs.replication</name>
<value>3</value> 
</property>
</configuration>

core-site.xml

<configuration>
<property>
    <name>fs.default.name</name>
    <value>hdfs://master:9000/</value>
</property>
<property>
    <name>fs.default.FS</name>
    <value>hdfs://master:9000/</value>
</property>
</configuration>

workers

   master
   slave1
   slave2

Solution

  • I found a solution. The problem was the firewall. But "ufw" doesn't help. I needed to do those commands:

    sudo iptables -L -v
    sudo iptables -F
    sudo iptables -X
    sudo iptables -t nat -F
    sudo iptables -t nat -X
    sudo iptables -t mangle -F
    sudo iptables -t mangle -X
    sudo iptables -P INPUT ACCEPT
    sudo iptables -P FORWARD ACCEPT
    sudo iptables -P OUTPUT ACCEPT