一、安装sqoop
tar -zxvf sqoop-1.4.6-cdh5.6.0.tar.gz
sudo mv sqoop-1.4.6 /usr/app/sqoop
二、配置sqoop
1、配置文件sqoop-env.sh
cd sqoop/conf/
cp sqoop-env-template.sh sqoop-env.sh
vim sqoop-env.sh
export HADOOP_COMMON_HOME=/usr/app/hadoop
export HADOOP_MAPRED_HOME=/usr/app/hadoop
export HBASE_HOME=/usr/app/hbase
export HIVE_HOME=/usr/app/hive
2、配置环境变量
export SQOOP_HOME=/usr/app/sqoop
export PATH=$PATH:$SBT_HOME/bin:$SQOOP_HOME/bin
export CLASSPATH=$CLASSPATH:$SQOOP_HOME/lib
3、将mysql驱动包拷贝到$SQOOP_HOME/lib
sudo tar -zxvf mysql-connector-java-5.1.40.tar.gz #解压mysql驱动包
cp ./mysql-connector-java-5.1.40/mysql-connector-java-5.1.40-bin.jar /usr/local/sqoop/lib
4、测试与MySQL的连接
service mysql start
sqoop list-databases --connect jdbc:mysql://127.0.0.1:3306/ --username root -P
网友评论