Apache Sqoop
Sqoop is a tool to transfer data between Hadoop (HDFS) and relational database. It uses extensive framework (Map Reduce) to export/import data. Sqoop connector is modular component that use this framework to enable import and export. Sqoop has build-in connector for working with range of databases such as Oracle,MySQL, SQL Server, DB2,PostgreSQL Additional third party connectors are also available and can be imported.
Prerequisites
Hadoop is already installed with on standalone or cluster mode. If not, please configure it using article.
Steps for Installation
Today, we will install Sqoop version 1.4.6, but you can install the latest version. Steps will be the same.
Download Sqoop
You can either download sqoop using url or use wget command as shown below.
hduser@pooja:~$wget http://www.gtlib.gatech.edu/pub/apache/sqoop/1.4.6/sqoop-1.4.6.bin__hadoop-2.0.4-alpha.tar.gz
Untar the file
hduser@pooja:~$ tar xvf sqoop-1.4.6.bin__hadoop-2.0.4-alpha.tar.gz
Create soft link
hduser@pooja:~$ ln -s sqoop-1.4.6.bin__hadoop-2.0.4-alpha sqoop
Verify if soft link created
hduser@pooja:~$ ls -ltr sqoop
hduser@pooja:~$wget http://www.gtlib.gatech.edu/pub/apache/sqoop/1.4.6/sqoop-1.4.6.bin__hadoop-2.0.4-alpha.tar.gz
Untar the file
hduser@pooja:~$ tar xvf sqoop-1.4.6.bin__hadoop-2.0.4-alpha.tar.gz
Create soft link
hduser@pooja:~$ ln -s sqoop-1.4.6.bin__hadoop-2.0.4-alpha sqoop
hduser@pooja:~$ ls -ltr sqoop
Changes to config file
Edit .bashrc or .bash_profile and add below line
export SQOOP_HOME=/home/hduser/sqoop
export PATH=$PATH:$SQOOP_HOME/bin
Reload .bashrc or .bash_profile to set the sqoop property in current session.
hduser@pooja:~$ source .bashrc
Verify Sqoop Installation
hduser@pooja:~$ sqoop version
Warning: /home/hduser/sqoop/../hbase does not exist! HBase imports will fail.
Please set $HBASE_HOME to the root of your HBase installation.
Warning: /home/hduser/sqoop/../hcatalog does not exist! HCatalog jobs will fail.
Please set $HCAT_HOME to the root of your HCatalog installation.
Warning: /home/hduser/sqoop/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
Warning: /home/hduser/sqoop/../zookeeper does not exist! Accumulo imports will fail.
Please set $ZOOKEEPER_HOME to the root of your Zookeeper installation.
17/09/05 13:39:18 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6
Sqoop 1.4.6
git commit id c0c5a81723759fa575844a0a1eae8f510fa32c25
Compiled by root on Mon Apr 27 14:38:36 CST 2015
Problem when running SQOOP
When i ran the sqoop version, I got the below error.
hduser@pooja:~$ sqoop version
Warning: /home/hduser/sqoop/../hbase does not exist! HBase imports will fail.
Please set $HBASE_HOME to the root of your HBase installation.
Warning: /home/hduser/sqoop/../hcatalog does not exist! HCatalog jobs will fail.
Please set $HCAT_HOME to the root of your HCatalog installation.
Warning: /home/hduser/sqoop/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
Warning: /home/hduser/sqoop/../zookeeper does not exist! Accumulo imports will fail.
Please set $ZOOKEEPER_HOME to the root of your Zookeeper installation.
Error: Could not find or load main class org.apache.sqoop.Sqoop
Make sure you have downloaded the right version sqoop-hadoop tar file and not just sqoop tar file.
If you are still facing issues, I love to help you.
Happy Coding!!!!
export SQOOP_HOME=/home/hduser/sqoop
export PATH=$PATH:$SQOOP_HOME/bin
Reload .bashrc or .bash_profile to set the sqoop property in current session.
hduser@pooja:~$ source .bashrc
Verify Sqoop Installation
hduser@pooja:~$ sqoop version
Warning: /home/hduser/sqoop/../hbase does not exist! HBase imports will fail.
Please set $HBASE_HOME to the root of your HBase installation.
Warning: /home/hduser/sqoop/../hcatalog does not exist! HCatalog jobs will fail.
Please set $HCAT_HOME to the root of your HCatalog installation.
Warning: /home/hduser/sqoop/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
Warning: /home/hduser/sqoop/../zookeeper does not exist! Accumulo imports will fail.
Please set $ZOOKEEPER_HOME to the root of your Zookeeper installation.
17/09/05 13:39:18 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6
Sqoop 1.4.6
git commit id c0c5a81723759fa575844a0a1eae8f510fa32c25
Compiled by root on Mon Apr 27 14:38:36 CST 2015
Problem when running SQOOP
When i ran the sqoop version, I got the below error.
hduser@pooja:~$ sqoop version
Warning: /home/hduser/sqoop/../hbase does not exist! HBase imports will fail.
Please set $HBASE_HOME to the root of your HBase installation.
Warning: /home/hduser/sqoop/../hcatalog does not exist! HCatalog jobs will fail.
Please set $HCAT_HOME to the root of your HCatalog installation.
Warning: /home/hduser/sqoop/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
Warning: /home/hduser/sqoop/../zookeeper does not exist! Accumulo imports will fail.
Please set $ZOOKEEPER_HOME to the root of your Zookeeper installation.
Error: Could not find or load main class org.apache.sqoop.Sqoop
Make sure you have downloaded the right version sqoop-hadoop tar file and not just sqoop tar file.
If you are still facing issues, I love to help you.
Happy Coding!!!!
No comments:
Post a Comment