tar -zxvf sqoop-1.4.6.bin__hadoop-2.0.4-alpha.tar.gz -C /usr/local/soft/
mv sqoop-1.4.6.bin__hadoop-2.0.4-alpha/ sqoop-1.4.6
# 切换到sqoop配置文件目录 cd /usr/local/soft/sqoop-1.4.6/conf # 复制配置文件并重命名 cp sqoop-env-template.sh sqoop-env.sh # vim sqoop-env.sh 编辑配置文件,并加入以下内容 export HADOOP_COMMON_HOME=/usr/local/soft/hadoop-2.7.6 export HADOOP_MAPRED_HOME=/usr/local/soft/hadoop-2.7.6/share/hadoop/mapreduce export HBASE_HOME=/usr/local/soft/hbase-1.4.6 export HIVE_HOME=/usr/local/soft/hive-1.2.1 export ZOOCFGDIR=/usr/local/soft/zookeeper-3.4.6/conf export ZOOKEEPER_HOME=/usr/local/soft/zookeeper-3.4.6 # 切换到bin目录 cd /usr/local/soft/sqoop-1.4.6/bin # vim configure-sqoop 修改配置文件,注释掉没用的内容(就是为了去掉警告信息)
vim /etc/profile # 将sqoop的目录加入环境变量
# 从HIVE中复制MySQL连接驱动到$SQOOP_HOME/lib cp /usr/local/soft/hive-1.2.1/lib/mysql-connector-java-5.1.49.jar /usr/local/soft/sqoop-1.4.6/lib/
# 打印sqoop版本 sqoop version
# 测试MySQL连通性 sqoop list-databases -connect jdbc:mysql://master:3306/ -username root -password 123456
mysql -u root -p123456;
create database student;
# mysql shell中执行 use student; source /usr/local/soft/bigdata17/scrips/student.sql; source /usr/local/soft/bigdata17/scrips/score.sql;
# linux shell中执行 mysql -u root -p123456 students</usr/local/soft/bigdata17/scrips/student.sql mysql -u root -p123456 students</usr/local/soft/bigdata17/scrips/score.sql
也可以通过Navicat导入
mysqldump -u root -p123456 students>/usr/local/soft/bigdata17/scrips/students_score_out.sql