sqoop安装
1. 上传、解压、重命名
1.1. 在任意hive机器上上传sqoop
su - hadoop
rz –y
1.2. 解压
tar -zxvfsqoop-1.4.4.bin__hadoop-1.0.0.tar.gz
1.3. 重命名
mv sqoop-1.4.4.bin__hadoop-1.0.0 sqoop
2. 设置环境变量
su – root
vi /etc/profile
添加内容
export SQOOP_HOME=/home/hadoop/sqoop export PATH=$PATH:$SQOOP_HOME/bin |
source /etc/profile
3. 添加jar包
将的hadoop-core-1.0.4.jar、hbase-0.94.6.jar、zookeeper-3.4.5.jar以及MySQL的mysql-connector-java-XXXX-bin.jar拷贝到Sqoop的lib目录下
4. 修改配置文件
将sqoop-env.sh上传到sqoop/conf下
export HADOOP_COMMON_HOME=/home/hadoop/hadoop #Set path to where hadoop-*-core.jar is available export HADOOP_MAPRED_HOME=/home/hadoop/hadoop #set the path to where bin/hbase is available export HBASE_HOME=/home/hadoop/hbase #Set the path to where bin/hive is available export HIVE_HOME=/home/hadoop/hive #Set the path for where zookeper config dir is export ZOOCFGDIR=/home/hadoop/zookeeper/conf |
5. 测试
查看MySQL的数据库(可以用-P代替--password,使用户手动输入密码)
sqooplist-databases --connect jdbc:mysql://192.168.56.204:3306/ --username root--password root
查看数据库中的表
sqoop list-tables--connect jdbc:mysql://192.168.56.204:3306/mysql --username root --passwordroot