kirupha karan
kirupha karan

Reputation: 3

How to replicate ten databases tables in single database using mysql

We are using MYSQL in that we have 10 databases as single project. my problem is to auto-merge 10 database tables into single database using replication.

for example :
MasterDatabases

database1
....table1
....table2

database2
....table21
....table22

database3
....table31
....table33

Replication Database

slavedatabase
....table1
....table2
....table21
....table22
....table31
....table33

Upvotes: 0

Views: 134

Answers (1)

fancyPants
fancyPants

Reputation: 51888

You can use --replicate-rewrite-db for that.

Tells the slave to create a replication filter that translates the default database (that is, the one selected by USE) to to_name if it was from_name on the master. Only statements involving tables are affected (not statements such as CREATE DATABASE, DROP DATABASE, and ALTER DATABASE), and only if from_name is the default database on the master. To specify multiple rewrites, use this option multiple times. The server uses the first one with a from_name value that matches. The database name translation is done before the --replicate-* rules are tested. You can also create such a filter by issuing a CHANGE REPLICATION FILTER REPLICATE_REWRITE_DB statement.

Read more about it here.

Upvotes: 1

Related Questions