免费注册
帮助文档(华北一、二)

  • 1.1 创建mysql数据

    Mysql数据源以RDS为例。

    连接Mysql,并创建数据库sqoop和表sqoop。

     

    [root@uhadoop-******-master2 ~]# mysql -h10.13.124.35 -uroot -p'inspur' sqoop

    mysql> create database sqoop;

    Query OK, 1 row affected (0.00 sec)

    mysql> use sqoop

    Database changed

    mysql> CREATE TABLE `sqoop` (

        ->   `id` varchar(64) DEFAULT NULL,

        ->   `value` varchar(64) NOT NULL DEFAULT '',

    ->     PRIMARY KEY (`id`)

        -> ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

    Query OK, 0 rows affected (0.01 sec)

    mysql> insert into sqoop values ('1', 'hha'),('2', 'zhang'),('3','hehe');

    Query OK, 3 rows affected (0.00 sec)

    Records: 3  Duplicates: 0  Warnings: 0

    1.2 启动Sqoop2 CLI

    uhadoop-******-master2节点上执行。

     /home/hadoop/sqoop2/bin/sqoop.sh client

    help可查到基本使用命令

     

    sqoop:000> help

    For information about Sqoop, visit: http://sqoop.apache.org/

    Available commands:

      exit    (\x  ) Exit the shell

      history (\H  ) Display, manage and recall edit-line history

      help    (\h  ) Display this help message

      set     (\st ) Configure various client options and settings

      show    (\sh ) Display various objects and configuration options

      create  (\cr ) Create new object in Sqoop repository

      delete  (\d  ) Delete existing object in Sqoop repository

      update  (\up ) Update objects in Sqoop repository

      clone   (\cl ) Create new object based on existing one

      start   (\sta) Start job

      stop    (\stp) Stop job

      status  (\stu) Display status of a job

      enable  (\en ) Enable object in Sqoop repository

      disable (\di ) Disable object in Sqoop repository

    For help on a specific command type: help command

    1.3 查看connector

     sqoop:000> show connector

    1.4 创建mysql-link

     

    sqoop:000> create link -c 4