development

HDFS 오류 : 1 개가 아닌 0 개 노드에만 복제 될 수 있습니다.

big-blog 2020. 11. 11. 20:25
반응형

HDFS 오류 : 1 개가 아닌 0 개 노드에만 복제 될 수 있습니다.


EC2에서 우분투 단일 노드 하둡 클러스터를 만들었습니다.

hdfs에 대한 간단한 파일 업로드 테스트는 EC2 머신에서 작동하지만 EC2 외부 머신에서는 작동하지 않습니다.

원격 시스템에서 웹 인터페이스를 통해 파일 시스템을 탐색 할 수 있으며 서비스 중으로보고되는 하나의 데이터 노드가 표시됩니다. 보안의 모든 tcp 포트를 0에서 60000 (!)까지 열었으므로 그게 아니라고 생각합니다.

오류가 발생합니다

java.io.IOException: File /user/ubuntu/pies could only be replicated to 0 nodes, instead of 1
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getAdditionalBlock(FSNamesystem.java:1448)
at org.apache.hadoop.hdfs.server.namenode.NameNode.addBlock(NameNode.java:690)
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.WritableRpcEngine$Server.call(WritableRpcEngine.java:342)
at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1350)
at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1346)
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:742)
at org.apache.hadoop.ipc.Server$Handler.run(Server.java:1344)

at org.apache.hadoop.ipc.Client.call(Client.java:905)
at org.apache.hadoop.ipc.WritableRpcEngine$Invoker.invoke(WritableRpcEngine.java:198)
at $Proxy0.addBlock(Unknown Source)
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.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:82)
at org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:59)
at $Proxy0.addBlock(Unknown Source)
at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.locateFollowingBlock(DFSOutputStream.java:928)
at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.nextBlockOutputStream(DFSOutputStream.java:811)
at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.run(DFSOutputStream.java:427)

namenode 로그는 동일한 오류를 제공합니다. 다른 사람들은 흥미로운 것이없는 것 같습니다.

어떤 아이디어?

건배


경고 : 다음은 HDFS의 모든 데이터를 파괴합니다. 기존 데이터를 파괴하지 않는 한이 답변의 단계를 실행하지 마십시오 !!

다음을 수행해야합니다.

  1. 모든 Hadoop 서비스 중지
  2. dfs / name 및 dfs / data 디렉토리 삭제
  3. hdfs namenode -format 대문자 Y로 응답
  4. Hadoop 서비스 시작

또한 시스템의 디스크 공간을 확인하고 로그가 이에 대해 경고하지 않는지 확인하십시오.


이것은 당신의 문제입니다-클라이언트는 데이터 노드와 통신 할 수 없습니다. 클라이언트가 데이터 노드에 대해받은 IP는 공용 IP가 아닌 내부 IP이기 때문입니다. 이것 좀 봐

http://www.hadoopinrealworld.com/could-only-be-replicated-to-0-nodes/

DFSClient $ DFSOutputStrem (Hadoop 1.2.1)에서 소스 코드를 확인합니다.

//
// Connect to first DataNode in the list.
//
success = createBlockOutputStream(nodes, clientName, false);

if (!success) {
  LOG.info("Abandoning " + block);
  namenode.abandonBlock(block, src, clientName);

  if (errorIndex < nodes.length) {
    LOG.info("Excluding datanode " + nodes[errorIndex]);
    excludedNodes.add(nodes[errorIndex]);
  }

  // Connection failed. Let's wait a little bit and retry
  retry = true;
}

여기서 이해해야 할 핵심은 네임 노드는 블록을 저장할 데이터 노드 목록 만 제공한다는 것입니다. 네임 노드는 데이터 노드에 데이터를 쓰지 않습니다. DFSOutputStream을 사용하여 데이터 노드에 데이터를 쓰는 것은 클라이언트의 임무입니다. 쓰기를 시작하기 전에 클라이언트가 데이터 노드와 통신 할 수 있는지 확인하고 데이터 노드와의 통신이 실패하면 데이터 노드가 excludedNodes에 추가됩니다.


다음을보십시오 :

이 예외 (1 개가 아닌 0 개 노드에만 복제 될 수 있음)를 확인하면 Name Node에 데이터 노드를 사용할 수 없습니다.

다음은 이름 노드에 데이터 노드를 사용할 수없는 경우입니다.

  1. 데이터 노드 디스크가 가득 참

  2. 데이터 노드가 블록 보고서 및 블록 스캔으로 사용 중입니다.

  3. Block Size가 음수 인 경우 (hdfs-site.xml의 dfs.block.size)

  4. 쓰기가 진행되는 동안 기본 데이터 노드가 다운됩니다 (이름 노드 및 데이터 노드 시스템과 관련된 모든 n / w 변동)

  5. 부분 청크를 추가하고 후속 부분 청크를 추가하기 위해 sync를 호출하면 클라이언트는 이전 데이터를 버퍼에 저장해야합니다.

예를 들어 "a"를 추가 한 후 sync를 호출했고 추가하려고 할 때 버퍼에 "ab"가 있어야합니다.

그리고 청크가 512의 배수가 아닐 때 서버 측에서는 블록 파일에있는 데이터와 메타 파일에있는 crc에 대해 Crc 비교를 시도합니다. 그러나 블록에 존재하는 데이터에 대한 crc를 구성하는 동안 항상 초기 Offeset까지 비교하거나 자세한 분석을 위해 데이터 노드 로그를 참조하십시오

참조 : http://www.mail-archive.com/hdfs-user@hadoop.apache.org/msg01374.html


단일 노드 클러스터를 설정하는 데 비슷한 문제가 있습니다. 나는 어떤 데이터 노드도 구성하지 않았다는 것을 깨달았습니다. 내 호스트 이름을 conf / slaves에 추가 한 다음 해결되었습니다. 도움이 되었기를 바랍니다.


내 설정 및 솔루션을 설명하려고합니다. 내 설정 : RHEL 7, hadoop-2.7.3

먼저 독립 실행 형 작업 을 설정 한 다음 후자가 동일한 문제로 실패한 의사 분산 작업 을 설정하려고 했습니다.

비록 내가 hadoop을 시작할 때 :

sbin/start-dfs.sh

나는 다음을 얻었다 :

Starting namenodes on [localhost]
localhost: starting namenode, logging to /home/<user>/hadoop-2.7.3/logs/hadoop-<user>-namenode-localhost.localdomain.out
localhost: starting datanode, logging to /home/<user>/hadoop-2.7.3/logs/hadoop-<user>-datanode-localhost.localdomain.out
Starting secondary namenodes [0.0.0.0]
0.0.0.0: starting secondarynamenode, logging to /home/<user>/hadoop-2.7.3/logs/hadoop-<user>-secondarynamenode-localhost.localdomain.out

유망 해 보이지만 (실패없이 시작하는 datanode ..)-하지만 데이터 노드는 실제로 존재하지 않았습니다.

또 다른 표시는 작동중인 데이터 노드가 없음을 확인하는 것입니다 (아래 스냅 샷은 고정 된 작업 상태를 보여줍니다).

enter image description here

다음을 수행하여이 문제를 해결했습니다.

rm -rf /tmp/hadoop-<user>/dfs/name
rm -rf /tmp/hadoop-<user>/dfs/data

그런 다음 다시 시작하십시오.

sbin/start-dfs.sh
...

I had the same error on MacOS X 10.7 (hadoop-0.20.2-cdh3u0) due to data node not starting.
start-all.sh produced following output:

starting namenode, logging to /java/hadoop-0.20.2-cdh3u0/logs/...
localhost: ssh: connect to host localhost port 22: Connection refused
localhost: ssh: connect to host localhost port 22: Connection refused
starting jobtracker, logging to /java/hadoop-0.20.2-cdh3u0/logs/...
localhost: ssh: connect to host localhost port 22: Connection refused

After enabling ssh login via System Preferences -> Sharing -> Remote Login it started to work.
start-all.sh output changed to following (note start of datanode):

starting namenode, logging to /java/hadoop-0.20.2-cdh3u0/logs/...
Password:
localhost: starting datanode, logging to /java/hadoop-0.20.2-cdh3u0/logs/...
Password:
localhost: starting secondarynamenode, logging to /java/hadoop-0.20.2-cdh3u0/logs/...
starting jobtracker, logging to /java/hadoop-0.20.2-cdh3u0/logs/...
Password:
localhost: starting tasktracker, logging to /java/hadoop-0.20.2-cdh3u0/logs/...

And I think you should make sure all the datanodes are up when you do copy to dfs. In some case, it takes a while. I think that's why the solution 'checking the health status' works, because you go to the health status webpage and wait for everything up, my five cents.


It take me a week to figure out the problem in my situation.

When the client(your program) ask the nameNode for data operation, the nameNode picks up a dataNode and navigate the client to it, by giving the dataNode's ip to the client.

But, when the dataNode host is configured to has multiple ip, and the nameNode gives you the one your client CAN'T ACCESS TO, the client would add the dataNode to exclude list and ask the nameNode for a new one, and finally all dataNode are excluded, you get this error.

So check node's ip settings before you try everything!!!


If all data nodes are running, one more thing to check whether the HDFS has enough space for your data. I can upload a small file but failed to upload a big file (30GB) to HDFS. 'bin/hdfs dfsadmin -report' shows that each data node only has a few GB available.


Have you tried the recommend from the wiki http://wiki.apache.org/hadoop/HowToSetupYourDevelopmentEnvironment ?

I was getting this error when putting data into the dfs. The solution is strange and probably inconsistent: I erased all temporary data along with the namenode, reformatted the namenode, started everything up, and visited my "cluster's" dfs health page (http://your_host:50070/dfshealth.jsp). The last step, visiting the health page, is the only way I can get around the error. Once I've visited the page, putting and getting files in and out of the dfs works great!


Reformatting the node is not the solution. You will have to edit the start-all.sh. Start the dfs, wait for it to start completely and then start mapred. You can do this using a sleep. Waiting for 1 second worked for me. See the complete solution here http://sonalgoyal.blogspot.com/2009/06/hadoop-on-ubuntu.html.


I realize I'm a little late to the party, but I wanted to post this for future visitors of this page. I was having a very similar problem when I was copying files from local to hdfs and reformatting the namenode did not fix the problem for me. It turned out that my namenode logs had the following error message:

2012-07-11 03:55:43,479 ERROR org.apache.hadoop.hdfs.server.datanode.DataNode: DatanodeRegistration(127.0.0.1:50010, storageID=DS-920118459-192.168.3.229-50010-1341506209533, infoPort=50075, ipcPort=50020):DataXceiver java.io.IOException: Too many open files
        at java.io.UnixFileSystem.createFileExclusively(Native Method)
        at java.io.File.createNewFile(File.java:883)
        at org.apache.hadoop.hdfs.server.datanode.FSDataset$FSVolume.createTmpFile(FSDataset.java:491)
        at org.apache.hadoop.hdfs.server.datanode.FSDataset$FSVolume.createTmpFile(FSDataset.java:462)
        at org.apache.hadoop.hdfs.server.datanode.FSDataset.createTmpFile(FSDataset.java:1628)
        at org.apache.hadoop.hdfs.server.datanode.FSDataset.writeToBlock(FSDataset.java:1514)
        at org.apache.hadoop.hdfs.server.datanode.BlockReceiver.<init>(BlockReceiver.java:113)
        at org.apache.hadoop.hdfs.server.datanode.DataXceiver.writeBlock(DataXceiver.java:381)
        at org.apache.hadoop.hdfs.server.datanode.DataXceiver.run(DataXceiver.java:171)

Apparently, this is a relatively common problem on hadoop clusters and Cloudera suggests increasing the nofile and epoll limits (if on kernel 2.6.27) to work around it. The tricky thing is that setting nofile and epoll limits is highly system dependent. My Ubuntu 10.04 server required a slightly different configuration for this to work properly, so you may need to alter your approach accordingly.


I have also had the same problem/ error. The problem occurred in the first place when I formatted using hadoop namenode -format

So after re - starting hadoop using, start-all.sh, the data node did not start or initialize. You can check this using jps, there should be five entries. If datanode is missing, then you can do this:

Datanode process not running in Hadoop

Hope this helps.


Don't format the name node immediately. Try stop-all.sh and start it using start-all.sh. If the problem persists, go for formatting the name node.


Follow the below steps:
1. Stop dfs and yarn.
2. Remove datanode and namenode directories as specified in the core-site.xml.
3. Start dfs and yarn as follows:

start-dfs.sh
start-yarn.sh
mr-jobhistory-daemon.sh start historyserver

It's about SELINUX. In My cases, CentOS 6.5

All node(name, second, data....)

service iptables stop

참고URL : https://stackoverflow.com/questions/5293446/hdfs-error-could-only-be-replicated-to-0-nodes-instead-of-1

반응형