开发者社区> 问答> 正文

在数据库里插入数据,同步ES失败

在数据库里插入数据,同步ES失败,刚接触,日志提示比较简单,不明白是什么问题。 log 日志: Outer adapter write failed

配置文件:

application.yml

server: port: 8081 logging: level: org.springframework: WARN com.alibaba.otter.canal.client.adapter.hbase: DEBUG com.alibaba.otter.canal.client.adapter.es: DEBUG com.alibaba.otter.canal.client.adapter.rdb: DEBUG spring: jackson: date-format: yyyy-MM-dd HH:mm:ss time-zone: GMT+8 default-property-inclusion: non_null

canal.conf: canalServerHost: 127.0.0.1:11111 batchSize: 500 syncBatchSize: 1000 retries: 0 timeout: accessKey: secretKey: mode: tcp # kafka rocketMQ srcDataSources: defaultDS: url: jdbc:mysql://127.0.0.1:3307/testdb?useUnicode=true username: root password: 123456 canalAdapters: - instance: example # canal instance Name or mq topic name groups: - groupId: g1 outerAdapters: - name: logger - name: es hosts: 127.0.0.1:9300 properties: cluster.name: elasticsearch_reid

es:

dataSourceKey: defaultDS destination: example esMapping: _index: testdb _type: test _id: id sql: "select id, content from test" commitBatch: 3000

ES 索引结构:

{ "settings": { "number_of_replicas": 0 }, "mappings": { "test": { "properties": { "content": { "type": "text", "analyzer": "ik_smart", "search_analyzer": "ik_smart" } } } } }

原提问者GitHub用户linyongfu2013

展开
收起
古拉古拉 2023-05-08 16:56:13 115 0
2 条回答
写回答
取消 提交回答
  • es配置写错了吧。 _index: text

    原回答者GitHub用户1990hjp

    2023-05-09 18:36:09
    赞同 展开评论 打赏
  • 随心分享,欢迎友善交流讨论:)

    从日志信息来看,提示是“Outer adapter write failed”,即外部适配器写入失败。这可能是由于一些错误导致的,比如网络连接问题、权限问题、数据格式问题等等。建议在具体排查时,根据日志信息和错误提示,逐步排除可能引起问题的因素,定位具体的问题所在。同时也可以查看ES的错误日志,看是否有相关的报错信息。

    2023-05-08 17:01:34
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
2022 DTCC-阿里云一站式数据库上云最佳实践 立即下载
云时代的数据库技术趋势 立即下载
超大型金融机构国产数据库全面迁移成功实践 立即下载