Saturday, October 5, 2013

Sqoop

Sqoop

Installation:

For Installation of Sqoop, MySql and Export and Import:
Problems faced:
Prob 1: SQOOP issue on multi-node cluster (13/12/06 15:05:11 ERROR manager.SqlManager: Error executing statement: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure)
Solution: First run mysql --host=localhost --database=test --user=root --password=password to check if you are able to connect to SQL and replace server name with localhost.

If you want to use server name or IP address instead of local host, please follow the below instructions.

Look for the bind-address setting in my.cnf on the server, and make sure it's listening on the IP address you're targetting. You may also need to ensure skip-networking isn't switched on!
Alternatively (and less securely!) the following will set it up to listen on all addresses - local and remote:
bind-address = 0.0.0.0
 
It means replace bind-address = 127.0.0.1 with bind-address = 0.0.0.0 in my.cnf file.
my.cnf file is available at /etc/mysql folder. Please restart your mysql server 
before you try to use ip address or machine name.
 
Post bind-address change, please execute the below queries to provide permission
to user of all nodes 

GRANT ALL ON test.* to ''@'master';
GRANT ALL ON test.* to ''@'slave1';
GRANT ALL ON test.* to ''@'slave2'; 
(... and more if there are more slaves)

Sqoop Commands


sqoop import --connect jdbc:mysql://localhost/test --table mytest -m 1
sqoop import --connect jdbc:mysql://ipaddress/test --table mytest -m 1
sqoop import --connect jdbc:mysql://ipaddress/test --table mytest --append -m 1 
sqoop import --connect jdbc:mysql://master/test --table mytest --append -m 1 

No comments:

Post a Comment