简体   繁体   English

同步数据库

[英]Synchronizing the databases

I am developing an web application in which i need to maintain the website in the local servers itself with the database in the computer itself , the local database will change periodically.There is a central database through which i have to access all the data in all the remaining DB's . 我正在开发一个Web应用程序,其中我需要维护本地服务器本身中的网站以及计算机本身中的数据库,本地数据库将定期更改。有一个中央数据库,通过该数据库我必须访问所有数据库中的所有数据其余的DB。

The problem is that even when internet connection is disabled, the local server will update the local database but when when it regains the internet connection it has to update the central database with the local modified data. 问题在于,即使禁用了Internet连接,本地服务器也会更新本地数据库,但是当它重新获得Internet连接时,它必须使用本地修改的数据来更新中央数据库。

The tables( i mean the database schema, table names, attributes all) in all the DB's is same.The data should be appended if added any new ,should be deleted if any deleted and should be modified if any. 所有数据库中的表(我的意思是数据库模式,表名,所有属性)都是相同的。如果添加任何新数据,则应追加数据;如果删除任何数据,则应删除数据;如果有修改,则应进行修改。

I am using MySQL server as DB, Apache Tomcat as server and using JSP, Servlets for business logic. 我将MySQL服务器用作数据库,将Apache Tomcat用作服务器,并将JSP,Servlet用于业务逻辑。

Please visit http://dev.mysql.com/doc/refman/5.1/en/replication-howto.html 请访问http://dev.mysql.com/doc/refman/5.1/en/replication-howto.html

Mysql replication might do the job but there are a few things that you have to consider, like: Mysql复制也许可以完成这项工作,但是您需要考虑一些事项,例如:

  • the amount of data that has to be synchronized 必须同步的数据量
  • the OS used on master and slave servers 主从服务器上使用的操作系统
  • because of the internet connection issue - why you disable internet connection? 由于互联网连接问题-为什么您禁用互联网连接? one option might be a scheduled job (crontab) 一个选项可能是预定作业(crontab)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM