简体   繁体   English

在2台主机之间同步数据库

[英]Synchronise database between 2 hosts

I build a mirror host for my web site. 我为我的网站构建一个镜像主机。 I use Lsyncd for the synchronisation of project files and it works perfectly. 我使用Lsyncd进行项目文件的同步,并且效果很好。

For the database, what is the best way to make a synchronisation between the master and the mirror server? 对于数据库,在主服务器和镜像服务器之间进行同步的最佳方法是什么?

The best solution is to set up database replication in MySQL. 最好的解决方案是在MySQL中设置数据库复制。 MySQL replication allows you to have an exact copy of a database from a master server on another server (slave), and all updates to the database on the master server are immediately replicated to the database on the slave server so that both databases are in sync. MySQL复制使您可以从另一个服务器(从属服务器)上的主服务器上获得数据库的精确副本,并且对主服务器上的数据库的所有更新都将立即复制到从服务器上的数据库,以便两个数据库同步。

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

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