0% found this document useful (0 votes)
42 views7 pages

Than Error Will Generate: Access Denied: Practice 26:09:2016 Scoop Import Mrinomy@ubuntu (Terminal)

The document discusses using Sqoop to import data from a MySQL database table into HDFS. It provides examples of Sqoop import commands to import the emp table from the week24 database into HDFS, specifying options like number of mappers, target directory, field terminator, columns to import, and import condition. It also shows how to compress the imported data using gzip, snappy, or sequence file compression codecs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views7 pages

Than Error Will Generate: Access Denied: Practice 26:09:2016 Scoop Import Mrinomy@ubuntu (Terminal)

The document discusses using Sqoop to import data from a MySQL database table into HDFS. It provides examples of Sqoop import commands to import the emp table from the week24 database into HDFS, specifying options like number of mappers, target directory, field terminator, columns to import, and import condition. It also shows how to compress the imported data using gzip, snappy, or sequence file compression codecs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Practice 26:09:2016

Scoop
Import
mrinomy@ubuntu(terminal)

Than error will generate : Access denied

root@ubuntu (terminal)
In mysql we have to write the query:

% = For all user we can give access

= for all non-database user

IMPORT COMMAND:-

root@ubuntu: /home# sqoop import --connect jdbc:mysql://localhost/week24 --table


emp
m 1 --target-dir /import24;

In browser we can check that mysql emp data is store in HDFS

root@ubuntu: /home# sqoop import --connect jdbc:mysql://localhost/week24 --table


emp
m 1 --target-dir /import24for --fields-terminatedby \t;

root@ubuntu: /home# sqoop import --connect jdbc:mysql://localhost/week24 --table


emp
m 1 --target-dir /import24Col1 --fieldsterminated-by | --columns ename,esal;

root@ubuntu: /home# sqoop import --connect jdbc:mysql://localhost/week24 --table


emp
m 1 --target-dir /import24Cond --fieldsterminated-by | --where esal>200000;

root@ubuntu: /home# sqoop import --connect jdbc:mysql://localhost/week24 --table


emp
m 1 --target-dir /import24Cond --fields-

terminated-by

| --where esal>25000;

How to compress data while importing :


root@ubuntu: /home# sqoop import --connect jdbc:mysql://localhost/week24 --table
emp
--compression-codec GzipCodec m 1 --target-dir
/Gzipfile24;

root@ubuntu: /home# sqoop import --connect jdbc:mysql://localhost/week24 --table


emp
--compression-codec SnappyCodec m 1 --targetdir /Snappyfile24;

root@ubuntu: /home# sqoop import --connect jdbc:mysql://localhost/week24 --table


emp
emp --as-sequencefile m 1 --target-dir /sequencefile;

You might also like