Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hadoop hdfs formatting gets error failed for Block pool

After formatting my hdfs, I get the following errors:

2015-05-28 21:41:57,544 WARN org.apache.hadoop.hdfs.server.common.Storage: java.io.IOException: Incompatible clusterIDs in /usr/local/hadoop/dfs/datanode: namenode clusterID = CID-e77ee39a-ab4a-4de1-b1a4-9d4da78b83e8; datanode clusterID = CID-6c250e90-658c-4363-9346-972330ff8bf9
2015-05-28 21:41:57,545 FATAL org.apache.hadoop.hdfs.server.datanode.DataNode: Initialization failed for Block pool <registering> (Datanode Uuid unassigned) service to localhost/127.0.0.1:9000. Exiting. 
java.io.IOException: All specified directories are failed to load.
    at.. org.apache.hadoop.hdfs.server.datanode.DataStorage.recoverTransitionRead(DataStorage.java:477)
    at org.apache.hadoop.hdfs.server.datanode.DataNode.initStorage(DataNode.java:1387)
    at org.apache.hadoop.hdfs.server.datanode.DataNode.initBlockPool(DataNode.java:1352)
    at org.apache.hadoop.hdfs.server.datanode.BPOfferService.verifyAndSetNamespaceInfo(BPOfferService.java:316)
    at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.connectToNNAndHandshake(BPServiceActor.java:228)
    at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.run(BPServiceActor.java:852)
    at java.lang.Thread.run(Thread.java:745)
...blah...
SHUTDOWN_MSG: 
/************************************************************
SHUTDOWN_MSG: Shutting down DataNode at der-Inspiron-3521/127.0.1.1
************************************************************/

Here are the steps that I did:

 sbin/stop-dfs.sh
 hdfs namenode -format
 sbin/start-dfs.sh

For your information: my core-site.xml has the temp dir as follows:

<property>
      <name>hadoop.tmp.dir</name>
     <value>/usr/local/hadoop</value>
      <description>A base for other temporary directories.    
</description>
 </property>

and my hdfs-site.xml as the namenode and datanode as follows:

 <property>
     <name>dfs.namenode.name.dir</name>  
     <value>file:/usr/local/hadoop/dfs/namenode</value>
  </property>



 <property> 
        <name>dfs.datanode.data.dir</name>
        <value>file:/usr/local/hadoop/dfs/datanode</value>
    </property>

Update: I have gotten a bit further with the issue but still I am getting the same type of error. I was able to run the hdfs dfs -format and change the version as advised. After that I used the hdfs dfs -ls and hdfs dfs -mkdir to create /user/der wher der is my log in name. However when I ran the my pig file, I take mkDirs and chmod errors in my pig file. Here are the permissions for my datanode and namenode:

drwx------ 3 der  der  4096 May 29 08:13 datanode
drwxrwxrwx 4 root root 4096 May 28 11:34 name
drwxrwxr-x 3 der  der  4096 May 29 08:13 namenode
drwxrwxr-x 3 der  der  4096 May 29 08:13 namesecondary
drwxr-xr-x 2 root root 4096 May 28 11:46 ww

It seems datanode only has permissions for owner and group but not user.

Here is my pig script error:

2015-05-29 08:37:27,152 [JobControl] INFO  org.apache.hadoop.mapreduce.lib.jobcontrol.ControlledJob - PigLatin:totalmiles.pig got an error while submitting 
ENOENT: No such file or directory
    at org.apache.hadoop.io.nativeio.NativeIO$POSIX.chmodImpl(Native Method)
    at org.apache.hadoop.io.nativeio.NativeIO$POSIX.chmod(NativeIO.java:230)
    at org.apache.hadoop.fs.RawLocalFileSystem.setPermission(RawLocalFileSystem.java:724)
    at org.apache.hadoop.fs.FilterFileSystem.setPermission(FilterFileSystem.java:502)
    at org.apache.hadoop.fs.FileSystem.mkdirs(FileSystem.java:600)
    at org.apache.hadoop.mapreduce.JobResourceUploader.uploadFiles(JobResourceUploader.java:94)
    at org.apache.hadoop.mapreduce.JobSubmitter.copyAndConfigureFiles(JobSubmitter.java:98)
    at org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter.java:193)
    at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1290)
    at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1287)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:415)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1657)
    at org.apache.hadoop.mapreduce.Job.submit(Job.java:1287)
    at org.apache.hadoop.mapreduce.lib.jobcontrol.ControlledJob.submit(ControlledJob.java:335)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl

Here is my pig script:

records = LOAD '1987.csv' USING PigStorage(',') AS
        (Year, Month, DayofMonth, DayOfWeek, 
         DepTime, CRSDepTime, ArrTime, CRSArrTime, 
         UniqueCarrier, FlightNum, TailNum,ActualElapsedTime,
         CRSElapsedTime,AirTime,ArrDelay, DepDelay, 
         Origin, Dest,  Distance:int, TaxIn, 
         TaxiOut, Cancelled,CancellationCode,  Diverted, 
         CarrierDelay, WeatherDelay, NASDelay, SecurityDelay,
         lateAircraftDelay);
milage_recs= GROUP records ALL;
tot_miles = FOREACH milage_recs GENERATE SUM(records.Distance);
STORE tot_miles INTO 'totalmiles4';

Update: By the way I used chmod go+rw on datanode (after I stopped the namenode server and datanode server). That did not work as well.


Update May 30: A bit more details. I changed the parent directory of the pig script in my pig script to this:

records = LOAD '/user/der/1987.csv' USING PigStorage(',') AS

I have the same error. On the client side, here's the error. The only difference is that there is not hdfs:// prefix to the failed input read.

Failed to read data from "/user/der/1987.csv"

Output(s):
Failed to produce result in "hdfs://localhost:9000/user/der/totalmiles4"

On the server side here is the namenode log just at the moment I get the invalid file request from my pig script. The log (using tail -f) scrolled. This indicates that the server is accepting request for the pig command.

          2015-05-30 07:01:28,140 INFO BlockStateChange: BLOCK* addStoredBlock: blockMap updated: 127.0.0.1:50010 is added to 
        blk_1073741885_1061{UCState=UNDER_CONSTRUCTION, 
    truncateBlock=null,
 primaryNodeIndex=-1, replicas=[ReplicaUC[[DISK]DS-c84e0e37-2726-44da-af3e-67167c1010d1:NORMAL:127.0.0.1:50010|RBW]]}
     size 0

            2015-05-30 07:01:28,148 INFO org.apache.hadoop.hdfs.StateChange: DIR* completeFile:
     /tmp/temp-11418443/tmp85697770/automaton-1.11-8.jar 
is closed by DFSClient_NONMAPREDUCE_-1939565577_1

I am just have to get the source code of the pig script and check the extact hdfs commands it issues. I think there is someone wrong with the hadoop hdfs services that I configured.

like image 579
Derek Lac Avatar asked May 29 '15 05:05

Derek Lac


2 Answers

The same problem happened to me. I deleted the contents of data directory and then ran hdfs datanode. This created the VERSION and other files inside the datanode directory. This solved my problem.

like image 61
sabarish Avatar answered Nov 19 '22 17:11

sabarish


2015-05-28 21:41:57,544 WARN org.apache.hadoop.hdfs.server.common.Storage: java.io.IOException: Incompatible clusterIDs in /usr/local/hadoop/dfs/datanode: namenode clusterID = CID-e77ee39a-ab4a-4de1-b1a4-9d4da78b83e8; datanode clusterID = CID-6c250e90-658c-4363-9346-972330ff8bf9

Your namenode and datanode cluster ID does not match.

Open your usr/local/hadoop/dfs/datanode/current/VERSION file and change:

clusterID=CID-6c250e90-658c-4363-9346-972330ff8bf9

to

clusterID=CID-e77ee39a-ab4a-4de1-b1a4-9d4da78b83e8

NOTE: Whenever you format your namenode, check the VERSION file of namenode and datanode. They both should have same clusterID and namespaceID. Otherwise your datanode, won't start.

like image 20
Rajesh N Avatar answered Nov 19 '22 16:11

Rajesh N