# gf-mysql-transfer **Repository Path**: it00021hot/gf-mysql-transfer ## Basic Information - **Project Name**: gf-mysql-transfer - **Description**: gf-mysql-transfer是一款基于go-mysql-transfer开发的MySQL数据库实时增量同步工具。 能够监听MySQL二进制日志(Binlog)的变动,将变更内容形成指定格式的消息,实时发送到接收端。从而在数据库和接收端之间形成一个高性能、低延迟的增量数据同步更新管道。 - **Primary Language**: Go - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 6 - **Forks**: 2 - **Created**: 2022-05-06 - **Last Updated**: 2025-09-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README [![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) # 简介 gf-mysql-transfer是一款基于go-mysql-transfer开发的MySQL数据库实时增量同步工具。 点击了解: [go-mysql-transfer](https://github.com/wj596/go-mysql-transfer) 本项目在go-mysql-transfer基础上扩展了Mysql、Mariadb、Tidb、Mssql、Pgsql等接收端 # 特性 1、简单,不依赖其它组件,一键部署 2、集成多种接收端,如:Redis、MongoDB、Elasticsearch、RocketMQ、Kafka、RabbitMQ、Mysql、Mariadb、Tidb、Mssql、Pgsql、clickhouse、达梦数据库、HTTP API等,无需编写客户端,开箱即用 3、内置丰富的数据解析、消息生成规则、模板语法 4、支持Lua脚本扩展,可处理复杂逻辑 5、集成Prometheus客户端,支持监控告警 6、集成Web Admin监控页面 7、支持高可用集群部署 8、数据同步失败重试 9、支持全量数据初始化 # 原理 1、将自己伪装为MySQL的Slave监听binlog,获取binlog的变更数据 2、根据规则或者lua脚本解析数据,生成指定格式的消息 3、将生成的消息批量发送给接收端 # 与同类工具比较
特色 Canal mysql_stream gf-mysql-transfer
开发语言 Java Python Golang
高可用 支持 支持 支持
接收端 编码定制 Kafka等(MQ) Redis、MongoDB、Elasticsearch、RocketMQ、Kafka、RabbitMQ、Mysql、Mariadb、Tidb、Mssql、Pgsql、clickhouse、达梦数据库、HTTP API
后续支持更多
全量数据初始化 不支持 支持 支持
数据格式 编码定制 Json(固定格式) Json(规则配置)
模板语法
Lua脚本
# 安装包 **二进制安装包** 直接下载安装包: [点击下载](https://gitee.com/it00021hot/gf-mysql-transfer/releases) **源码编译** 1、安裝Golang SDK 2、设置' GO111MODULE=on ' 3、拉取源码 ' git clone https://gitee.com/it00021hot/gf-mysql-transfer.git ' 4、进入目录,执行 ' go build '编译 # 全量数据初始化 ```shell gf-mysql-transfer serve stock ``` # 运行 **开启MySQL的binlog** ``` #Linux在my.cnf文件 #Windows在my.ini文件 log-bin=mysql-bin # 开启 binlog binlog-format=ROW # 选择 ROW 模式 server_id=1 # 配置 MySQL replaction 需要定义,不要和 go-mysql-transfer 的 slave_id 重复 ``` **命令行运行** 1、修改config/config.yaml 2、Windows直接运行 gf-mysql-transfer serve start 3、Linux执行 nohup gf-mysql-transfer serve start & # 使用说明 * [高可用集群](https://www.kancloud.cn/wj596/go-mysql-transfer/2116627) * [同步数据到Redis](https://www.kancloud.cn/wj596/go-mysql-transfer/2064427) * [Redis配置](https://www.kancloud.cn/wj596/go-mysql-transfer/2111996) * [基于规则同步](https://www.kancloud.cn/wj596/go-mysql-transfer/2111997) * [基于Lua脚本同步](https://www.kancloud.cn/wj596/go-mysql-transfer/2111998) * [同步数据到MongoDB](https://www.kancloud.cn/wj596/go-mysql-transfer/2064428) * [MongoDB配置](https://www.kancloud.cn/wj596/go-mysql-transfer/2111999) * [基于规则同步](https://www.kancloud.cn/wj596/go-mysql-transfer/2112000) * [基于Lua脚本同步](https://www.kancloud.cn/wj596/go-mysql-transfer/2112001) * [同步数据到RocketMQ](https://www.kancloud.cn/wj596/go-mysql-transfer/2064429) * [RocketMQ配置](https://www.kancloud.cn/wj596/go-mysql-transfer/2112002) * [基于规则同步](https://www.kancloud.cn/wj596/go-mysql-transfer/2112003) * [基于Lua脚本同步](https://www.kancloud.cn/wj596/go-mysql-transfer/2112004) * [同步数据到Kafka](https://www.kancloud.cn/wj596/go-mysql-transfer/2064430) * [Kafka配置](https://www.kancloud.cn/wj596/go-mysql-transfer/2112005) * [基于规则同步](https://www.kancloud.cn/wj596/go-mysql-transfer/2112006) * [基于Lua脚本同步](https://www.kancloud.cn/wj596/go-mysql-transfer/2112007) * [同步数据到RabbitMQ](https://www.kancloud.cn/wj596/go-mysql-transfer/2064431) * [RabbitMQ配置](https://www.kancloud.cn/wj596/go-mysql-transfer/2112008) * [基于规则同步](https://www.kancloud.cn/wj596/go-mysql-transfer/2112009) * [基于Lua脚本同步](https://www.kancloud.cn/wj596/go-mysql-transfer/2112010) * [同步数据到Elasticsearch](https://www.kancloud.cn/wj596/go-mysql-transfer/2064432) * [Elasticsearch配置](https://www.kancloud.cn/wj596/go-mysql-transfer/2112011) * [基于规则同步](https://www.kancloud.cn/wj596/go-mysql-transfer/2112012) * [基于Lua脚本同步](https://www.kancloud.cn/wj596/go-mysql-transfer/2112013) * [同步到DB(mysql为例)](docs/mysql/mysql.md) * [DB配置](docs/mysql/mysql.md) * [基于规则同步](docs/mysql/mysql_rule.md) * [基于Lua脚本同步](docs/mysql/mysql_lua.md) * 扩展更多DB支持:参考GoFrame官网:[ORM接口开发](https://goframe.org/pages/viewpage.action?pageId=1114701) * [全量数据导入](https://www.kancloud.cn/wj596/go-mysql-transfer/2116628) * [Lua脚本](https://www.kancloud.cn/wj596/go-mysql-transfer/2064433) * [基础模块](https://www.kancloud.cn/wj596/go-mysql-transfer/2112014) * [Json模块](https://www.kancloud.cn/wj596/go-mysql-transfer/2112015) * [HttpClient模块](https://www.kancloud.cn/wj596/go-mysql-transfer/2112016) * [DBClient模块](https://www.kancloud.cn/wj596/go-mysql-transfer/2112017) * [监控](https://www.kancloud.cn/wj596/go-mysql-transfer/2064434) * [性能测试](https://www.kancloud.cn/wj596/go-mysql-transfer/2116629) * [常见问题](https://www.kancloud.cn/wj596/go-mysql-transfer/2064435) # 感谢 * [go-mysql-transfer](https://github.com/wj596/go-mysql-transfer) * [goframe](https://goframe.org/) * [go-mysql](https://github.com/go-mysql-org/go-mysql) * [go-mysql-elasticsearch](https://github.com/go-mysql-org/go-mysql-elasticsearch) * [go-redis](https://github.com/go-redis/redis) * [rocketmq-client-go](https://github.com/apache/rocketmq-client-go)