Sqoop can import/export data from Database, like mysql, sql server, etc.
Acturally, the installation is quite easy.
You can get Sqoop from http://sqoop.apache.org. Compatible Sqoop version is needed to match you Hadoop version.
$ wget http://apache.fayea.com/sqoop/1.4.6/sqoop-1.4.6.bin__hadoop-2.0.4-alpha.tar.gz
$ tar -xvf sqoop-1.4.6.bin__hadoop-2.0.4-alpha.tar.gz
Just set environment variable, that’s all.
Edit /etc/profile
, root user is needed.
export SQOOP_HOME=/home/userName/sqoop-1.4.6.bin__hadoop-2.0.4-alpha
export PATH = $SQOOP_HOME/bin:$PATH
After edit
$ source /etc/profile
This quickstart demonstrates how to import data from teiid to HDFS by Sqoop.
NOTE: This example relies upon the vdb-datafederation example and that it needs to be deployed prior to running this example. Therefore, read the vdb-datafederation’s README.md and follow its directions before continuing.
You need download Teiid JDBC Driver from http://teiid.jboss.org/downloads/ and copy it to $SQOOP_HOME/lib
cp teiid-9.0.0.Final-jdbc.jar $SQOOP_HOME/lib
$ sqoop import --connect jdbc:teiid:Portfolio@mm://127.0.0.1:31000 --driver org.teiid.jdbc.TeiidDriver --username odataUser --password password1! --table product
Now, you can verify that whether the data from VDB is imported to HDFS.
$ hadoop dfs -ls /user/username/product
$ hadoop dfs -get /user/username/product ./result
$ cat result/part-m-*