# 解压并创建软连接
[hadoop@hadoop software]$ tar -xvf sqoop-1.4.6-cdh5.16.2.tar.gz -C ../app/
[hadoop@hadoop software]$ cd ~/app/
[hadoop@hadoop app]$ ln -s sqoop-1.4.6-cdh5.16.2/ sqoop
# 配置conf文件
[hadoop@hadoop app]$ cd sqoop/conf/
[hadoop@hadoop conf]$ rm -rf ./*.cmd
[hadoop@hadoop conf]$ cp sqoop-env-template.sh sqoop-env.sh
[hadoop@hadoop conf]$ vim sqoop-env.sh
export HADOOP_COMMON_HOME=/home/hadoop/app/hadoop
export HADOOP_MAPRED_HOME=/home/hadoop/app/hadoop
export HIVE_HOME=/home/hadoop/app/hive
# 上传mysql驱动包
[hadoop@hadoop conf]$ cd ../lib/
[hadoop@hadoop lib]$ cp ~/lib/mysql-connector-java-5.1.47.jar .
# 配置环境变量
[hadoop@hadoop lib]$ cd
[hadoop@hadoop ~]$ echo -e '# SQOOP ENV\nexport SQOOP_HOME=/home/hadoop/app/sqoop\nexport PATH=$SQOOP_HOME/bin:$PATH' >>~/.bashrc
[hadoop@hadoop ~]$ source ~/.bashrc
# 加入java-json.jar包
# 不加这个包,sqoop import的时候会报错
[hadoop@hadoop ~]$ cd
[hadoop@hadoop ~]$ cp lib/java-json.jar app/sqoop/lib/
网友评论