當正常啟動hadoop之后,一般進程都在,而且50070端口可以訪問,但Live Nodes為0,這里可能有多種原因造成這樣:

1、/etc/hosts 中的ip映射不對

2、master與slave之間不能互通

3、hadoop配置文件有錯

在子節點中查看日志,

2018-01-03 09:26:48,488 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: hbase1/192.168.10.101:8031. Already tried 2 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
2018-01-03 09:26:49,489 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: hbase1/192.168.10.101:8031. Already tried 3 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
2018-01-03 09:26:50,490 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: hbase1/192.168.10.101:8031. Already tried 4 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
2018-01-03 09:26:51,494 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: hbase1/192.168.10.101:8031. Already tried 5 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
2018-01-03 09:26:52,495 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: hbase1/192.168.10.101:8031. Already tried 6 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
2018-01-03 09:26:53,496 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: hbase1/192.168.10.101:8031. Already tried 7 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
2018-01-03 09:26:54,497 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: hbase1/192.168.10.101:8031. Already tried 8 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
2018-01-03 09:26:55,498 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: hbase1/192.168.10.101:8031. Already tried 9 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
2018-01-03 09:27:26,510 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: hbase1/192.168.10.101:8031. Already tried 0 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
2018-01-03 09:27:27,511 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: hbase1/192.168.10.101:8031. Already tried 1 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)

說明子節點無法訪問到主節點,再去看了/etc/hosts文件:

#127.0.0.1      localhost
172.17.168.96 hbase1
192.168.10.101 hbase1
192.168.10.102 hbase2
192.168.10.103 hbase3
192.168.10.104 hbase4
192.168.10.105 hbase5
192.168.10.106 hbase6
192.168.10.107 hbase7
#backup cluster
192.168.20.101 bhbase1
192.168.20.102 bhbase2
192.168.20.103 bhbase3
192.168.20.104 bhbase4
192.168.20.105 bhbase5
192.168.20.106 bhbase6
192.168.20.107 bhbase7

其中hbase1(即主節點)映射了兩個ip,但一般在linux中默認只會取hosts中配置的第一條主機名映射來使用,對于172.17.168.96這個ip,因為子節點配置了內網ip,所以訪問不到。

解決方法就是將外網ip注釋掉。

#127.0.0.1      localhost
#172.17.168.96 hbase1
192.168.10.101 hbase1
192.168.10.102 hbase2
192.168.10.103 hbase3
192.168.10.104 hbase4
192.168.10.105 hbase5
192.168.10.106 hbase6
192.168.10.107 hbase7
#backup cluster
192.168.20.101 bhbase1
192.168.20.102 bhbase2
192.168.20.103 bhbase3
192.168.20.104 bhbase4
192.168.20.105 bhbase5
192.168.20.106 bhbase6
192.168.20.107 bhbase7


然后重啟hadoop即可。

=======================

還有一個問題就是,正常啟動了hadoop之后,50070端口可以正常訪問,但是8088端口訪問不了,解決方法:

修改配置文件yarn-site.xml 中的


yarn.resourcemanager.webapp.address
hbase1:8088

修改后為:


yarn.resourcemanager.webapp.address
172.17.168.96:8088

這里不能用主機名,而應該用外網ip。每一臺子節點都要修改,修改完成之后重啟hadoop即可。

這樣8088就能夠正常訪問。