Hadoop(一)找不到 class journalnode问题

环境 hadoop 2.7.7 2主3从

问题出现在我刚配置好环境,在每个节点运行hadoop-daemon.sh start journalnode时出现,

提示

dn1: Error:Could not find or load main class journalnod

或者在主服务器nna上运行 hdfs namenode -format 报错:

21/07/30 11:18:47 INFO util.GSet: Computing capacity for map NameNodeRetryCache
21/07/30 11:18:47 INFO util.GSet: VM type = 64-bit
21/07/30 11:18:47 INFO util.GSet: 0.029999999329447746% max memory 889 MB = 273.1 KB
21/07/30 11:18:47 INFO util.GSet: capacity = 2^15 = 32768 entries
21/07/30 11:18:48 INFO ipc.Client: Retrying connect to server: dn1/192.168.190.132:8485. Already tried 0 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
21/07/30 11:18:48 INFO ipc.Client: Retrying connect to server: dn2/192.168.190.133:8485. Already tried 0 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
21/07/30 11:18:48 INFO ipc.Client: Retrying connect to server: dn3/192.168.190.134:8485. Already tried 0 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
21/07/30 11:18:49 INFO ipc.Client: Retrying connect to server: dn2/192.168.190.133:8485. Already tried 1 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
21/07/30 11:18:49 INFO ipc.Client: Retrying connect to server: dn1/192.168.190.132:8485. Already tried 1 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
21/07/30 11:18:49 INFO ipc.Client: Retrying connect to server: dn3/192.168.190.134:8485. Already tried 1 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
21/07/30 11:18:50 INFO ipc.Client: Retrying connect to server: dn2/192.168.190.133:8485. Already tried 2 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
21/07/30 11:18:50 INFO ipc.Client: Retrying connect to server: dn1/192.168.190.132:8485. Already tried 2 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
21/07/30 11:18:50 INFO ipc.Client: Retrying connect to server: dn3/192.168.190.134:8485. Already tried 2 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
21/07/30 11:18:51 INFO ipc.Client: Retrying connect to server: dn2/192.168.190.133:8485. Already tried 3 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
21/07/30 11:18:51 INFO ipc.Client: Retrying connect to server: dn1/192.168.190.132:8485. Already tried 3 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
21/07/30 11:18:51 INFO ipc.Client: Retrying connect to server: dn3/192.168.190.134:8485. Already tried 3 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
21/07/30 11:18:52 INFO ipc.Client: Retrying connect to server: dn2/192.168.190.133:8485. Already tried 4 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
21/07/30 11:18:52 INFO ipc.Client: Retrying connect to server: dn3/192.168.190.134:8485. Already tried 4 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
21/07/30 11:18:52 INFO ipc.Client: Retrying connect to server: dn1/192.168.190.132:8485. Already tried 4 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
21/07/30 11:18:53 INFO ipc.Client: Retrying connect to server: dn2/192.168.190.133:8485. Already tried 5 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
21/07/30 11:18:53 INFO ipc.Client: Retrying connect to server: dn3/192.168.190.134:8485. Already tried 5 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
21/07/30 11:18:53 INFO ipc.Client: Retrying connect to server: dn1/192.168.190.132:8485. Already tried 5 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
21/07/30 11:18:54 INFO ipc.Client: Retrying connect to server: dn2/192.168.190.133:8485. Already tried 6 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
21/07/30 11:18:54 INFO ipc.Client: Retrying connect to server: dn1/192.168.190.132:8485. Already tried 6 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
21/07/30 11:18:54 INFO ipc.Client: Retrying connect to server: dn3/192.168.190.134:8485. Already tried 6 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
21/07/30 11:18:55 INFO ipc.Client: Retrying connect to server: dn2/192.168.190.133:8485. Already tried 7 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
21/07/30 11:18:55 INFO ipc.Client: Retrying connect to server: dn1/192.168.190.132:8485. Already tried 7 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
21/07/30 11:18:55 INFO ipc.Client: Retrying connect to server: dn3/192.168.190.134:8485. Already tried 7 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
21/07/30 11:18:56 INFO ipc.Client: Retrying connect to server: dn2/192.168.190.133:8485. Already tried 8 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
21/07/30 11:18:56 INFO ipc.Client: Retrying connect to server: dn3/192.168.190.134:8485. Already tried 8 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
21/07/30 11:18:56 INFO ipc.Client: Retrying connect to server: dn1/192.168.190.132:8485. Already tried 8 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
21/07/30 11:18:57 INFO ipc.Client: Retrying connect to server: dn2/192.168.190.133:8485. Already tried 9 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
21/07/30 11:18:57 INFO ipc.Client: Retrying connect to server: dn1/192.168.190.132:8485. Already tried 9 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
21/07/30 11:18:57 INFO ipc.Client: Retrying connect to server: dn3/192.168.190.134:8485. Already tried 9 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
21/07/30 11:18:57 WARN namenode.NameNode: Encountered exception during format:
org.apache.hadoop.hdfs.qjournal.client.QuorumException: Unable to check if JNs are ready for formatting. 3 exceptions thrown:
192.168.190.132:8485: Call From nna/192.168.190.130 to dn1:8485 failed on connection exception: java.net.ConnectException: Connection refused; For more details see: http://wiki.apache.org/hadoop/ConnectionRefused
192.168.190.134:8485: Call From nna/192.168.190.130 to dn3:8485 failed on connection exception: java.net.ConnectException: Connection refused; For more details see: http://wiki.apache.org/hadoop/ConnectionRefused
192.168.190.133:8485: Call From nna/192.168.190.130 to dn2:8485 failed on connection exception: java.net.ConnectException: Connection refused; For more details see: http://wiki.apache.org/hadoop/ConnectionRefused
at org.apache.hadoop.hdfs.qjournal.client.QuorumException.create(QuorumException.java:81)
at org.apache.hadoop.hdfs.qjournal.client.QuorumCall.rethrowException(QuorumCall.java:286)
at org.apache.hadoop.hdfs.qjournal.client.QuorumJournalManager.hasSomeData(QuorumJournalManager.java:233)
at org.apache.hadoop.hdfs.server.common.Storage.confirmFormat(Storage.java:901)
at org.apache.hadoop.hdfs.server.namenode.FSImage.confirmFormat(FSImage.java:202)
at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:1011)
at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1457)
at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1582)
21/07/30 11:18:57 ERROR namenode.NameNode: Failed to start namenode.
org.apache.hadoop.hdfs.qjournal.client.QuorumException: Unable to check if JNs are ready for formatting. 3 exceptions thrown:
192.168.190.132:8485: Call From nna/192.168.190.130 to dn1:8485 failed on connection exception: java.net.ConnectException: Connection refused; For more details see: http://wiki.apache.org/hadoop/ConnectionRefused
192.168.190.134:8485: Call From nna/192.168.190.130 to dn3:8485 failed on connection exception: java.net.ConnectException: Connection refused; For more details see: http://wiki.apache.org/hadoop/ConnectionRefused
192.168.190.133:8485: Call From nna/192.168.190.130 to dn2:8485 failed on connection exception: java.net.ConnectException: Connection refused; For more details see: http://wiki.apache.org/hadoop/ConnectionRefused
at org.apache.hadoop.hdfs.qjournal.client.QuorumException.create(QuorumException.java:81)
at org.apache.hadoop.hdfs.qjournal.client.QuorumCall.rethrowException(QuorumCall.java:286)
at org.apache.hadoop.hdfs.qjournal.client.QuorumJournalManager.hasSomeData(QuorumJournalManager.java:233)
at org.apache.hadoop.hdfs.server.common.Storage.confirmFormat(Storage.java:901)
at org.apache.hadoop.hdfs.server.namenode.FSImage.confirmFormat(FSImage.java:202)
at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:1011)
at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1457)
at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1582)
21/07/30 11:18:57 INFO util.ExitUtil: Exiting with status 1
21/07/30 11:18:57 INFO namenode.NameNode: SHUTDOWN_MSG:
/****
SHUTDOWN_MSG: Shutting down NameNode at nna/192.168.190.130
**/

一开始我认为是链接防火墙和SElinux的问题 实际上我都完全放开了,检查了配置文件,也是正常的。最后发现这篇文章https://blog.csdn.net/u014729236/article/details/44944773,发现zookeeper也可能导致问题发生,果断重启zookeeper恢复正常

zkServer.sh restart & hadoop-daemon.sh start journalnode