Solved

how to set mysql replicate only for inserts only and not updates

Posted on 2014-12-05
5
220 Views
Last Modified: 2015-02-05
Is there any way to set Mysql replication just for inserts in the slave and not updates or deletes.
0
Comment
Question by:CCVOIP
  • 2
  • 2
5 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 40483827
Replication between servers in MySQL is based on the binary logging mechanism.
=> hence, replication cannot be limited to only inserts, it is then not called "replication" anymore
what is the idea behind this request?
0
 
LVL 7

Expert Comment

by:Phil Davidson
ID: 40484314
You could have a trigger perform on insert.  But this wouldn't be true replication.  But it could push the data to another server upon an insert event.
0
 

Author Comment

by:CCVOIP
ID: 40485262
the idea behind it is that at some point I want to delete some data within the production server without  affecting the data in the replica server
0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 40485391
the idea behind it is that at some point I want to delete some data within the production server without  affecting the data in the replica server
still that is how you want to achieve the "something", but not why you want to do that.
also, what about updates? to be replicated or not.

the "how" solution may be that instead of trying to "disable" the deletes to propagate on the replication, you may want to have some "historical tables", or a "deleted flag" or a "valid from date + valid to date" field on the record (update via replicate as by normal process) instead of actually deleting the record, and to implement the "why" (some need to see "old" data) using those techniques, while the "life" data only takes the "non-deleted" data on a logical level

hope this gives you the understanding of the difference of the "why" and some ideas on how to approach the "how" from different technical points without trying to workaround the technical built-in tools (replication) by applying some normal technical implementation following the application needs.
0
 

Author Comment

by:CCVOIP
ID: 40497426
Got it, thanks for your advise.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Loading csv or delimited data files to MySQL database is a very common task frequently questioned about and almost every time LOAD DATA INFILE comes to the rescue. Here we will try to understand some of the very common scenarios for loading data …
I use MySQL for many of my development projects in a Windows environment. To manage my databases (and perform queries) for years I used a tool called MySQL administrator.  This tool has since been replaced by MySQL Workbench. So I decided to m…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now