如何移动Git存储库并最大限度地减少停机时间 [英] How to move Git repositories and minimize downtime

查看:178
本文介绍了如何移动Git存储库并最大限度地减少停机时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将把旧的SCM服务器上的Git存储库移动到新的服务器上。我的主要关注点(当然不是保真度)是为了尽量减少停机时间。这是我的计划:


  1. 在新机器上,使用克隆每个存储库git clone --mirror
  2. 复制每个存储库的回购钩子
  3. 禁止访问旧服务器(我们使用gitosis,因此除去所有用户的访问对于新服务器)

  4. 移动DNS条目,以便DNS别名Git用户使用

  5. 执行 git pull
  6. 对于新服务器上的每个存储库,编辑配置文件以删除远程origin
  7. code> section。
  8. 打开对新服务器的访问权限

/ p>


  1. 这看起来合适吗?我特别关心第6步。

  2. 是否有任何方法可以减少停机时间?

Thanks。

解决方案

我会(如果旧服务器和新服务器之间没有可能的通信) / p>


  • 捆绑每个回购使用 git bundle

  • 新服务器
  • 从每个包中的捆绑包创建裸回购

  • git fetch 空裸回购(无设置起源)

  • 复制悬停钩子

  • 禁止访问旧服务器

  • >
  • 在每个回购库上创建最后一个git捆绑包(增量捆绑包,非常快)
  • 复制这些小捆绑包

  • code> git fetch 小增量包的增量


  • 恢复访问权限

  • b
    $ b 新旧服务器之间可以通过SSL进行通信:




    • 我会创建一个特殊的迁移gitosis用户,所有项目的访问权限

    • clone --bare 新服务器上的每个项目

    • copy hover钩子

    • 禁止访问旧服务器


    • 创建最后一个 git fetch 在每个克隆的repo上删除
      删除原始

    • 恢复访问权限

    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:

    1. On the new machine, clone each repository using git clone --mirror
    2. Copy over repo hooks for each repository
    3. Disallow access to old server (we use gitosis, so remove access for all users except for the new server)
    4. Move the DNS entry so the DNS alias Git users use
    5. Perform git pull for each repository on the new server.
    6. For each repository on the new server, edit the config file to remove the remote "origin" section.
    7. Turn on access to new server

    Questions:

    1. Does this look right? I am specifically concerned with step #6.
    2. Is there any way to do this that will reduce downtime?

    Thanks.

    解决方案

    I would (if there are no communication possible between old server and new server):

    • 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

    If there is communication possible (through SSL) between the new and the old server:

    • 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

    这篇关于如何移动Git存储库并最大限度地减少停机时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆