1、下载: http://mirrors.hust.edu.cn/apache/sqoop/1.4.7/sqoop-1.4.7.bin__hadoop-2.6.0.tar.gz
2、将sqoop-1.4.7.bin__hadoop-2.6.0.tar.gz上传至master机器的~/bigdata目录下,且解压
3、配置Sqoop环境变量:
vi ~/.bash_profile
export SQOOP_HOME=/home/hadoop-jrq/bigdata/sqoop-1.4.7.bin__hadoop-2.6.0
PATH=....:$SQOOP_HOME/bin
4、将mysql的jdbc驱动jar包扔到$SQOOP_HOME/lib下
5、执行sqoop help命令看看sqoop是否安装成功
6、执行命令:start-dfs.sh和start-yarn.sh
简单的sqoop例子,将mysql中的movie表数据导入到HDFS中
sqoop import --connect jdbc:mysql://master:3306/movie --username root --password root --table movie --split-by id
–split-by id 按照ID字段进行分区,默认是4个分区
如果报MySQL的权限错误,请执行:
grant all privileges on . to root@master identified by ‘1234’;
flush privileges;
报的哪台机器权限不够,就往哪台机器加权限