SQOOP | Hadoop Tutorial pdf

SQOOP:

SQOOP is used for exporting and importing data from database to HDFS.

Connect to MySQL database
$mysql -u root -p
Enter password:
mysql>CREATE DATABASE hadoopdb;
mysql>SHOW DATABASES;
Database
hadoopdb
mysql>USE hadoopdb;
mysql>grant all privileges on hadoopdb.* to '%'@'localhost';
mysql>CREATE TABLE yashTable(id INT, name VARCHAR(64), salary INT);
mysql>INSERT INTO yashTable(111, 'ABC', 9000);
mysql>INSERT INTO yashTable(111, 'XYZ', 10000);
mysql>INSERT INTO yashTable(111, 'IJK', 11000);
mysql>describe yashTable;

Import Command:
$ Sqoop import --connect jdbc:mysql://localhost/hadoopdb \ -- table yashTable -m 1;

Export Command
$ sqoop export -- connect jdbc:mysql://localhost/hadoopdb -m 1 \ --table yashTable --export-dir /user/yash/yashTable/part-m-00000;

4 comments:

  1. Thanks for sharing this information with us.........
    if any one want Recorded videos of ( hadoop + java + j2ee ) with Life Time Access at $20 or Rs.1000/- please go with following details.
    http://www.hadooponlinetutor.com/
    contact : 732-419-2619 ( USA) , 8121660044 ( India )

    ReplyDelete
  2. Waw, Thanks admin to share two important Sqoop Interview questions with examples. Not only import and export, but also it can query sql commands in RDBMS. and directly create, import to hive, hbase. and many more.
    Thanks to share and request pls share more often.

    ReplyDelete
  3. hi .. i m trying to use sqoop command ...but it says sqoop command not found any update on this?

    ReplyDelete