如何移动Git存储库并最大限度地减少停机时间 [英] How to move Git repositories and minimize downtime
本文介绍了如何移动Git存储库并最大限度地减少停机时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将把旧的SCM服务器上的Git存储库移动到新的服务器上。我的主要关注点(当然不是保真度)是为了尽量减少停机时间。这是我的计划:
- 在新机器上,使用
克隆每个存储库git clone --mirror $
- 复制每个存储库的回购钩子
- 禁止访问旧服务器(我们使用gitosis,因此除去所有用户的访问对于新服务器)
- 移动DNS条目,以便DNS别名Git用户使用
- 执行
git pull $
- 对于新服务器上的每个存储库,编辑配置文件以删除
code> section。远程origin
- 打开对新服务器的访问权限
- 复制每个存储库的回购钩子
/ p>
- 这看起来合适吗?我特别关心第6步。
- 是否有任何方法可以减少停机时间?
Thanks。
解决方案
我会(如果旧服务器和新服务器之间没有可能的通信) / p>
- 捆绑每个回购使用
git bundle
- 新服务器
- 从每个包中的捆绑包创建裸回购
-
git fetch
空裸回购(无设置起源) - 复制悬停钩子
- 禁止访问旧服务器
> - 在每个回购库上创建最后一个git捆绑包(增量捆绑包,非常快)
- 复制这些小捆绑包
- code> git fetch 小增量包的增量
宕机时间:无起始地址移动> - 恢复访问权限
- 我会创建一个特殊的迁移gitosis用户,所有项目的访问权限
-
clone --bare
新服务器上的每个项目 - copy hover钩子
- 禁止访问旧服务器
- 创建最后一个
git fetch
在每个克隆的repo上删除
删除原始
宕机时间> - 恢复访问权限
- On the new machine, clone each repository using
git clone --mirror
- Copy over repo hooks for each repository
- Disallow access to old server (we use gitosis, so remove access for all users except for the new server)
- Move the DNS entry so the DNS alias Git users use
- Perform
git pull
for each repository on the new server. - For each repository on the new server, edit the config file to remove the
remote "origin"
section. - Turn on access to new server
- Does this look right? I am specifically concerned with step #6.
- Is there any way to do this that will reduce downtime?
- bundle each repo using
git bundle
- copy the bundle on the new server
- create bare repos
git fetch
from those bundles in each of the empty bare repo (no origin to set)- copy hover the hooks
- Disallow access to old server
- make a last git bundle on each repo (incremental bundle, very quick)
- copy those small bundles
git fetch
the increment from the small incremental bundles
</ downtime: no origin to remove>- restore access
- I would create a special "migration" gitosis user, with all projects access
clone --bare
each projects on the new server- copy hover the hooks
- Disallow access to old server
- make a last
git fetch
on each cloned repo - remove origin </ downtime>
- restore access
b
$ b 新旧服务器之间可以通过SSL进行通信:
I will be moving Git repositories from an older SCM server to a new one. My main concern (other than fidelity, of course) is to minimize downtime. Here is my plan:
Questions:
Thanks.
解决方案
I would (if there are no communication possible between old server and new server):
If there is communication possible (through SSL) between the new and the old server:
这篇关于如何移动Git存储库并最大限度地减少停机时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文