zoukankan      html  css  js  c++  java
  • 大数据学习笔记——Sqoop完整部署流程

    Sqoop详细部署教程

    Sqoop是一个将hadoop与关系型数据库之间进行数据传输,批量数据导入导出的工具,注意,导入是指将数据从RDBMS导入到hadoop而导出则是指将数据从hadoop导出到RDBMS,本篇博客承接上篇Hive的部署教程,废话不多说,直接开始流程

    1. 安装准备

    准备好以下安装包,使用的版本为1.4.7

    2. 正式安装

    1. 使用Xftp将tar.gz文件放到/home/centos/downloads目录下

    2. 解压缩

    cd /home/centos/downloads

    tar -xzvf sqoop-1.4.7.bin__hadoop-2.6.0.tar.gz -C /soft

    3. 创建符号链接

    cd /soft

    ln -s sqoop-1.4.7.bin__hadoop-2.6.0 sqoop

    4. 配置环境变量

    nano /etc/profile

    在文件末尾添加:

    #sqoop环境变量
    export SQOOP_HOME=/soft/sqoop
    export PATH=$PATH:$SQOOP_HOME/bin

    #添加hive依赖到hadoop的classpath下

    export HADOOP_CLASSPATH=$HADOOP_CLASSPATH:$HIVE_HOME/lib/*

    保存退出后:

    source /etc/profile

    5. 修改配置文件

    cd /soft/sqoop/conf

    mv sqoop-env-template.sh sqoop-env.sh

    nano sqoop-env.sh

    修改以下代码后保存退出:

    #Set path to where bin/hadoop is available

    export HADOOP_COMMON_HOME=/soft/hadoop

    #Set path to where hadoop-*-core.jar is available

    export HADOOP_MAPRED_HOME=/soft/hadoop

    #set the path to where bin/hbase is available

    #export HBASE_HOME=

    #Set the path to where bin/hive is available

    export HIVE_HOME=/soft/hive

    #Set the path for where zookeper config dir is

    export ZOOCFGDIR=/soft/zk/conf

    6. 放入mysql的驱动程序:

    cp /soft/hive/lib/mysql-connector-java-5.1.44.jar /soft/sqoop/lib/

    7. 查看sqoop的版本,sqoop version,出现以下信息说明配置成功!

    3. 后续收尾

    至此,sqoop的配置已经完成了,接下去还有一个后续工作要做,由于最新版的sqoop很有可能和hive或其他大数据组件版本上不兼容,导致以后在做导入导出操作的时候会报java异常,因此还需要进行以下4步操作

    1. 复制hive的hive-site.xml文件到sqoop的conf下

    cp /soft/hive/conf/hive-site.xml /soft/sqoop/conf

    2. 修改jre下lib文件夹中的配置

    cd /soft/jdk/jre/lib/security

    修改java.policy中的内容

    nano java.policy

    在grant{}里添加以下内容:

    // JMX Java Management eXtensions
    permission javax.management.MBeanTrustPermission "register";

    3. 将sqoop/lib下的jackson的jar包做备份,使用ipython将所有jackson的jar包加上.bak做备份

    ipython

    import os

    back_up_file = [i for i in os.listdir('/soft/sqoop/lib') if i.startswith('jackson') and i.endswith('jar')]
    new_file_name = [i + '.bak' for i in back_up_file]
    D = '/soft/sqoop/lib/'
    for i,j in zip(back_up_file, new_file_name):
      os.rename(D+i, D+j)

    exit

    4. 将hive/lib下所有的jackson的jar包复制到sqoop/lib下

    cp /soft/hive/lib/jackson*.jar /soft/sqoop/lib

  • 相关阅读:
    ORA-01935: missing user or role name
    ORA-00923: FROM keyword not found where expected
    ORA-00933: SQL command not properly ended
    ORA_12514:TNS:listener does not currently know of service requested in connect descriptor
    ORA-00918: column ambiguously defined
    ORA-01789: 查询块具有不正确的结果列数
    ORA-01789: query block has incorrect number of result columns
    ORA-01747
    ORA-01843: not a valid month
    ORA-00904: "I_LEVEL": invalid identifier
  • 原文地址:https://www.cnblogs.com/w950219/p/11878003.html
Copyright © 2011-2022 走看看