美文网首页
最新gitlab备份迁移方案

最新gitlab备份迁移方案

作者: 林亚希 | 来源:发表于2020-10-15 16:50 被阅读0次

起因

由于服务器到期需要迁移git服务器到另外的一台上。

方案

使用官方迁移方案解决(一个很深的坑,网上有写方案是只是用低版本的,大家最好去官方获取最新的迁移方式。)

步骤(我用的是docker)

迁移文档在gitlab地址https://..**/help/raketasks/backup_restore.md

1. 备份

docker exec -t <container name> gitlab-backup create

输出样例

2020-10-15 07:23:04 +0000 -- Dumping database ... 
Dumping PostgreSQL database gitlabhq_production ... [DONE]
2020-10-15 07:23:08 +0000 -- done
2020-10-15 07:23:08 +0000 -- Dumping repositories ...
 * yihao-server/yihao (@hashed/4b/22/4b227777d4dd1fc61c6f884f48641d02b4d121d3fd328cb08b5531fcacdabf8a) ... [DONE]
[SKIPPED] Wiki
 * yihao-server/yihao-consult (@hashed/ef/2d/ef2d127de37b942baad06145e54b0c619a1f22327b2ebbcfbec78f5564afe39d) ... [DONE]
[SKIPPED] Wiki
 * yihao-server/yihao-health (@hashed/e7/f6/e7f6c011776e8db7cd330b54174fd76f7d0216b612387a5ffcfb81e6f0919683) ... [DONE]
[SKIPPED] Wiki
 * yihao-server/yihao-iot (@hashed/79/02/7902699be42c8a8e46fbbb4501726517e86b22c56a189f7625a6da49081b2451) ... [DONE]
[SKIPPED] Wiki
 * front-end/mp-health-service (@hashed/2c/62/2c624232cdd221771294dfbb310aca000a0df6ac8b66b696d90ef06fdefb64a3) ... [DONE]
[SKIPPED] Wiki
 * front-end/web-health-doctor (@hashed/19/58/19581e27de7ced00ff1ce50b2047e7a567c76b1cbaebabe5ef03f7c3017bb5b7) ... [DONE]
[SKIPPED] Wiki
 * front-end/mp-health-doctor (@hashed/4a/44/4a44dc15364204a80fe80e9039455cc1608281820fe2b24f1e5233ade6af1dd5) ... [DONE]
[SKIPPED] Wiki
 * yihao-server/yihao-fadada (@hashed/4f/c8/4fc82b26aecb47d2868c4efbe3581732a3e7cbcc6c2efb32062c08170a05eeb8) ... [DONE]
[SKIPPED] Wiki
 * front-end/mp-health-patient (@hashed/6b/51/6b51d431df5d7f141cbececcf79edf3dd861c3b4069f0b11661a3eefacbba918) ... [DONE]
[SKIPPED] Wiki
 * front-end/mp-health-pharmacy (@hashed/3f/db/3fdba35f04dc8c462986c992bcf875546257113072a909c162f7e470e581e278) ... [DONE]
[SKIPPED] Wiki
 * front-end/web-website (@hashed/85/27/8527a891e224136950ff32ca212b45bc93f69fbb801c3b1ebedac52775f99e61) ... [DONE]
[SKIPPED] Wiki
 * yihao-server/yihao-system (@hashed/e6/29/e629fa6598d732768f7c726b4b621285f9c3b85303900aa912017db7617d8bdb) ... [DONE]
[SKIPPED] Wiki
 * front-end/admin-platform (@hashed/b1/7e/b17ef6d19c7a5b1ee83b907c595526dcb1eb06db8227d650d5dda0a9f4ce8cd9) ... [DONE]
[SKIPPED] Wiki
 * yihao-server/yihao-center (@hashed/45/23/4523540f1504cd17100c4835e85b7eefd49911580f8efff0599a8f283be6b9e3) ... [DONE]
[SKIPPED] Wiki
 * yihao-server/yihao-filesystem (@hashed/4e/c9/4ec9599fc203d176a301536c2e091a19bc852759b255bd6818810a42c5fed14a) ... [DONE]
[SKIPPED] Wiki
 * yihao-server/yihao-im (@hashed/94/00/9400f1b21cb527d7fa3d3eabba93557a18ebe7a2ca4e471cfe5e4c5b4ca7f767) ... [DONE]
[SKIPPED] Wiki
2020-10-15 07:23:12 +0000 -- done
2020-10-15 07:23:12 +0000 -- Dumping uploads ... 
2020-10-15 07:23:12 +0000 -- done
2020-10-15 07:23:12 +0000 -- Dumping builds ... 
2020-10-15 07:23:12 +0000 -- done
2020-10-15 07:23:12 +0000 -- Dumping artifacts ... 
2020-10-15 07:23:12 +0000 -- done
2020-10-15 07:23:12 +0000 -- Dumping pages ... 
2020-10-15 07:23:12 +0000 -- done
2020-10-15 07:23:12 +0000 -- Dumping lfs objects ... 
2020-10-15 07:23:12 +0000 -- done
2020-10-15 07:23:12 +0000 -- Dumping container registry images ... 
2020-10-15 07:23:12 +0000 -- [DISABLED]
Creating backup archive: 1602746592_2020_10_15_13.2.6_gitlab_backup.tar ... done
Uploading backup archive to remote storage  ... skipped
Deleting tmp directories ... done
done
done
done
done
done
done
done
Deleting old backups ... skipping
Warning: Your gitlab.rb and gitlab-secrets.json files contain sensitive data 
and are not included in this backup. You will need these files to restore a backup.
Please back them up manually.
Backup task is done.

导出备份会存储在/home/gitlab/data/backups目录下
将文件拷贝到新的服务器上/home/gitlab/data/backups目录下

修改权限
chmod 755 1602316095_2020_10_10_13.2.6_gitlab_backup.tar

# Stop the processes that are connected to the database
docker exec -it <name of container> gitlab-ctl stop unicorn
docker exec -it <name of container> gitlab-ctl stop puma
docker exec -it <name of container> gitlab-ctl stop sidekiq

# Verify that the processes are all down before continuing
docker exec -it <name of container> gitlab-ctl status

# Run the restore
docker exec -it <name of container> gitlab-backup restore BACKUP=1602316095_2020_10_10_13.2.6

# Restart the GitLab container
docker restart <name of container>

# Check GitLab
docker exec -it <name of container> gitlab-rake gitlab:check SANITIZE=true

然后静静等待就可以了。我在10月10日的时候有用就的方式恢复是可以的。但是不知道为什么,15日正式操作的时候一直报异常,折腾了几个小时候后用官方的终于恢复成功了。

相关文章

  • 最新gitlab备份迁移方案

    起因 由于服务器到期需要迁移git服务器到另外的一台上。 方案 使用官方迁移方案解决(一个很深的坑,网上有写方案是...

  • [转]使用Gitlab一键安装包后的日常备份恢复与迁移

    Gitlab 创建备份 使用Gitlab一键安装包安装Gitlab非常简单, 同样的备份恢复与迁移也非常简单. 使...

  • Gitlab一键安装包 日常备份 恢复 与 迁移

    一. GitLab 创建备份 使用Gitlab一键安装包安装Gitlab非常简单, 同样的备份恢复与迁移也非常简单...

  • gitlib备份与恢复

    使⽤Gitlab⼀键安装包后的⽇常备份恢复与迁移 Gitlab 创建备份 使⽤Gitlab⼀键安装包安装Gitla...

  • 解决gitlab备份迁移后,新gitlab部分页面报500错误

    问题:在将旧gitlab服务器上的数据备份迁移到新服务器后(参照:Gitlab数据备份、迁移、恢复),有部分页面访...

  • GitLab 迁移与升级

    方法一: 1,备份老版本gitlab数据并迁移新版本gitlab服务器 停gitlab服务直接备份data和con...

  • gitlab 灾备

    Gitlab创建备份 使用Gitlab一键安装包安装Gitlab非常简单,同样的备份恢复与迁移也非常简单.使用一条...

  • gitlab迁移和升级

    Gitlab迁移 迁移的整体思路是:1、在新服务器上安装相同版本的gitlab2、将备份生成的备份文件发送到新服务...

  • GitLab定时备份及恢复

    参考 Gitlab备份、迁移、恢复和升级 背景 项目中使用linux服务器作为Gitlab仓储,需要每天自动定时备...

  • Gitlab 升级备份迁移

    公司老的服务器即将到期,且不准备续期(打算在公司账号下新买ECS服务器,旧的服务器是在个人账号下购买的),旧服务器...

网友评论

      本文标题:最新gitlab备份迁移方案

      本文链接:https://www.haomeiwen.com/subject/mddopktx.html