Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm looking for an efficient way to keep multiple databases (on different servers) sync with a master database (also on a different server). Mind you I only need a one way sync (from master to all others).

As I was searching I came across multiple solutions.

  • replication : Which (from what I read) is unreliable, because if the slave servers or down temporarily or anything like that, they end up missing information. (Please correct me if I'm wrong)
  • Injection : Which I also think is unreliable, not to mention a security problem because you're directly communicating with the slave databases.

Since I didn't like what I saw, I decided to make my own system (ultimately not liking it either) My system was to make a new table called ORDERS , and would basically hold values that could be translated as "Delete item with id 32 in table someTable" and on the slave side they would follow each of these instructions.

What do you think is the best way? The database is really small (with at most 3000 entries), so I want a really simple solution. Thanks

share|improve this question

migrated from webmasters.stackexchange.com Dec 13 '11 at 12:50

This question came from our site for pro webmasters.

    
I think you need to re-read the documentation on MySQL replication. There are no such constraints as you mentioned. MySQL replication is designed specifically for this task, and it's meant to be asynchronous, so your slave servers don't need to be connected or up all the time. I also don't know what you mean by "injection". –  Lèse majesté Dec 12 '11 at 2:01
    
injection is when you directly log into another database, and do your inserts/deletes/updates etc right on the database. @Lèsemajesté Would you be so kind as to post what replication actually does then as an answer? I've been reading different sources online, and that's the impression I got. Thank's for all the help –  vvMINOvv Dec 12 '11 at 2:29

1 Answer 1

You can use the following script to sync tables from a remote database server to a local database server.

mysqldump -al -h [remote-host] --password=[passwd] --user=[username] 
  --add-drop-table [db-name] | mysql --user=[username] --password=[passwd]
  -h localhost [db-name]
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.