简体   繁体   English

如何自动同步集群中的文件?

[英]How do I automatically sync a file in cluster?

I have a website growing very fast, and now I put it in several web servers. 我的网站发展非常迅速,现在我将其放入多个Web服务器中。 Now the problem is how do I sync files between them; 现在的问题是如何在它们之间同步文件。 I use SVN to manage my source code, I could only commit the source code one by one now, is there a solution to commit the source code to one server and automatically sync to other servers? 我使用SVN来管理源代码,现在只能一次提交一个源代码,是否有解决方案将源代码提交到一台服务器并自动同步到其他服务器?

You can have read-only mirrors, but (as I understand it) you have to have only a single read/write master repository. 您可以具有只读镜像,但是(据我了解),您只必须具有一个读/写主存储库。 It involves setting up some hook scripts that are run when commits are made. 它涉及设置一些在提交时运行的挂钩脚本。 See this reference: 请参阅此参考资料:

http://svnbook.red-bean.com/en/1.7/svn.reposadmin.maint.html#svn.reposadmin.maint.replication http://svnbook.red-bean.com/en/1.7/svn.reposadmin.maint.html#svn.reposadmin.maint.replication

Note that if your master (read/write) node goes down, you can convert one of the (read-only) mirror nodes to be the master. 请注意,如果您的主节点(读/写)发生故障,则可以将其中一个(只读)镜像节点转换为主节点。

If you truly need multiple read/write mirrors, you'll probably have to look outside of subversion's provided capabilities. 如果您确实需要多个读/写镜像,则可能必须查看Subversion提供的功能之外。 The big problem will be if the synchronization process can't keep up with check-ins happening at different mirrors, either due to simultaneous check-ins or intermittent network connectivity. 最大的问题将是,由于同步签入或间歇性网络连接,同步过程是否无法跟上在不同镜像上发生的签入。 Could get to be a real headache. 可能真是头疼。 To avoid such headaches, you might want to consider a distributed version control system, such as hg or git. 为避免此类麻烦,您可能需要考虑使用分布式版本控制系统,例如hg或git。

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

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