canaladapter 全量同步到es where参数无效问题解决

mytest_user.yml:

dataSourceKey: defaultDS
destination: DX_tj_SEND_MYSQL_LOG_MSG
groupId: g1
esMapping:
  _index: wx_cp_user_contact_rel_all
  _id: id
#  upsert: true
#  pk: id
  sql: "select
      	CONCAT(a.external_userid, '*', a.follow_user_id) as id,
      	a.external_userid as externalUserid,
      	a.follow_user_id as followUserId,
      	a.follow_user_remark as followUserRemark,
      	a.follow_user_description as followUserDescription,
      	date_format( a.follow_user_createtime, '%Y-%m-%d %H:%I:%S') as followUserCreatetime,
      	a.follow_user_tags_group_name as followUserTagsGroupName,
      	a.follow_user_tags_tag_name as followUserTagsTagName,
      	a.follow_user_tags_type as followUserTagsType,
      	a.follow_user_remark_corp_name as followUserRemarkCorpName,
      	a.address,
      	a.corp_id as corpId,
      	a.follow_user_remark_mobiles as followUserRemarkMobiles,
      	a.follow_user_state as followUserState ,
      	a.status ,
      	a. birthday,
      	date_format( a.link_time, '%Y-%m-%d %H:%I:%S') as linkTime,
      	date_format( a.create_time, '%Y-%m-%d %H:%I:%S') as createTime,
      	b.name,
      	b.avatar,
      	b.type,
      	b.gender,
      	b.unionid,
      	b.position,
      	b.corp_name as corpName,
      	b.corp_full_name as corpFullName,
      	b.external_profile as externalProfile,
      	b.phone
      from
      	wx_cp_user_contact_rel a
      left join  wx_cp_user_contact b on
      	a.external_userid = b.external_userid"
#  objFields:
#    _labels: array:;
  etlCondition: "where a.corp_id ={}"
  commitBatch: 3000

看了源码才知道 where 条件后面的参数是需要在访问 的时候传入例如:

源码:

全量同步:

curl  -X POST http://localhost:8585/etl/es7/mytest_user.yml?params=ww685f2b0e44c63b20

增量同步打开开关(DX_tj_SEND_MYSQL_LOG_MSG为kafka主题,或者canal instanse实例名称):

 curl http://127.0.0.1:8585/syncSwitch/DX_tj_SEND_MYSQL_LOG_MSG/on -X PUT

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值