环境:redhat6.5 hadoop2.4.1
感谢: http://wenku.baidu.com/view/a9083da8dd3383c4bb4cd274.html 注释hbase检查
感谢: http://xubo8118.blog.163.com/blog/static/1855523322013720105924372/
step1 下载sqoop-1.4.4压缩包 http://mirror.bit.edu.cn/apache/sqoop/1.4.4/sqoop-1.4.4.bin__hadoop-2.0.4-alpha.tar.gz
step2 解压到/opt/sqoop/目录
tar -zxvf sqoop-1.4.4.bin__hadoop-2.0.4-alpha.tar.gz -C /opt/sqoop/
为了简化配置过程中涉及到的路径名称,建立一个链接到刚刚解压的路径的软链接,然后进入到/opt/sqoop-1.4.4中
ln -s /opt/sqoop/sqoop-1.4.4.bin__hadoop-2.0.4-alpha /opt/sqoop-1.4.4
cd /opt/sqoop-1.4.4
step3 配置环境变量 :编辑/etc/profile文件,在结尾加入如下代码
export SQOOP_HOME=/opt/sqoop-1.4.4 export HADOOP_COMMON_HOME=/opt/hadoop-2.4.1 export HADOOP_MAPRED_HOME=/opt/hadoop-2.4.1
step4. 复制lib包:
a. 复制/opt/sqoop-1.4.4/sqoop-1.4.4.jar 包至 hadoop的lib路径下,否则报错: Error: Could not find or load main class org.apache.sqoop.Sqoop
b. 复制连接mysql的java驱动包(如果用的是其他数据库,下载对应的java包即可),至/opt/sqooop-1.4.4/lib 和 hadoop 的l ib 下,否则报错: ERROR sqoop.Sqoop: Got exception running Sqoop: java.lang.RuntimeException: Could not load db driver class: com.mysql.jdbc.Driver (驱动包在mysql官网可以下载)
step5 修改/opt/sqoop-1.4.4/bin/configure_sqoop文件,将有关hbase的判断或export全部注释
step6. 测试sqoop,执行如下命令,结果大概如下,内容太长,就不敲了
root@cup bin# cd /opt/sqoop-1.4.4/bin root@cup bin# ./sqoop help
usage: sqoop COMMAND [ARGS]
Avaliable commands:
codegen .....
create-hive-table: ......
... ... ..
... ... ..
root@cup bin#