不为失败找理由,要为成功找方法。

使用 logstash-6.4.2 的 logstash-input-jdbc 插件从 MySQL导入数据到 ES 中,发生错误

Elasticsearch | 作者 mghio | 发布于2018年10月12日 | 阅读数:2702

logstash.conf 配置文件:
 input {
  stdin {
  }
  jdbc {
  # mysql jdbc connection string to our backup databse  后面的test对应mysql中的test数据库
  jdbc_connection_string => "jdbc:mysql://127.0.0.1:3306/es_db"
  # the user we wish to excute our statement as
  jdbc_user => "root"
  jdbc_password => "root"
  # the path to our downloaded jdbc driver
  jdbc_driver_library => "lib\mysql-connector-java-5.1.38.jar"
  # the name of the driver class for mysql
  jdbc_driver_class => "com.mysql.jdbc.Driver"
  jdbc_paging_enabled => "true"
  jdbc_page_size => "500000"
#以下对应着要执行的sql的绝对路径。
  statement_filepath => "D:\elasticsearch\elasticsearch-6.4.2\logstash\bin\lib\jdbc.sql"
#定时字段 各字段含义(由左至右)分、时、天、月、年,全部为*默认含义为每分钟都更新
  schedule => "* * * * *"
#设定ES索引类型
  type => "esim_interface_log_type"
  }
}

filter {
  json {
  source => "message"
  remove_field => ["message"]
  }
}

output {
  elasticsearch {
#ESIP地址与端口
  hosts => "127.0.0.1:9200"
#ES索引名称(自己定义的), 6.x 之后默认只有一个(doc)
# index => "cc_index"
#自增ID编号
# document_id => "%{id}"
  }
  stdout {
#以JSON格式输出
  codec => json_lines
  }
}

错误信息.png

 
已邀请:

dawn1ng

赞同来自:

尝试删除.logstash_jdbc_last_run
参考https://discuss.elastic.co/t/l ... 188/8

mghio - JAVA搬运工&终身学习者

赞同来自:

好的,谢谢

要回复问题请先登录注册