Golang binlog replication from MySQL to MySQL, PostgreSQL, Vertica, Clickhouse
See full docs here
See quick start tutorial here
src/.env.dist
to src/.env
and set credentials.examples/master/mysql.conf
.
Don't forget to set binlog_do_db=<master_db_name>
and restart MySQL service.examples/sql/
.make start-dev
cd src
and go run main.go listen
in docker container.examples/configs/user.json
and examples/configs/post.json
to src/system/configs
cd src
and go run main.go load
create-model <table>
to create json config for your table.<table>
to TABLE
param in src/.env
build-slave
to copy table data from master and set start position of log for table listener.plugins/user/<plugin_name>/handler.go
like plugins/system/set_value/handler.go
go build -buildmode=plugin -o plugins/user/<plugin_name>/handler.so plugins/user/<plugin_name>/handler.go
src/system/configs/<model>.json
"beforeSave": {
"handler": "user/<plugin_name>",
"params": [
"***"
]
}
system/set_value
as handler
param. Don't forget to set params: ["<value>"]
set-position <table> <binlog_name> <binlog_position>
set start position of log for table listenerload
start loader for replication testing (for default tables user and post)create-model <table>
create model json-file by master table structurebuild-slave
create master table dump, restore this dump in slave, set start position of log for table listenerdestroy-slave
truncate table, set empty position of log for table listenerProd mode: build app and execute listener.
Use make build-prod
and make start-prod
to start and make stop-prod
to stop.
Dev mode: provides the opportunity for manual start and debug.
Use make start-dev
to start and make stop-dev
to stop.