zoukankan      html  css  js  c++  java
  • gitlab 存储仓库目录设置及数据迁移[转载]

    本文转自:https://blog.csdn.net/qq_36949713/article/details/89025198

    注:一开始没有考虑到把gitlab划分好存储目录,占用系统磁盘,由于gitlab是默认安装的,随着公司代码越来越多,导致gitlab数据目录空间不足

    设置存储仓库数据

    默认情况下omnibus-gitlab 将仓库数据存储在 /var/opt/gitlab/git-data目录下,仓库存放在子目录 repositories里面。 以可以通过修改/etc/gitlab/gitlab.rb 的这一行来自定义 git-data 的父目录

    [root@gitlab ~]#  vim /etc/gitlab/gitlab.rb 
    # 把注释取消然后指定新的仓库存储位置
    git_data_dirs({ "default" => { "path" => "/home/gitlab-data" } })

    注: /home/gitlab-data 是我新挂载的目录,
    注意 :目标路径和其子路径必须不能为软链接。

    使设置生效

    1.1 ,在没有数据的情况下

    [root@gitlab ~]#  gitlab-ctl stop
    [root@gitlab ~]# gitlab-ctl reconfigure //使修改生效

    1.2,如果 /var/opt/gitlab/git-data 目录已经存在Git仓库数据, 你可以用下面的命令把数据迁移到新的位置:

    # 准备迁移之前要停止GitLab服务,防止用户写入数据。
    [root@gitlab ~]# gitlab-ctl stop
     
    # 注意 'repositories'后面不带斜杠,而
    # '/home/gitlab-data'后面是有斜杠的。
    [root@gitlab ~]# rsync -av /var/opt/gitlab/git-data/repositories /home/gitlab-data/
     
    # 如果需要修复权限设置,
    # 可运行下面的命令进行修复。
    [root@gitlab ~]# gitlab-ctl reconfigure
     
    # 再次检查下  /home/gitlab-data 的目录. 正常情况应该有下面这个子目录:
    # repositories
     
    [root@gitlab ~]# ls  /home/gitlab-data/
    repositories
    # 完工! 启动GitLab,验证下是否能
    # 通过web访问Git仓库。
    [root@gitlab ~]# gitlab-ctl start

    设置存储仓库数据的备用目录

    注意的是:自GitLab 8.10开始,可以通过在/etc/gitlab/gitlab.rb文件中添加下面的几行配置, 来增加多个 git 数据存储目录。

    git_data_dirs({
      "default" => { "path" => "/var/opt/gitlab/git-data" },  //默认存储目录
      "alternative" => { "path" => " /home/gitlab-data" }     //备用存储目录
    })
  • 相关阅读:
    Uri编码,包括javascript前端与C#服务器端
    快速排序
    bootstrap
    boosting
    bagging
    SHELL排序
    冒泡排序
    插入排序
    选择排序
    二叉树的数学性质
  • 原文地址:https://www.cnblogs.com/Jungle1219/p/14863751.html
Copyright © 2011-2022 走看看