Canal Adapter1.1.5 versión servicio de operación API, sincronización manual de datos (4)

api 类 : com.alibaba.otter.canal.adapter.launcher.rest.CommonRest

  • Ver la lista de instancias de la tarea de sincronización

curl http://127.0.0.1:8081/destinations
>>
[{"destination":"canal-test","status":"on"}]
  • Interruptor de sincronización

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)
  • Ver el estado del interruptor

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)
  • Sincronizar datos manualmente

#全量,不传参数
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) 
  • Consultar el número total en la biblioteca de sincronización

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) 

La falta de clave puede provocar que no se identifique la fuente de datos de los adaptadores externos

 

 

 

 

 

Supongo que te gusta

Origin blog.csdn.net/lizz861109/article/details/112788027
Recomendado
Clasificación