Solved

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

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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

All XML, All the Time; More Fun MySQL Tidbits – Dynamically Generate XML via Stored Procedure in MySQL Extensible Markup Language (XML) and database systems, a marriage we are seeing more and more of.  So the topics of parsing and manipulating XM…
Foreword This is an old article.  Instead of using the MySQL extension that was used in the original code examples, please choose one of the currently supported database extensions instead.  More information is available here: MySQLi / PDO (http://…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
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…

777 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