Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2014-12-05
5
Medium Priority
?
274 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 1500 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
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
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

609 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