1.下载 sqoop-1.4.6-cdh5.7.6.tar.gz
2.在linux中进行安装, tar -zxvf /opt/tools/spark-1.6.1-bin-2.6.0-cdh5.7.6.tgz -C /opt/cdh-5.7.6/
3.进入sqoop安装目录,我装在/opt/cdh-5.7.6/sqoop-1.4.6-cdh5.7.6目录中
4.进入conf目录,为确保数据源,复制sqoop-env.template.cmd 同时重命名为sqoop-env.sh启用配置,cp sqoop-env.template.cmd sqoop-env.sh
5.在sqoop-env.sh中添加配置:
export HADOOP_COMMON_HOME=/opt/cdh-5.7.6/hadoop-2.6.0-cdh5.7.6
export HADOOP_MAPRED_HOME=/opt/cdh-5.7.6/hadoop-2.6.0-cdh5.7.6
export HIVE_HOME=/opt/cdh-5.7.6/hive-1.1.0-cdh5.7.6
export HBASE_HOME=/opt/cdh-5.7.6/hbase-1.2.0-cdh5.7.6
export ZOOCFGDIR=/opt/cdh-5.7.6/zookeper-3.4.5-cdh-5.7.6
6.将jdbc连接驱动放到sqoop的lib目录下,cp /opt/tools/mysql-connector-java-5.1.27-bin.jar lib/
7.将json包放入sqoop的lib中,cp /opt/tools/java-json.jar lib/
8.测试:
sqoop help
usage: sqoop COMMAND [ARGS]
当前MySQL中有哪些可用的数据库
bin/sqoop list-databases --connect jdbc:mysql://bigdata-hadoop001.hpsk.com:3306 --username root --password 123456