Docker installation and configuration go-mysql-transfer (mysql synchronization redis)

Click to enter the document address

Download the build image based on the binary executable file

 

 

Quote document content

Enable 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 重复

 

Modify app.yml

Open app.yml in the transfer folder of the compressed package

docker packaging

Upload the server to decompress the compressed package

Build image

docker image build -t transfer -f Dockerfile .

Note that the spaces and dots at the end are required

 Packaged successfully

 Run image

 docker run -d --name transfer:latest 
-v /usr/redisTongbu/app.yml:/app/app.yml
-p 8060:8060 transfer:latest

Note   /app/app.yml #Default docker packaging default path

Started successfully

 Open ip+8060 port access

 Supplementary matters

Open app.yml

Open app.yml in the transfer folder of the compressed package

 

 

rule:
  -
    schema: eseap #数据库名称
    table: t_user #表名称
    #order_by_column: id #排序字段,存量数据同步时不能为空
    #column_lower_case:false #列名称转为小写,默认为false
    #column_upper_case:false#列名称转为大写,默认为false
    column_underscore_to_camel: true #列名称下划线转驼峰,默认为false
    # 包含的列,多值逗号分隔,如:id,name,age,area_id  为空时表示包含全部列
    #include_columns: ID,USER_NAME,PASSWORD

Database name and table name must be filled in 

Here configure which table data you want to synchronize to redis

When you operate database data, it will be automatically synchronized to redis in real time.

By this point I believe you have already configured and deployed it to the server.

Guess you like

Origin blog.csdn.net/qq_37544675/article/details/124153209