Documente Academic
Documente Profesional
Documente Cultură
Sqoop Import
First connection is set up to the Database server to pull desired metadata info
from the input table we are using.
Then it executes a Mapreduce job on Hadoop cluster. Sqoop will use
metadata to perform actual import.
Modify Delimiters
--fields-terminated-by ,
--lines-terminated-by ,
--escaped-by \\
--enclosed-by \
Different file formats
--create job_name
--delete job_name
--exec job_name
--show job_name Show parameters
--list List of all saved jobs
Importing data in Hbase
Prerequisites:-
Hbase cluster up in running
HBASE_HOME environment variable is set
For importing a Primary key table
bin/sqoop import connect jdbc:mysql://url username name password pwd
table name hbase-table hbase_name column-family hbase_table_col1
hbase-create-table
For importing a non-primary key table
bin/sqoop import connect jdbc:mysql://url username name password pwd
table name hbase-table hbase_name column-family hbase_table_col1
hbase-row-key col_name hbase-create-table
Importing database in HIVE
Prerequisites:-
HIVE installed
HIVE_HOME environment variable is set
Importing primary key table
bin/sqoop import connect jdbc:mysql://url username name password pwd
table name hive-table name create-hive-table hive-import hive-home
path/to/hive/home
Importing non-primary key table
bin/sqoop import connect jdbc:mysql://url username name password pwd
table name hive-table name create-hive-table hive-import hive-home
path/to/hive/home split-by col_name
Getting HDFS data into HIVE
Basic command:
Bin/sqoop export connect location table name username name password
pwd export-dir /location
--input-fields-terminated-by,
--input-lines-terminated-by,
How export works