Solved

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

Posted on 2014-12-05
5
233 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 143

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 143

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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been using r1soft Continuous Data Protection (http://www.r1soft.com/linux-cdp/) for many years now with the mySQL Addon and wanted to share a trick I have used several times. For those of us that don't have the luxury of using all transact…
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

696 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