Install SQOOP in the node from where you want to connect

#rpm -ivh /sqoop-1.4.2_2_0_1_0-nn.noarch.rpm

Check the conenctivity  to remote database server.

#psql -h 192.167.2.3 -p 10432 -U user1 -d db1 -W

If the above works try listing the database using sqoop

[root@server sqoop]# sqoop list-databases –connect jdbc:postgresql://192.167.2.3:10432 –username user1 -P

Enter password:
13/11/05 04:38:50 INFO manager.SqlManager: Using default fetchSize of 1000
template1
template0
postgres
metastore

If the listing is scucessfull go for the import

#sqoop import –connect jdbc:postgresql://192.167.2.3:10432/metastore –username user1 -P –table TBLS –as-textfile –target-dir /user/user1/sqoop1
Enter password:

We can copy the JDBC drivers to sqoop lib for connectivity.

#cp postgresql-8.2-1002.jdbc4.jar /usr/lib/sqoop/lib

 

Advertisements