By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,742 Members | 773 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,742 IT Pros & Developers. It's quick & easy.

how could mysql copy only inserted data to the central-database?

P: n/a
we are designing a data collecting system, at each site we have a
database and have a central database,we will write data to site's
database, we want the site-database can publish
the data to central-database Asynchronously, how could we do that?

single replication sounds work,but it will replicate all update
,including delete ,we dont want that,we want only inserted data .

Mar 23 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
ro*******@gmail.com wrote:
we are designing a data collecting system, at each site we have a
database and have a central database,we will write data to site's
database, we want the site-database can publish
the data to central-database Asynchronously, how could we do that?

single replication sounds work,but it will replicate all update
,including delete ,we dont want that,we want only inserted data .


This is something I have seen done in many different ways. Basically
your central database is a slave to many masters - unless you also push
something to the remote databases on a regular basis (n-way
replication). I have not read all of the rules and abilities of the
replication options, but so far I do not see how to restrict your
replicated data to just insert/update. Maybe this weekend I will see if
I can dig something up.

Make sure your tables that are to be replicated have an insert timestamp
and an update timestamp. you would then write a process that would
extract records inserted/updated since last update (have an update table
that uses a timestamp to determine the "end of the last period") and
push those records to the central repository.

Now what gets really fun here is any referencial integrity that must be
maintained. Description tables must be uploaded before data tables etc...

Just thought of something...
If you use multi-master replication it might be possible to have a
tablename in the slave (central-server) that has a before-delete trigger
to move the data to a "history" table.

These are all things you will need to consider and I generally charge
big $$$ for creating/designing such databases :)

Mar 24 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.