Horgh replicator is a tool to merge data from any databases in one storage.
server-id = 1
log-slave-updates
binlog-format = row
log-bin = /var/log/mysql/mysql-bin.log
binlog_do_db=<replicated_db>
service mysql restart
git clone https://github.com/larsnovikov/horgh-replicator
src/.env.dist to src/.env.src/.env
src/.envSLAVE_TYPE. Available values: mysql, clickhouse, vertica, postgresql
make start-dev
go run main.go create-model <table_name>
<table_name> to TABLE in src/.env (One instance - one table)
go run main.go build-slave
go run main.go listen
make build-prodmake start-prod
If you need to handle some values of fields before save, you can use special handlers.
system/set_value - Set field value as first value from param section
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": [
"***"
]
}
set-position <table_name> <binlog_name> <binlog_position> set start position of log for table listener
load start loader for replication testing (for default tables user and post)
create-model <table_name> create model json-file by master table structure
build-slave create master table dump, restore this dump in slave, set start position of log for table listener
destroy-slave truncate table, set empty position of log for table listener
Lars Novikov
Email: larsnovikov@yandex.ru
Telegram: larsnovikov