sqoop2 简单使用

1、启动、停止 Sqoop 2 server:

bin/sqoop.sh server start

验证地址:http://node3:12000/sqoop/

bin/sqoop.sh server stop

2、sqoop2 命令行

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

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

Set Option 使用


verbose 客户端输出更多的日志
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

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

Example:

stop job --jid 1

clone job|link

克隆时名称要修改

4 实例


实例:建立一个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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值