开发者

Remote Data Replication

Greetings Everyone

We have a mysql database running on our localhost. In that we have a table called xyz. We also need the same database to be running online. Whats the best way we can replicate? The database will be updated locally.

Additionally, there is a field in the online xyz table called开发者_StackOverflow中文版 'visits'. We wouldn't want to overwrite this particular field in the online table.

Now the records can be huge in number. My boss suggested we write a php script that copies records to the online database and flags the records that are copied. This way we do not copy twice. I know this might not be the best idea. What if a records is deleted in the online database?

Thanking You Imran


Use mysql's replication - it's the right tool for the job and will save you a lot of headaches.

If you start the servers with --replicate-wild-ignore-table=dbname.visits then that table will not be replicated.

What if a records is deleted in the online database?

Don't. Revoke delete privileges on the relevant tables and use a state flag instead. Although replication will handle such cases, it'll save a lot of pain in the long run.


The latest phpmyadmin has some features like this build in.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜