ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

迁移Gogs(从Window Server 2019中迁移到CentOS7.9)

2021-02-23 14:33:14  阅读:272  来源: 互联网

标签:zip database -- Gogs gogs value Server 迁移 backup


迁移Gogs(从Window Server 2019中迁移到CentOS7.9)


摘要:
Gogs从Window Server 2019中迁移到CentOS7.9;
CentOS中Gogs为新安装的,没有其他仓库;
CentOS中操作用户为root;



1、在window中执行备份命令


当前目录生成【gogs-backup-20210223111220.zip】类似的压缩包。

F:\ProgramFiles\windows_amd64\gogs>gogs backup
2021/02/23 11:12:20 [ INFO] Backup root directory: C:\Users\ZEQIPC~1\AppData\Local\Temp\gogs-backup-462344635
2021/02/23 11:12:20 [ INFO] Packing backup files to: gogs-backup-20210223111220.zip
2021/02/23 11:12:20 [ INFO] Dumping repositories in 'F:/ProgramFiles/windows_amd64/config/systemprofile/gogs-repositories'
2021/02/23 11:13:23 [ INFO] Repositories dumped to: C:\Users\ZEQIPC~1\AppData\Local\Temp\gogs-backup-462344635/repositories.zip
2021/02/23 11:14:13 [ INFO] Backup succeed! Archive is located at: gogs-backup-20210223111220.zip
F:\ProgramFiles\windows_amd64\gogs>

【扩展】通过 help查看backup命令使用方法(在Windows中敲的)

F:\ProgramFiles\windows_amd64\gogs>gogs backup --help
NAME:
   gogs backup - Backup files and database
USAGE:
   gogs backup [command options] [arguments...]
DESCRIPTION:
   Backup dumps and compresses all related files and database into zip file,
which can be used for migrating Gogs to another server. The output format is meant to be
portable among all supported database engines.
OPTIONS:
   --config value, -c value   Custom configuration file path (default: "custom/conf/app.ini")
   --verbose, -v              Show process details
   --tempdir value, -t value  Temporary directory path (default: "C:\\Users\\ZEQIPC~1\\AppData\\Local\\Temp")
   --target value             Target directory path to save backup archive (default: "./")
   --archive-name value       Name of backup archive (default: "gogs-backup-20210223111203.zip")
   --database-only            Only dump database
   --exclude-repos            Exclude repositories


2、在CentOS中恢复备份数据


2.1、将【gogs-backup-20210223111220.zip】上传至centos系统中
2.2、开始恢复数据


相关命令

 ./gogs restore --config /usr/local/gogs/custom/conf/app.ini --tempdir  /data/tmp  --from gogs-backup-20210223111220.zip

2.3、使用CentOS中的配置文件替换恢复的配置文件(为了解决错误:User configured to run Gogs is "git", but the current user is)

[root@localhost gogs]# mv custom custom.backup
[root@localhost gogs]# mv custom.bak custom


【扩展】通过 help查看restore命令使用方法(在CentOS中敲的)

[root@localhost gogs]# ./gogs restore --help
NAME:
   gogs restore - Restore files and database from backup
USAGE:
   gogs restore [command options] [arguments...]
DESCRIPTION:
   Restore imports all related files and database from a backup archive.
The backup version must lower or equal to current Gogs version. You can also import
backup from other database engines, which is useful for database migrating.
If corresponding files or database tables are not presented in the archive, they will
be skipped and remain unchanged.
OPTIONS:
   --config value, -c value   Custom configuration file path
   --verbose, -v              Show process details
   --tempdir value, -t value  Temporary directory path (default: "/tmp")
   --from value               Path to backup archive
   --database-only            Only import database
   --exclude-repos            Exclude repositories

3、检查恢复情况


3.1、数据库中【repository】等表的数据已经恢复
3.2、仓库根目录下的数据已经恢复


4、重启访问


恢复完成,正常使用。

标签:zip,database,--,Gogs,gogs,value,Server,迁移,backup
来源: https://blog.csdn.net/woshirongshaolin/article/details/113986979

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有