Sqoop Best Practices

Below are some of the learning's which i thought to jot down for quick reference in the future also. These are lessons which i learnt while working in real world.
Just quick notes of things to remember and ask yourself
  • Are we sqooping from View or Table ?  Does your connector support view import?
  • Setup correct Sqoop Connector
    • Teradata connector
    • Oracle Connector
  • Are you importing direct to Hive then remember to use –hive-delims-drop option if your data contains default Hive delims , as this may break your Hive Table and give wrong row count if you use default options in Hive
  • Do a sample schema check of the table you are going to import. Check the fields which can be good candidate for split column. Generally primary keys are good enough. See by random sampling that records are balanced.
  • Decide on mappers count to use while Sqooping , default Sqoop use 4. You can increase it after talking to your DBA. Don’t make it too much keep it around 10 to not to overwhelm the database
  • Check the order of fields which Sqoop dumps , this is important for Teradata tables which gives two different order depending upon if your do plain select * or you do select * order by column id. If you are directly dumping to Hive then this would be taken care as Sqoop can create table for you. You can also give column order within the Sqoop command , it all depends on you how you want to do.
  • After Sqoop job is done remember to see Map Output Record count for the Job output. Match it with the count of rows in the database. Then at second instance match it with count of hive count if you are importing to hive. If you are not using hive then use wc function to find number of lines in output
  • Do a query in source database from where you imported to have count of records , compare it with what you have got in Hadoop after import.
  • Sample 10 records from source database , and also do the same from Hadoop. Compare the format of fields. Check for any white spaces or anything mismatching between the two
  • Ask from data users what is the preference for null values. Sqoop provides two parameters which you can use to tell to sqoop what to do for null values --null-string and --null-non-string. Read more about it and remember to use that.. If you are planning to use data with Hive and want to have hive friendly null value then for your reference hive uses \N to represent null. Read my blog post on null behavior for hive and Sqoop for more details.

Most importantly , document all what i have said. Keep a log of all of the things above. Form a Standard Operating Procedure around the steps mentioned above for your organization so that all follow the steps.
How about sharing your best practices ?
To be Updated
Also adding up details of each step with example

Manually Archive folder in Outlook 2010

Go to

File > MailBox Clean up > Archive

Select option

Archive all folders and sub folders

Specify the date older to which you want to Archive

Click Ok

The Job will start in background and you can see its progress in Outlook status bar

 

 

 

 

Hadoop on AIX

After hours of juggling with my effort to install Hadoop (CDH4) on AIX i concluded that it cannot be done easily. (I know some other flavors say they can)

Sorry for you , if you came after Google search in hope to find something.

I talked with Cloudera also and they said NO :(

My situation was that i wanted to install Hadoop Client on AIX system so that data can be sent from AIX to Hadoop cluster using simple Hadoop put commands.

I installed Java ( IBM JDK 1.6 on the AIX system)

Downloaded the CDH4 tar ball onto system

Set the environment variables

And when i did

$hadoop fs –ls /

I got message as

ls : failure to login

First i thought that its due to fact that hdfs is not allowing me to login to cluster , so i created the user with same name by which i was logged into AIX into Hadoop cluster.

After that also i got the same error.

I thought to ask Cloudera as the current Client had enterprise support :) and i raised query with them

They said IBM JDK don't support some Hadoop specific login mechanism and hence we cannot install Hadoop Client onto AIX

So my next job is to introduce design change and see how to get data inside cluster from AIX machine

  • WebHDFS
  • HttpFS
  • NFSProxy

The above are some of the options which i can propose for the client.

What are your experiences in installing Hadoop on AIX , please do share.

Thanks for reading :)

no libsvnjavahl-1 in java.library.path Eclipse SVN error

no libsvnjavahl-1 in java.library.path Eclipse SVN error

Fix

Go to

Windows > Preferences > Team > SVN 

SVN Interface

Select SVNKit

Number of cores in Hadoop cluster

Recently while working for one of the customer we had issues with number of cores shown in the cluster was 2 per each node.

$ cat /proc/cpuinfo

Whereas the processor of the system was Intel Xeon E5620 , it should have 4 cores and 8 threads.

After analysis we found that the number of cores were wrongly shown as apci was turned off in all the nodes

/etc/grub.conf

Changing apci=ht in all 12 nodes

Made Redhat to detect all the threads in the system since it was stopped earlier.

This made the Hadoop cluster to perform like anything , it processed lot lot better and customer was happy. Not sure who was at fault , why this was off earlier. I found it and we fixed it that’s the happy part.

How do you handle your installations so that you avoid such kids of errors?

Just after that I modified the Hadoop map tasks and reduce tasks . The first performance tuning step which we all do


Oozie Operation category READ is not supported in state standby

Oozie gave error as

Problem

Error: E0501 : E0501: Could not perform authorization operation, Operation category READ is not supported in state standby at org.apache.hadoop.hdfs.server.namenode.ha.StandbyState.checkOperation(StandbyState.java:87) at org.apache.hadoop.hdfs.server.namenode.NameNode$NameNodeHAContext.checkOperation(NameNode.java:1375) at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.checkOperation(FSNamesystem.java:717) at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getFileInfo(FSNamesystem.java:2565) at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.getFileInfo(NameNodeRpcServer.java:663) at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.getFileInfo(ClientNamenodeProtocolServerSideTranslatorPB.java:624) at org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java:42648) at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:427) at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:916) at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1692) at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1688) 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:1232) at org.apache.hadoop.ipc.Server$Handler.run(Server.java:1686)

Solution

It means that the Namenode to which Oozie is trying to connect is on Standby Mode

Open job.properties

See the Namenode value double verify that this Namenode is active one

Also check oozie.log to verify that oozie is reading correct Namenode value

In HA mode the

namenode URL should point to nameservice

e,g

namenodeURL=hdfs://nameserviceName

Inside your job properties

Fuse mount on HA (High Availability) cluster

If you need to know about how to install Fuse Mount on Cluster then you can go to link mentioned below.

This post is more of Fuse mount in HA mode cluster

The instructions on the Cloudera page explains the installation steps for Fuse mount


If you read line

hadoop-fuse-dfs dfs://<name_node_hostname>:<namenode_port> <mount_point>

The above

dfs://NamenodeAddress:Port

Type of configuration cannot be done if that the Cluster is in High Availability Cluster (HA) Mode. This is due to expectations for URI in specific format with IP and port , which cannot be used if the cluster is in HA mode as we use nameservice name

There is one Jira which would resolve this