使用logstash同步mysql 多表数据到ElasticSearch实践
2024-10-20 06:35:29
参考样式即可,具体使用配置参数根据实际情况而定
input {
jdbc {
jdbc_connection_string => "jdbc:mysql://localhost/数据库名"
jdbc_user => "root"
jdbc_password => "password"
jdbc_driver_library => "mysql-connector-java-5.1.45-bin.jar所在位置"
jdbc_driver_class => "com.mysql.jdbc.Driver"
codec => plain {charset => "UTF-8"}
record_last_run => true
jdbc_paging_enabled => "true"
jdbc_page_size => "1000"
statement => "sql statement"
schedule => "* * * * *"
type => "数据库表名1"
tags => "数据库表名1"
}
jdbc {
jdbc_connection_string => "jdbc:mysql://localhost/数据库名"
jdbc_user => "root"
jdbc_password => "password"
jdbc_driver_library => "mysql-connector-java-5.1.45-bin.jar所在位置"
jdbc_driver_class => "com.mysql.jdbc.Driver"
codec => plain {charset => "UTF-8"}
record_last_run => true
jdbc_paging_enabled => "true"
jdbc_page_size => "1000"
statement => "sql statement"
schedule => "* * * * *"
type => "数据库表名2"
tags => "数据库表名2"
}
}
filter {
json {
source => "message"
remove_field => ["message"]
}
}
output {
if [type] == "数据库表名1"{
elasticsearch {
hosts => ["els的host地址"]
index => "数据库表名1对应的els的index"
document_id => "%{唯一id}"
}
}
if [type] == "数据库表名2"{
elasticsearch {
hosts => ["els的host地址"]
index => "数据库表名2对应的els的index"
document_id => "%{唯一id}"
}
}
stdout {
codec => json_lines
}
}
最新文章
- 未在本地计算机上注册“Microsoft.Jet.OleDb.4.0”提供程序。解决办法
- Web应用数据库配置参数读取方法之一
- IT菜鸟的3(for循环+分支语句)
- iOS UICollectionView 入门 07 点击cell放大图片
- DebuggingWithGdb
- Js 简单分页(一)
- Linux学习笔记6-Linux根目录下各个目录的作用
- BZOJ 2038: [2009国家集训队]小Z的袜子(hose)&;&;莫对算法
- VR全景智慧城市搭建掀起实体市场潮流
- 使用Dropwizard(2)-配置分类ConfiguredBundle
- [编织消息框架][JAVA核心技术]动态代理介绍
- RabbitMQ消息队列
- 逆元知识普及(进阶篇) ——from Judge
- use this method get wifi from notebook
- Android中的AlarmManager的使用
- python 多个脚本
- jpa-入门级测试
- Python面试题(十一)
- mycat安装
- 【遍历二叉树】03二叉树的后序遍历【Binary Tree Postorder Traversal】
热门文章
- elasticsearchTemplate that could not be found
- CS内网横向移动 模拟渗透实操 超详细
- CSS 上下居中和最低高度语法
- 使用Python3.7配合协同过滤算法(base on user,基于人)构建一套简单的精准推荐系统(个性化推荐)
- npm run dev 启动项目报错我的解决办法
- Win10文件、文件夹被占用解决方法
- MyBatis 03 缓存
- Java注解最全详解(超级详细)
- 在 Linux 安装 Java 的流程
- [CSP-S 2019 day2 T1] Emiya家今天的饭