Boris Villazon wrote:


Step 1
The secondary pc copies only the new incoming data from primary pc database.

Step 2
When the secondary pc copies the data, the primary pc has to delete all these copied records (in the local database).

Could I use replication technique to achieve this process? If yes, How can I make this 
with replication technique?
Or Is there another posibility to handle this process (I mean automatic posibility)?

This procedure won't work with replication.
Step 1 would be OK but step 2 breaks the replication paradigm since the idea of replication is to keep both databases with identical content.


You'll need additional software that fetches data from server 1, dumps it into server 2 and then issues a DELETE command on server 1.

Probaply you could do something like this:

Server 1 :
DB with new data = db_new_data

Server 2 :
1) a replicated copy of db_new_data
2) another database = db_old_data

now you could let the replication process run and sometimes you
1) stop the replication
2) copy the content of [EMAIL PROTECTED] to [EMAIL PROTECTED]
3) check for the last inserted id, save it to some variable X
4) send a 'DELETE * FROM my_data_table WHERE id <= X' to server_1
5) restart replication

Now the delete command gets replicated to server_2 and the now backed up old data is thrown out of the db_new_data on both sides.
The new data that was collectd while you shoveled stuff around was stored on server 1.


Sounds easy enough.
Now find someone who knows some script language like PERL well enough to write a cron job.


Maybe you won't even need a second database on server 2. Perhaps another data table will do, too. I don't know if the replicated db has to remain 100% identical.
Important is to let replication erase the copied data on server 2. Otherwise mysql's replication will just stop and issue an error.



Have a nice sunday




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to