api类:com.alibaba.otter.canal.adapter.launcher.rest.CommonRest
-
View the synchronization task instance list
curl http://127.0.0.1:8081/destinations
>>
[{"destination":"canal-test","status":"on"}]
-
Sync switch
curl http://127.0.0.1:8081/syncSwitch/canal-test/off -X PUT
>>
{"code":20000,"message":"实例: canal-test 关闭同步成功"}
/**
* 实例同步开关 curl http://127.0.0.1:8081/syncSwitch/example/off -X PUT
*
* @param destination 实例名称
* @param status 开关状态: off on
* @return
*/
@PutMapping("/syncSwitch/{destination}/{status}")
public Result etl(@PathVariable String destination, @PathVariable String status)
-
View switch status
curl http://127.0.0.1:8081/syncSwitch/canal-test
>>
{"stauts":"off"}
/**
* 获取实例开关状态 curl http://127.0.0.1:8081/syncSwitch/example
*
* @param destination 实例名称
* @return
*/
@GetMapping("/syncSwitch/{destination}")
public Map<String, String> etl(@PathVariable String destination)
-
Manually sync data
#全量,不传参数
curl http://127.0.0.1:8081/etl/es7/test-user/test_user.yml -X POST
>>
{"succeeded":true,"resultMessage":"导入ES 数据:20 条"}
#部分同步,etlCondition: "where id between {} and {}"
curl http://127.0.0.1:8081/etl/es7/test-user/test_user.yml -X POST -d "params=1273;1275"
>>
{"succeeded":true,"resultMessage":"导入ES 数据:2 条"}
/**
* ETL curl http://127.0.0.1:8081/etl/rdb/oracle1/mytest_user.yml -X POST
*
* @param type 类型 hbase, es
* @param key adapter key
* @param task 任务名对应配置文件名 mytest_user.yml
* @param params etl where条件参数, 为空全部导入,匹配etlCondition中的参数,使用;分号多个值
*/
@PostMapping("/etl/{type}/{key}/{task}")
public EtlResult etl(@PathVariable String type, @PathVariable String key, @PathVariable String task,
@RequestParam(name = "params", required = false) String params)
-
Query the total number in the synchronization library
curl http://127.0.0.1:8081/count/es7/test-user/test_user.yml
>>
{"esIndex":"test_user","count":5}
/**
* ETL curl http://127.0.0.1:8081/etl/rdb/oracle1/mytest_user.yml -X POST
*
* @param type 类型 hbase, es
* @param key outerAdapters key
* @param task 任务名对应配置文件名 mytest_user.yml
* @param params etl where条件参数, 为空全部导入
*/
@PostMapping("/etl/{type}/{key}/{task}")
public EtlResult etl(@PathVariable String type, @PathVariable String key, @PathVariable String task,
@RequestParam(name = "params", required = false) String params)
The lack of key may lead to failure to identify the outerAdapters data source