1、sqoop抽取mysql表到hbase中
export HBASE_HOME=/opt/cdh-5.3.6/hbase-0.98.6-cdh5.3.6
export HADOOP_HOME=/opt/cdh-5.3.6/hadoop-2.5.0-cdh5.3.6
HADOOP_CLASSPATH=`${HBASE_HOME}/bin/hbase mapredcp`:${HBASE_HOME}/conf bin/sqoop import \
--connect jdbc:mysql://localhost:3306/chavin \
--username root -password mysql \
--table emp \
--columns "empno,ename" \
--hbase-table imp_emp \
--column-family info \
--hbase-row-key empno -m 1
export HBASE_HOME=/opt/cdh-5.3.6/hbase-0.98.6-cdh5.3.6
export HADOOP_HOME=/opt/cdh-5.3.6/hadoop-2.5.0-cdh5.3.6
HADOOP_CLASSPATH=`${HBASE_HOME}/bin/hbase mapredcp`:${HBASE_HOME}/conf bin/sqoop import \
--connect jdbc:mysql://localhost:3306/chavin \
--username root -password mysql \
--table emp \
--columns "empno,ename" \
--hbase-table imp_emp02 \
--column-family info \
--hbase-row-key ename -m 1
export HBASE_HOME=/opt/cdh-5.3.6/hbase-0.98.6-cdh5.3.6
export HADOOP_HOME=/opt/cdh-5.3.6/hadoop-2.5.0-cdh5.3.6
HADOOP_CLASSPATH=`${HBASE_HOME}/bin/hbase mapredcp`:${HBASE_HOME}/conf bin/sqoop import \
--connect jdbc:mysql://localhost:3306/chavin \
--username root -password mysql \
--table emp \
--columns "empno,ename" \
--hbase-table imp_emp04 --hbase-create-table \
--column-family info \
--hbase-row-key empno \
--hbase-bulkload \
--compress -m 1
2、sqoop抽取mysql表到hive中
export HIVE_HOME=/opt/cdh-5.3.6/hive-0.13.1-cdh5.3.6
export HADOOP_HOME=/opt/cdh-5.3.6/hadoop-2.5.0-cdh5.3.6
HADOOP_CLASSPATH=${HIVE_HOME}/conf:${HADOOP_HOME}/conf bin/sqoop import \
--connect jdbc:mysql://localhost:3306/chavin \
--username root -password mysql \
--table emp \
--columns "empno,ename" \
--hive-import --hive-database chavin \
--create-hive-table --hive-table h_emp01 \
--hive-partition-key dt \
--hive-partition-value '2017-10-09' \
--compress -m 1
3、sqoop实现rdbms与hdfs数据交互
bin/sqoop import \
--connect jdbc:mysql://db01:3306/chavin \
--username root \
--password mysql \
--table emp \
--target-dir /user/hadoop/sqoop/import/emp \
--num-mappers 1 \
--as-parquetfile
bin/sqoop export \
--connect jdbc:mysql://db01:3306/chavin \
--username root \
--password mysql \
--table emp01 \
--export-dir /user/hadoop/sqoop/import/emp