----------for database connect--------
mysql -u root -pcloudera
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>>sqoop import --connect jdbc://localhost/retail_db --username root --password cloudera --table customers --target-dir /data/sqoop/test01
>>sqoop import --connect jdbc:mysql://localhost/retail_db --username root --password cloudera --table customers --target-dir /data/sqoop/test02 -m 10
>>sqoop import --connect jdbc:mysql://localhost/retail_db --username root --password cloudera --table customers --target-dir /data/sqoop/test03 --split-by customer_id --fields-terminated-by '|' -m 10
>>sqoop list-databases --connect jdbc:mysql://localhost/retail_db --username root --password cloudera
>>sqoop list-tables --connect jdbc:mysql://localhost/retail_db --username root --password cloudera
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
sqoop import --connect jdbc:mysql://localhost/retail_db --username root --password cloudera --table customers --split-by customer_id --fields-terminated-by '|' -m 10 --hive-import --create-hive-table --hive-table veer.customers2
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
My job,export,dynamic partition...
create table customer5 (customer_id int , customer_fname varchar , customer_lname varchar,
customer_email varchar,customer_password varchar, customer_street varchar, customer_city varchar ,
customer_state varchar,customer_zipcode varchar);
hive>> create table customer_inc (customer_id int , customer_fname string , customer_lname string,
customer_email string,customer_password string, customer_street string, customer_city string ,
customer_state string ,customer_zipcode string);
sqoop import --connect jdbc:mysql://localhost/retail_db --username root --password cloudera --table customers --split-by customer_id --fields-terminated-by ',' -m 10 --hcatalog-database veer --hcatalog-table customer4;
>>>sqoop job --create import --connect jdbc:mysql://localhost/retail_db --username root --password cloudera --table customers --hive-import --hive-table customer4 --hive-partition-key customer_zipcode;
>>>
sqoop import --connect jdbc:mysql://localhost/retail_db \
--username root --password cloudera \
--hive-import \
--query "select customer_id ,customer_fname,customer_lname,customer_email,customer_password,customer_street,customer_city,customer_state from retail_db.customers where customer_zipcode='00725' and \$CONDITIONS" \
--hive-table customer4 \
--hive-partition-key customer_zipcode \
--hive-partition-value 'PR00725' \
--target-dir /user/cloudera/customer_temp \
--split-by customer_id
sqoop import --connect jdbc:mysql://localhost/retail_db \
--username root --password cloudera \
--hive-import \
--query "select * from retail_db.customers where \$CONDITIONS" \
--hive-table customer5 \
--hive-partition-key customer_zipcode \
--target-dir /user/cloudera/customer_temp \
--split-by customer_id
--table customers --where "customer_zipcode='PR00725'"
_____________________________________________________________________________________________________________________________________________________________________
create table ct1 select * from customers where 1=2;
sqoop export --connect jdbc:mysql://localhost/retail_db \
--username root --password cloudera \
--table temp \
--export-dir /user/hive/warehouse/temp
______________________________________________________________________________________________
sqoop job -create inc_upt import --connect jdbc:mysql://localhost/retail_db \
--username root --password cloudera \
--table customers \
--incremental append \
--check-column customer_id last-value 12435 \
--target-dir /data/sqoop/test02
sqoop job –create jobname –<space>import –connect jdbc:mysql://localhost/DBname –username username –password password –table tablename –incremental append –check-column colname last-value 101
mysql -u root -pcloudera
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>>sqoop import --connect jdbc://localhost/retail_db --username root --password cloudera --table customers --target-dir /data/sqoop/test01
>>sqoop import --connect jdbc:mysql://localhost/retail_db --username root --password cloudera --table customers --target-dir /data/sqoop/test02 -m 10
>>sqoop import --connect jdbc:mysql://localhost/retail_db --username root --password cloudera --table customers --target-dir /data/sqoop/test03 --split-by customer_id --fields-terminated-by '|' -m 10
>>sqoop list-databases --connect jdbc:mysql://localhost/retail_db --username root --password cloudera
>>sqoop list-tables --connect jdbc:mysql://localhost/retail_db --username root --password cloudera
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
sqoop import --connect jdbc:mysql://localhost/retail_db --username root --password cloudera --table customers --split-by customer_id --fields-terminated-by '|' -m 10 --hive-import --create-hive-table --hive-table veer.customers2
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
My job,export,dynamic partition...
create table customer5 (customer_id int , customer_fname varchar , customer_lname varchar,
customer_email varchar,customer_password varchar, customer_street varchar, customer_city varchar ,
customer_state varchar,customer_zipcode varchar);
hive>> create table customer_inc (customer_id int , customer_fname string , customer_lname string,
customer_email string,customer_password string, customer_street string, customer_city string ,
customer_state string ,customer_zipcode string);
sqoop import --connect jdbc:mysql://localhost/retail_db --username root --password cloudera --table customers --split-by customer_id --fields-terminated-by ',' -m 10 --hcatalog-database veer --hcatalog-table customer4;
>>>sqoop job --create import --connect jdbc:mysql://localhost/retail_db --username root --password cloudera --table customers --hive-import --hive-table customer4 --hive-partition-key customer_zipcode;
>>>
sqoop import --connect jdbc:mysql://localhost/retail_db \
--username root --password cloudera \
--hive-import \
--query "select customer_id ,customer_fname,customer_lname,customer_email,customer_password,customer_street,customer_city,customer_state from retail_db.customers where customer_zipcode='00725' and \$CONDITIONS" \
--hive-table customer4 \
--hive-partition-key customer_zipcode \
--hive-partition-value 'PR00725' \
--target-dir /user/cloudera/customer_temp \
--split-by customer_id
sqoop import --connect jdbc:mysql://localhost/retail_db \
--username root --password cloudera \
--hive-import \
--query "select * from retail_db.customers where \$CONDITIONS" \
--hive-table customer5 \
--hive-partition-key customer_zipcode \
--target-dir /user/cloudera/customer_temp \
--split-by customer_id
--table customers --where "customer_zipcode='PR00725'"
_____________________________________________________________________________________________________________________________________________________________________
create table ct1 select * from customers where 1=2;
sqoop export --connect jdbc:mysql://localhost/retail_db \
--username root --password cloudera \
--table temp \
--export-dir /user/hive/warehouse/temp
______________________________________________________________________________________________
sqoop job -create inc_upt import --connect jdbc:mysql://localhost/retail_db \
--username root --password cloudera \
--table customers \
--incremental append \
--check-column customer_id last-value 12435 \
--target-dir /data/sqoop/test02
sqoop job –create jobname –<space>import –connect jdbc:mysql://localhost/DBname –username username –password password –table tablename –incremental append –check-column colname last-value 101
Comments
Post a Comment