MySQL table structure Sync tool Mysql-schema-sync

Source: Internet
Author: User

Mysql-schema-sync is a cross-platform , green, non- dependent MySQL table structure Automatic synchronization tool that is developed using go.
Used to synchronize changes in the database structure of a line (other environment) to a test (local) environment!

Can solve the multi-person development, each person uses the independent database causes the structure to be different the question!

Support Features:
1. Synchronizing New tables
2. Synchronization field changes: New, modified
3. Synchronizing index changes: New, modified
4. Synchronization field, index screen change update
5. Support Preview (only compared to non-synchronized changes)
6. Email notification change result configuration

Refer to the default profile Config.json Configure the synchronization source, destination address.
Modify the recipient of the message you can receive an email notification when the run fails or there is a change in the table structure.

By default, no more tables, fields, and indexes are deleted. If you need to delete a field, the index can use the-drop parameter.

Configuration Example (Config.json):

?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21st

22

23

{

//source:同步源

"source":"test:[email protected](127.0.0.1:3306)/test_0",

//dest:待同步的数据库

"dest":"test:[email protected](127.0.0.1:3306)/test_1",

//alter_ignore: 同步时忽略的字段和索引

"alter_ignore":{

"tb1*":{

"column":["aaa","a*"],

"index":["aa"]

}

},

//  tables: tableto check schema,default is all.eg :["order_*","goods"]

"tables":[],

//有变动或者失败时,邮件接收人

"email":{

"send_mail":false,

"smtp_host":"smtp.163.com:25",

"from":"[email protected]",

"password":"xxx",

"to":"[email protected]"

}

}JSON Configuration Item Description

Source: Database Synchronization sources
Dest: Database to be synchronized
Tables: arrays, which are configured to synchronize tables, are not limited to NULL, eg: ["goods", "order_*"]
Alter_ignore: Ignore modified configuration, table name is tablename, you can configure column and index, support wildcard character *
Email: send email notification message to run when sync is complete

?

1

2

3

4

5

#运行同步

mysql-schema-sync-conf mydb_conf.json -sync

#预览并生成变更sql

mysql-schema-sync-conf mydb_conf.json 2>/dev/null >db_alter.sql Automatic timing operation

Add Crontab Task

* * * * * cd/your/path/xxx/&& bash check.sh >/dev/null 2>&1 parameter description

Mysql-schema-sync [-conf] [-dest] [-source] [-sync] [-drop]

Description

#mysql-schema-sync-help-conf String configuration file name-dest string mysql sync source, eg [email protected] (127.0.0.1:3 306)/test_0-drop whether to delete the locally-out fields and indexes by default no-source string database to be synchronized eg: [email protected] (10.10.0.1:3306)/t  Est_1 the entry is not empty, ignores the read-in-conf parameter entry-sync whether to synchronize the modifications to the database, default no-tables string to be checked for synchronized database tables, and empty is all eg : product_base,order_*
Source: Http://git.oschina.net/hidu/mysql-schema-sync

MySQL table structure Sync tool Mysql-schema-sync

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.