sqoop2 简单使用

启动Sqoop 2 server:

bin/sqoop.sh server start

http://node3:12000/sqoop/

停止Sqoop 2 server:

bin/sqoop.sh server stop


进入sqoop2  命令行
执行 sqoop安装路径/bin/sqoop.sh client


输入help 查看命令

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

设置sqoop server:
set server --host node3 --port 12000 --webapp sqoop

Set Option Function

Configure Sqoop client related options. This function have two required arguments name and value. Name represents internal property name and value holds new value that should be set. List of available option names follows:






Option name  Default value

Description

verbose false Client will print additional information if verbose mode is enabled

poll-timeout 10000 Server poll timeout in milliseconds

Example:

set option --name verbose --value true
set option --name poll-timeout --value 20000



查询已有连接

show connector
           
查询link
show link

查询job

show job

创建link
create link --cid 1 or create link -c 1     "1" 为connector id

创建 job
create job --from 1 --to 2 or create job --f 1 --t 2  "-f 或--from" 为从link1  "-t 或 --to" 到 link2

更新 link
update link -l1 "-l1" 是linkid为1的

更新job
update job -j1   "-j1" 是jobid为1的

启动一个job
Argument   Description

-j, --jid <x> Start job with id <x>
-s, --synchronous Synchoronous job execution

Example:
start job --jid 1
start job --jid 1 --synchronous

Stop job
Argument  Description

-j, --jid <x> Interrupt running job with id <x>

Example:

stop job --jid 1



clone 克隆



实例:建立一个hdfslink
create link -c 3
Name: hdfs_link
HDFS URI: hdfs://ns1/
link was successfully created with status OK

实例:建立一个JDBC link
create link -c 4
Name: oracleJdbc_link

JDBC Driver Class: oracle.jdbc.driver.OracleDriver
JDBC Connection String: jdbc:oracle:thin:@hostip:1521:erpdb
Username: jlerp_v
Password: xxxxxx
JDBC Connection Properties:
There are currently 0 values in the map:
entry#
link was successfully created with status OK

实例 克隆oracleJdbc_link
sqoop:000> clone link -lid 5
Cloning link with id 5
Please update link:
Name: oracleJdbc_link_clone

Link configuration

JDBC Driver Class: oracle.jdbc.driver.OracleDriver
JDBC Connection String: jdbc:oracle:thin:@10.68.2.23:1521:erpdb
Username: jlerp_v
Password: *******
JDBC Connection Properties:
There are currently 0 values in the map:
entry#
link was successfully created with validation status WARNING and persistent id 8

注意 在创建JDBCjob时

Schema name:  Table name: 配对使用,如果输入了schema 和 table name ,Table SQL statement: 就不需要输入,如果输入了 sql语句就不填 schema 和 table name





你可能感兴趣的:(sqoop2 简单使用)