starcwang / Canal_mysql_elasticsearch_sync
Licence: apache-2.0
基于canal的mysql和elasticsearch实时同步方案,支持增量同步和全量同步
Stars: ✭ 410
Programming Languages
java
68154 projects - #9 most used programming language
Projects that are alternatives of or similar to Canal mysql elasticsearch sync
Microservices Sample
Sample project to create an application using microservices architecture
Stars: ✭ 167 (-59.27%)
Mutual labels: mysql, elasticsearch
Dotmim.sync
A brand new database synchronization framework, multi platform, multi databases, developed on top of .Net Standard 2.0. https://dotmimsync.readthedocs.io/
Stars: ✭ 406 (-0.98%)
Mutual labels: mysql, synchronization
Lyonblog
基于Java8的SSM+Elasticsearch全文检索的个人博客系统
Stars: ✭ 169 (-58.78%)
Mutual labels: mysql, elasticsearch
Wipi
nextjs + nestjs + TypeScript +MySQL 开发的前后端分离,服务端渲染的博客系统
Stars: ✭ 163 (-60.24%)
Mutual labels: mysql, elasticsearch
Doctor
基于知识图谱的医学诊断系统。Medical Diagnosis System Based on Knowledge Map.
Stars: ✭ 286 (-30.24%)
Mutual labels: mysql, elasticsearch
Learningsummary
涵盖大部分Java进阶需要掌握的知识,包括【微服务】【中间件】【缓存】【数据库优化】【搜索引擎】【分布式】等等,欢迎Star~
Stars: ✭ 201 (-50.98%)
Mutual labels: mysql, elasticsearch
Echo
🦄 开源社区系统:基于 SpringBoot + MyBatis + MySQL + Redis + Kafka + Elasticsearch + Spring Security + ... 并提供详细的开发文档和配套教程。包含帖子、评论、私信、系统通知、点赞、关注、搜索、用户设置、数据统计等模块。
Stars: ✭ 129 (-68.54%)
Mutual labels: mysql, elasticsearch
Mysqlsmom
同步mysql数据到elasticsearch的工具,功能丰富,用法简单,配置灵活,扩展性强;
Stars: ✭ 268 (-34.63%)
Mutual labels: mysql, elasticsearch
Spring Boot Enterprise Application Development
Spring Boot Enterprise Application Development.《Spring Boot 企业级应用开发实战》
Stars: ✭ 261 (-36.34%)
Mutual labels: mysql, elasticsearch
Pifpaf
Python fixtures and daemon managing tools for functional testing
Stars: ✭ 161 (-60.73%)
Mutual labels: mysql, elasticsearch
Canal Elasticsearch
基于阿里巴的canal向elasticsearch中同步数据mysql数据的小工具
Stars: ✭ 147 (-64.15%)
Mutual labels: mysql, elasticsearch
Frostmourne
frostmourne是基于Elasticsearch, InfluxDB数据,Mysql数据的监控,报警,分析系统. Monitor & alert & alarm & analyze for Elasticsearch && InfluxDB Log Data。主要使用springboot2 + vue-element-admin。 https://frostmourne-demo.github.io/
Stars: ✭ 166 (-59.51%)
Mutual labels: mysql, elasticsearch
Operators
Collection of Kubernetes Operators built with KUDO.
Stars: ✭ 175 (-57.32%)
Mutual labels: mysql, elasticsearch
Transformalize
Configurable Extract, Transform, and Load
Stars: ✭ 125 (-69.51%)
Mutual labels: mysql, elasticsearch
Griffon Vm
Griffon Data Science Virtual Machine
Stars: ✭ 128 (-68.78%)
Mutual labels: mysql, elasticsearch
Typo3 Docker Boilerplate
🍲 TYPO3 Docker Boilerplate project (NGINX, Apache HTTPd, PHP-FPM, MySQL, Solr, Elasticsearch, Redis, FTP)
Stars: ✭ 240 (-41.46%)
Mutual labels: mysql, elasticsearch
Xboot
基于Spring Boot 2.x的一站式前后端分离快速开发平台XBoot 微信小程序+Uniapp 前端:Vue+iView Admin 后端:Spring Boot 2.x/Spring Security/JWT/JPA+Mybatis-Plus/Redis/Elasticsearch/Activiti 分布式限流/同步锁/验证码/SnowFlake雪花算法ID 动态权限 数据权限 工作流 代码生成 定时任务 社交账号 短信登录 单点登录 OAuth2开放平台 客服机器人 数据大屏 暗黑模式
Stars: ✭ 3,432 (+737.07%)
Mutual labels: mysql, elasticsearch
canal_mysql_elasticsearch_sync 支持请star✨
交流Q群:733688083
canal于v1.1.2版本后,已支持自动同步到Elasticsearch。赞canal!canal传送门
基于 canal 的 Mysql 与 Elasticsearch 实时同步的 javaweb 服务。
canal是阿里巴巴mysql数据库binlog的增量订阅&消费组件。
工作原理
全量
暴露Http接口(接口定义见wiki),待调用后开启后台线程,通过主键分批同步指定数据库中数据到Elasticsearch
读取数据库会加读锁
主键必须为数字类型
过程
- 首先会根据所给的数据库主键字段,拿到最大的主键数字max_id;
- 设pk=min_id(默认是数据库中的主键最小值);
- 加读锁🔐,从数据库中取出pk —— pk+stepSize 大小的数据(默认500)的数据;
- 插入到Elasticsearch中;
- 释放读锁🔐,pk累加stepSize,循环3.操作,直到pk>max_id
增量
循环监听canal通过binlog同步过来的event事件,区别增删改进行与之对应的Elasticsearch的操作。
目前只解析了 insert、update、delete,其它数据库操作会被忽略
默认相关字段映射
Mysql字段类型 | Elasticsearch类型 |
char | {"type": "text", "fields": {"keyword": {"type": "keyword", "ignore_above": 256}} |
text | {"type": "text", "fields": {"keyword": {"type": "keyword", "ignore_above": 256}} |
blob | {"type": "text", "fields": {"keyword": {"type": "keyword", "ignore_above": 256}} |
int | {"type": "long"} |
date | {"type": "date"} |
time | {"type": "date"} |
float | {"type": "float"} |
double | {"type": "float"} |
decimal | {"type": "float"} |
其它 | {"type": "text", "fields": {"keyword": {"type": "keyword", "ignore_above": 256}} |
注意事项
- Mysql的binlog格式必须为ROW
- 因为有行锁,Mysql中table使用的存储引擎须为InnoDB
- 由于使用binlog进行增量同步,和数据库主从类似,不可避免的会有一定的主从延迟,延迟时间取决于机房网络、机器负载、数据量大小等
- Elasticsearch支持的版本为5.x
- canal已测试版为v1.0.24,其他版本请自行测试
- 增量同步只监听了 INSERT、UPDATE、DELETE,其它如建表、删表等尚未支持
- 建议Elasticsearch的mapping手动来创建,因为默认的创建方式不能保证满足业务需求
相关文档
联系方式
如果有不合理的地方,还请不吝赐教。
- QQ群:733688083
支持记得star✨
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].