通过 svnsync 获得存储库的只读副本有什么意义?
我一直在阅读 svnsync 以创建存储库的只读副本,但我不太明白拥有存储库的只读副本的意义是什么。如果主服务器由于某种原因出现故障,只读副本是否可以变为读/写状态,以便人们可以提交它?如果不是,那么只读副本有什么意义呢?
I've been reading up on svnsync to create a read-only copy of our repository, but I don't really understand what the point of having a read-only copy of the repository is. If the master goes down for some reason can the read-only copy become read/write so people can commit to it? If not, then what's the point of a read-only copy?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
svnsync 维护的只读存储库通常设置为提供主存储库的近实时备份。该副本被视为只读,因为通过 svnsync 以外的方式对其进行更改将阻止 svnsync 正常工作。
在主存储库丢失的情况下,您的备份存储库可以成为新的主存储库。出于所有实际目的,该副本与上次运行 svnsync 时的原始主版本相同。您可以通过从备份存储库复制文件并像以前一样继续来重建原始存储库。
或者,工作目录基于原始 master 的客户端可以执行 svn switch --relocate 操作来更新服务器 URL 以指向副本并继续顺利工作。当然,一旦客户端开始使用备份进行提交,那么它就不再是 svnsync 命令的目标,并且有效地成为新的主存储库,并且您将需要创建新的备份。
Read-only repositories maintained by svnsync are typically set up to provide near real time backup of a master repository. The copy is considered read-only because making changes to it by means other than svnsync will prevent svnsync from working properly.
In the situation that your main repository is lost, your backup repository can become the new master. For all practical purposes the copy is identical to the original master as of the last run of svnsync. You could rebuild the original repository by copying the files from the backup repository and continuing as before.
Alternatively, clients with working directories based on the original master can perform an
svn switch --relocate
operation to update the server URL to point to the copy and continue working without a hitch. Of course once clients start using the backup to make commits then it can no longer be the target of svnsync commands and effectively becomes a new master repository and you'll want to create a new backup.假设您正在谈论自己的私有存储库,则任何内容(数据库或源代码存储库或 xyz)的只读/只读副本的两个原因是减轻负载并提高性能。
如果您在存储库上运行任何类型的分析,例如涉及每个修订的流程,那么这可能会给您的主存储库带来很高的负载,从而降低开发人员的性能。同步只读/只读副本是减轻该负载的一种方法,使您可以完成工作而不会导致关键用户的降级。
类似的论点可以针对延迟进行——从本地只读/只读副本(本质上是缓存)中提取比通过 VPN 或类似链接从另一个办公室提取更容易。
Assuming you're talking about your own private repository, two reasons for a read/only copy of anything - a database or a source code repository or xyz - are to relieve load and improve performance.
If you're running any kind of analytics over your repository, say a process that touches every revision, then this might place a high load on your main repository, degrading performance for developers. Syncing a read/only copy is a way to relieve that load, allowing you to get the job done without causing degredation for key users.
A similar argument can be made over latency - easier to pull down from a local read/only copy (essentially a cache) than to pull from another office over a VPN or similar link.
我不知道您是否可以同步读/写,但在很多情况下,您想要检查存储库的内容而不允许提交它。以下是与我们在我工作的地方所做的非常相似的两个案例:
想象这是一个公共开源项目,您可以允许任何人签出,但只能期望通过补丁或错误报告做出贡献(副本也是 假设这是一个
您可能希望通过自动构建系统(或某些分析工具)中的 svn 导出来使用 svn 的内容,但选择并非始终同步,而是仅在主 svn 处于稳定状态时(想象一下某些中间提交可能会使代码处于不稳定状态,即代码无法编译)。
I don't know if you can make you sync read/write, but there is many cases when you want to check out the content of a repository without ever allowing comiting to it. Below are two cases very similar to what we do at the place I work:
Imagine this is a public open source project, you can allow check-out for anybody but only expect contributions through patches or bug reports (also the copy is put on a public server and the main one is kept in a protected private network).
You may want to use the content of the svn through an svn export in an automated build system (or some analysis tool), but choose to sync not all the time but only when main svn is in a stable state (imagine some intermediate commits could leave the code in an unstable state where the code is not compiling).
备份您最喜欢的开源程序源:)。
Make a backup of your favourite open-source program sources :).