只有一个数据节点可以在多节点的Hadoop安装运行(Only one datanode can ru

2019-10-18 10:42发布

I am trying to setup a multinode Hadoop cluster. Right now, I am only trying with two nodes. One is NameNode/DataNode (host A), and the other is the second DataNode (host B). The strange thing is that, I can have only one DataNode running, either from host A or host B. If I remove the host B from the conf/slaves file and only keep host A in the set up, the system will use host A as the DataNode. But if I put both host A and B in the conf/slaves file, only host B will show up as the only DataNode in the system.

The following is the log for host A when it does not work:

************************************************************/
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

I would appreciate any insights. Thanks.

EDIT: The configuration files are as following:

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

Update: Just added another host C into the cluster and make host A only serve as the NameNode (not a NameNode/DataNode). And the problem is the same. Only 1 host can run as the DataNode. Any ideas? Many thanks.

Answer 1:

解决了这个问题。 我看了,虽然错误信息

Node 192.168.1.128:50010 is expected to serve this storage

并且发现,当我复制从一个服务器设置到另一个,我也复制了HDFS(dfs.data.dir)本地数据目录。 这会产生冲突。 有一次,我清理本地dfs.data.dir内的所有数据,数据管理部开始,没有任何问题。



Answer 2:

万一你把它加至hosts.exclude文件,而无需刷新排除从节点? 或者是它以前被排除在外,你以后添加它,并且忘掉刷新节点?如果是这样的情况下,重新启动守护程序和运行斌/ Hadoop的dfsadmin -refreshNodes。



文章来源: Only one datanode can run in a multinode Hadoop setup
标签: hadoop hdfs