logstash es同步 部分数据丢失

错误信息

es,查询商品数据,没有查询到条码信息。mysql中条码信息是存在的
测试同学反馈的抓包信息。商品条码(code)不存在

在这里插入图片描述

排查过程

查看es中的数据,数据从identifies这个对象中获取,该对象中数据为空。这条数据上有tag (_jdbcstreamingfailure),这个有点奇怪

在这里插入图片描述

查看对应的说明,是同步过程中出现错误添加的默认标签(https://www.elastic.co/guide/en/logstash/7.4/plugins-filters-jdbc_streaming.html#plugins-filters-jdbc_streaming-tag_on_failure)
在这里插入图片描述

找到对应的logstash相关时间点的日志,发现mysql连接有异常

[2019-09-23T11:40:01,523][WARN ][logstash.filters.jdbcstreaming] Exception when executing JDBC query 
{:exception=>#<Sequel::DatabaseError: Java::ComMysqlJdbcExceptionsJdbc4::CommunicationsException: 
The last packet successfully received from the server was 249,761,473 milliseconds ago. 
The last packet sent successfully to the server was 249,761,473 milliseconds ago. is longer than the server configured value of 'wait_timeout'. 
You should consider either expiring and/or testing connection validity before use in your application, 
increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.>}

#问题原因
网上查到的资料,分析的主要原因为MySQL断开了空闲的连接。
详情可参考https://blog.csdn.net/pandajava/article/details/41946251

查看了对应的环境设置
在这里插入图片描述


解决思路

  1. mysql jdbc connection增加了autoReconnect配置 (网上资料说这个只对mysql 4.X生效,5之后的版本不生效。我们的是5.7,未单独验证)
  2. 增加jdbc_validate_connection配置
    在这里插入图片描述

https://www.elastic.co/guide/en/logstash/7.4/plugins-filters-jdbc_streaming.html#plugins-filters-jdbc_streaming-jdbc_validate_connection

在这里插入图片描述

修改配置后,观察了1d运行情况,未出现之前的错误信息

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值