1

我正在尝试设置一个多节点 Hadoop 集群。现在,我只尝试使用两个节点。一个是NameNode/DataNode(主机A),另一个是第二个DataNode(主机B)。奇怪的是,我只能从主机 A 或主机 B 运行一个 DataNode。如果我从 conf/slaves 文件中删除主机 B,并且只保留主机 A,系统将使用主机 A作为数据节点。但是如果我将主机 A 和 B 都放在 conf/slaves 文件中,那么只有主机 B 会显示为系统中唯一的 DataNode。

以下是主机A不工作时的日志:

************************************************************/
2013-07-31 10:18:16,074 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: STARTUP_MSG: 
/************************************************************
STARTUP_MSG: Starting DataNode
STARTUP_MSG:   host = A.MYDOMAIN.com/192.168.1.129
STARTUP_MSG:   args = []
STARTUP_MSG:   version = 1.0.4
STARTUP_MSG:   build = https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1.0 -r 1393290; compiled by 'hortonfo' on Wed Oct  3 05:13:58 UTC 2012
************************************************************/
2013-07-31 10:18:16,317 INFO org.apache.hadoop.metrics2.impl.MetricsConfig: loaded properties from hadoop-metrics2.properties
2013-07-31 10:18:16,334 INFO org.apache.hadoop.metrics2.impl.MetricsSourceAdapter: MBean for source MetricsSystem,sub=Stats registered.
2013-07-31 10:18:16,335 INFO org.apache.hadoop.metrics2.impl.MetricsSystemImpl: Scheduled snapshot period at 10 second(s).
2013-07-31 10:18:16,335 INFO org.apache.hadoop.metrics2.impl.MetricsSystemImpl: DataNode metrics system started
2013-07-31 10:18:16,470 INFO org.apache.hadoop.metrics2.impl.MetricsSourceAdapter: MBean for source ugi registered.
2013-07-31 10:18:16,842 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: Registered FSDatasetStatusMBean
2013-07-31 10:18:16,855 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: Opened info server at 50010
2013-07-31 10:18:16,858 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: Balancing bandwith is 1048576 bytes/s
2013-07-31 10:18:16,932 INFO org.mortbay.log: Logging to org.slf4j.impl.Log4jLoggerAdapter(org.mortbay.log) via org.mortbay.log.Slf4jLog
2013-07-31 10:18:17,038 INFO org.apache.hadoop.http.HttpServer: Added global filtersafety (class=org.apache.hadoop.http.HttpServer$QuotingInputFilter)
2013-07-31 10:18:17,053 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: dfs.webhdfs.enabled = false
2013-07-31 10:18:17,054 INFO org.apache.hadoop.http.HttpServer: Port returned by webServer.getConnectors()[0].getLocalPort() before open() is -1. Opening the listener on 50075
2013-07-31 10:18:17,054 INFO org.apache.hadoop.http.HttpServer: listener.getLocalPort() returned 50075 webServer.getConnectors()[0].getLocalPort() returned 50075
2013-07-31 10:18:17,054 INFO org.apache.hadoop.http.HttpServer: Jetty bound to port 50075
2013-07-31 10:18:17,054 INFO org.mortbay.log: jetty-6.1.26
2013-07-31 10:18:17,437 INFO org.mortbay.log: Started SelectChannelConnector@0.0.0.0:50075
2013-07-31 10:18:17,444 INFO org.apache.hadoop.metrics2.impl.MetricsSourceAdapter: MBean for source jvm registered.
2013-07-31 10:18:17,446 INFO org.apache.hadoop.metrics2.impl.MetricsSourceAdapter: MBean for source DataNode registered.
2013-07-31 10:18:17,786 INFO org.apache.hadoop.ipc.Server: Starting SocketReader
2013-07-31 10:18:17,790 INFO org.apache.hadoop.metrics2.impl.MetricsSourceAdapter: MBean for source RpcDetailedActivityForPort50020 registered.
2013-07-31 10:18:17,791 INFO org.apache.hadoop.metrics2.impl.MetricsSourceAdapter: MBean for source RpcActivityForPort50020 registered.
2013-07-31 10:18:17,794 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: dnRegistration = DatanodeRegistration(A.MYDOMAIN.com:50010, storageID=DS-1991287861-192.168.1.129-50010-1373314691613, infoPort=50075, ipcPort=50020)
2013-07-31 10:18:17,817 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: Starting asynchronous block report scan
2013-07-31 10:18:17,820 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: DatanodeRegistration(192.168.1.129:50010, storageID=DS-1991287861-192.168.1.129-50010-1373314691613, infoPort=50075, ipcPort=50020)In DataNode.run, data = FSDataset{dirpath='/disk2/clustering/support/hdfs/data/current'}
2013-07-31 10:18:17,824 INFO org.apache.hadoop.ipc.Server: IPC Server Responder: starting
2013-07-31 10:18:17,825 INFO org.apache.hadoop.ipc.Server: IPC Server listener on 50020: starting
2013-07-31 10:18:17,827 INFO org.apache.hadoop.ipc.Server: IPC Server handler 0 on 50020: starting
2013-07-31 10:18:17,827 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: using BLOCKREPORT_INTERVAL of 3600000msec Initial delay: 0msec
2013-07-31 10:18:17,829 INFO org.apache.hadoop.ipc.Server: IPC Server handler 1 on 50020: starting
2013-07-31 10:18:17,830 INFO org.apache.hadoop.ipc.Server: IPC Server handler 2 on 50020: starting
2013-07-31 10:18:17,831 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: Starting Periodic block scanner.
2013-07-31 10:18:17,831 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: Finished asynchronous block report scan in 14ms
2013-07-31 10:18:17,845 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: Generated rough (lockless) block report in 12 ms
2013-07-31 10:18:17,848 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: Reconciled asynchronous block report against current state in 2 ms
2013-07-31 10:18:20,828 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: Reconciled asynchronous block report against current state in 0 ms
2013-07-31 10:18:20,838 WARN org.apache.hadoop.hdfs.server.datanode.DataNode: DataNode is shutting down: org.apache.hadoop.ipc.RemoteException: org.apache.hadoop.hdfs.protocol.UnregisteredDatanodeException: Data node 192.168.1.129:50010 is attempting to report storage ID DS-1991287861-192.168.1.129-50010-1373314691613. Node 192.168.1.128:50010 is expected to serve this storage.
    at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getDatanode(FSNamesystem.java:4608)
    at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.processReport(FSNamesystem.java:3460)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.blockReport(NameNode.java:1001)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:563)
    at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1388)
    at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1384)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:396)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1121)
    at org.apache.hadoop.ipc.Server$Handler.run(Server.java:1382)

    at org.apache.hadoop.ipc.Client.call(Client.java:1070)
    at org.apache.hadoop.ipc.RPC$Invoker.invoke(RPC.java:225)
    at $Proxy5.blockReport(Unknown Source)
    at org.apache.hadoop.hdfs.server.datanode.DataNode.offerService(DataNode.java:958)
    at org.apache.hadoop.hdfs.server.datanode.DataNode.run(DataNode.java:1458)
    at java.lang.Thread.run(Thread.java:662)

2013-07-31 10:18:20,839 INFO org.mortbay.log: Stopped SelectChannelConnector@0.0.0.0:50075
2013-07-31 10:18:20,942 INFO org.apache.hadoop.ipc.Server: Stopping server on 50020
2013-07-31 10:18:20,943 INFO org.apache.hadoop.ipc.Server: IPC Server handler 0 on 50020: exiting
2013-07-31 10:18:20,944 INFO org.apache.hadoop.ipc.Server: IPC Server handler 2 on 50020: exiting
2013-07-31 10:18:20,944 INFO org.apache.hadoop.ipc.Server: Stopping IPC Server listener on 50020
2013-07-31 10:18:20,943 INFO org.apache.hadoop.ipc.Server: IPC Server handler 1 on 50020: exiting
2013-07-31 10:18:20,945 INFO org.apache.hadoop.ipc.metrics.RpcInstrumentation: shut down
2013-07-31 10:18:20,945 INFO org.apache.hadoop.ipc.Server: Stopping IPC Server Responder
2013-07-31 10:18:20,945 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: Waiting for threadgroup to exit, active threads is 1
2013-07-31 10:18:20,945 WARN org.apache.hadoop.hdfs.server.datanode.DataNode: DatanodeRegistration(192.168.1.129:50010, storageID=DS-1991287861-192.168.1.129-50010-1373314691613, infoPort=50075, ipcPort=50020):DataXceiveServer:java.nio.channels.AsynchronousCloseException
    at java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:185)
    at sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:157)
    at sun.nio.ch.ServerSocketAdaptor.accept(ServerSocketAdaptor.java:84)
    at org.apache.hadoop.hdfs.server.datanode.DataXceiverServer.run(DataXceiverServer.java:131)
    at java.lang.Thread.run(Thread.java:662)

2013-07-31 10:18:20,945 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: Exiting DataXceiveServer
2013-07-31 10:18:21,905 INFO org.apache.hadoop.hdfs.server.datanode.DataBlockScanner: Exiting DataBlockScanner thread.
2013-07-31 10:18:21,945 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: Waiting for threadgroup to exit, active threads is 0
2013-07-31 10:18:22,047 INFO org.apache.hadoop.hdfs.server.datanode.FSDatasetAsyncDiskService: Shutting down all async disk service threads...
2013-07-31 10:18:22,048 INFO org.apache.hadoop.hdfs.server.datanode.FSDatasetAsyncDiskService: All async disk service threads have been shut down.
2013-07-31 10:18:22,048 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: DatanodeRegistration(192.168.1.129:50010, storageID=DS-1991287861-192.168.1.129-50010-1373314691613, infoPort=50075, ipcPort=50020):Finishing DataNode in: FSDataset{dirpath='/disk2/clustering/support/hdfs/data/current'}
2013-07-31 10:18:22,050 WARN org.apache.hadoop.metrics2.util.MBeans: Hadoop:service=DataNode,name=DataNodeInfo
javax.management.InstanceNotFoundException: Hadoop:service=DataNode,name=DataNodeInfo
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1094)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.exclusiveUnregisterMBean(DefaultMBeanServerInterceptor.java:415)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.unregisterMBean(DefaultMBeanServerInterceptor.java:403)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.unregisterMBean(JmxMBeanServer.java:506)
    at org.apache.hadoop.metrics2.util.MBeans.unregister(MBeans.java:71)
    at org.apache.hadoop.hdfs.server.datanode.DataNode.unRegisterMXBean(DataNode.java:522)
    at org.apache.hadoop.hdfs.server.datanode.DataNode.shutdown(DataNode.java:737)
    at org.apache.hadoop.hdfs.server.datanode.DataNode.run(DataNode.java:1471)
    at java.lang.Thread.run(Thread.java:662)
2013-07-31 10:18:22,051 INFO org.apache.hadoop.ipc.Server: Stopping server on 50020
2013-07-31 10:18:22,051 INFO org.apache.hadoop.ipc.metrics.RpcInstrumentation: shut down
2013-07-31 10:18:22,051 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: Waiting for threadgroup to exit, active threads is 0
2013-07-31 10:18:22,051 WARN org.apache.hadoop.metrics2.util.MBeans: Hadoop:service=DataNode,name=FSDatasetState-DS-1991287861-192.168.1.129-50010-1373314691613
javax.management.InstanceNotFoundException: Hadoop:service=DataNode,name=FSDatasetState-DS-1991287861-192.168.1.129-50010-1373314691613
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1094)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.exclusiveUnregisterMBean(DefaultMBeanServerInterceptor.java:415)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.unregisterMBean(DefaultMBeanServerInterceptor.java:403)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.unregisterMBean(JmxMBeanServer.java:506)
    at org.apache.hadoop.metrics2.util.MBeans.unregister(MBeans.java:71)
    at org.apache.hadoop.hdfs.server.datanode.FSDataset.shutdown(FSDataset.java:2067)
    at org.apache.hadoop.hdfs.server.datanode.DataNode.shutdown(DataNode.java:799)
    at org.apache.hadoop.hdfs.server.datanode.DataNode.run(DataNode.java:1471)
    at java.lang.Thread.run(Thread.java:662)
2013-07-31 10:18:22,052 WARN org.apache.hadoop.hdfs.server.datanode.FSDatasetAsyncDiskService: AsyncDiskService has already shut down.
2013-07-31 10:18:22,052 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: Exiting Datanode
2013-07-31 10:18:22,055 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: SHUTDOWN_MSG: 
/************************************************************
SHUTDOWN_MSG: Shutting down DataNode at A.MYDOMAIN.com/192.168.1.129

我将不胜感激任何见解。谢谢。

编辑:配置文件如下:

core-site.xml
<configuration>
    <property>
        <name>fs.default.name</name>
        <value>hdfs://A.MYDOMAIN.COM:9000</value>
    </property>
</configuration>

hdfs-site.xml
<configuration>
<property>
    <name>dfs.replication</name>
    <value>2</value>
</property>
<property>
    <name>dfs.data.dir</name>
    <value>/disk2/clustering/support/hdfs/data</value>
</property>
<property>
    <name>dfs.name.dir</name>
    <value>/disk2/clustering/support/hdfs/name</value>
</property>
<property>
    <name>hadoop.tmp.dir</name>
    <value>/disk2/clustering/support/hdfs/tmp</value>
</property>
</configuration>

slaves (on host A only, host B is default localhost)
A.MYDOMAIN.COM
B.MYDOMAIN.COM

masters (on host A only, host B is default localhost)
A.MYDOMAIN.COM

更新:刚刚将另一台主机 C 添加到集群中,并使主机 A 仅用作 NameNode(不是 NameNode/DataNode)。问题是一样的。只有 1 个主机可以作为 DataNode 运行。有任何想法吗?非常感谢。

4

2 回答 2

9

解决了这个问题。我阅读了错误信息

Node 192.168.1.128:50010 is expected to serve this storage

发现当我将设置从一台服务器复制到另一台服务器时,我还复制了 HDFS 的本地数据目录(dfs.data.dir)。这造成了冲突。一旦我清理了本地 dfs.data.dir 中的所有数据,DataNode 就会毫无问题地启动。

于 2013-08-01T13:49:44.890 回答
0

您是否有机会通过将其添加到hosts.exclude文件而不刷新从属节点来排除它?还是它之前被排除在外,您后来添加它并忘记刷新节点?如果是这种情况,请重新启动守护程序并运行bin/hadoop dfsadmin -refreshNodes

于 2013-07-31T20:10:07.440 回答