• 1.5 sqoop安装及基本使用


    一、安装sqoop

    1、解压

    ##解压
    [root@hadoop-senior cdh]# tar zxf sqoop-1.4.5-cdh5.3.6.tar.gz -C /opt/cdh-5.3.6/

    2、/opt/cdh-5.3.6/sqoop-1.4.5-cdh5.3.6/conf/sqoop-env.sh          //先重命名

    复制代码
    #Set path to where bin/hadoop is available
    export HADOOP_COMMON_HOME=/opt/cdh-5.3.6/hadoop-2.5.0-cdh5.3.6
    
    #Set path to where hadoop-*-core.jar is available
    export HADOOP_MAPRED_HOME=/opt/cdh-5.3.6/hadoop-2.5.0-cdh5.3.6
    
    #set the path to where bin/hbase is available
    #export HBASE_HOME=
    
    #Set the path to where bin/hive is available
    export HIVE_HOME=/opt/cdh-5.3.6/hive-0.13.1-cdh5.3.6
    复制代码

    3、查看命令帮助

    复制代码
    [root@hadoop-senior sqoop-1.4.5-cdh5.3.6]# bin/sqoop help
    
    usage: sqoop COMMAND [ARGS]
    
    Available commands:
      codegen            Generate code to interact with database records
      create-hive-table  Import a table definition into Hive
      eval               Evaluate a SQL statement and display the results
      export             Export an HDFS directory to a database table
      help               List available commands
      import             Import a table from a database to HDFS
      import-all-tables  Import tables from a database to HDFS
      import-mainframe   Import datasets from a mainframe server to HDFS
      job                Work with saved jobs
      list-databases     List available databases on a server
      list-tables        List available tables in a database
      merge              Merge results of incremental imports
      metastore          Run a standalone Sqoop metastore
      version            Display version information
    
    See 'sqoop help COMMAND' for information on a specific command.
    复制代码

    4、拷贝mysql驱动,这里一mysql为例;

    [root@hadoop-senior sqoop-1.4.5-cdh5.3.6]# cp /opt/softwares/mysql-libs/mysql-connector-java-5.1.27/mysql-connector-java-5.1.27-bin.jar ./lib/

    5、sqoop使用要点

    image

    二、使用

    复制代码
    [root@hadoop-senior sqoop-1.4.5-cdh5.3.6]# bin/sqoop list-databases 
    > --connect jdbc:mysql://hadoop-senior.ibeifeng.com:3306 
    > --username root 
    > --password 123456
    Warning: /opt/cdh-5.3.6/sqoop-1.4.5-cdh5.3.6/bin/../../hbase does not exist! HBase imports will fail.
    Please set $HBASE_HOME to the root of your HBase installation.
    Warning: /opt/cdh-5.3.6/sqoop-1.4.5-cdh5.3.6/bin/../../hcatalog does not exist! HCatalog jobs will fail.
    Please set $HCAT_HOME to the root of your HCatalog installation.
    Warning: /opt/cdh-5.3.6/sqoop-1.4.5-cdh5.3.6/bin/../../accumulo does not exist! Accumulo imports will fail.
    Please set $ACCUMULO_HOME to the root of your Accumulo installation.
    Warning: /opt/cdh-5.3.6/sqoop-1.4.5-cdh5.3.6/bin/../../zookeeper does not exist! Accumulo imports will fail.
    Please set $ZOOKEEPER_HOME to the root of your Zookeeper installation.
    19/05/06 15:32:51 INFO sqoop.Sqoop: Running Sqoop version: 1.4.5-cdh5.3.6
    19/05/06 15:32:51 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
    19/05/06 15:32:51 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.
    information_schema
    metadata
    metastore
    mysql
    performance_schema
    test

     转自:https://www.cnblogs.com/weiyiming007/p/10820005.html

  • 相关阅读:
    安装oh-my-zsh失败,可按以下方式安装
    aria2 for mac
    java抛出异常后,后续代码是否可继续执行
    mac多线程下载神器
    Oracle--大数据迁移--sqlldr技术的应用
    Windows版 GCC编译器安装和使用--MinGW
    Visual Studio 2015 安装与注册
    android studio 3.6 环境搭建(安装步骤)
    IDEA--主题样式设置
    数据--innercode--的处理
  • 原文地址:https://www.cnblogs.com/javalinux/p/14993671.html
Copyright © 2020-2023  润新知