?
Solved

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

Posted on 2014-12-05
5
Medium Priority
?
256 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
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

770 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