打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

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

迁移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 backup2021/02/23 11:12:20 [ INFO] Backup root directory: C:\Users\ZEQIPC~1\AppData\Local\Temp\gogs-backup-4623446352021/02/23 11:12:20 [ INFO] Packing backup files to: gogs-backup-20210223111220.zip2021/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.zip2021/02/23 11:14:13 [ INFO] Backup succeed! Archive is located at: gogs-backup-20210223111220.zipF:\ProgramFiles\windows_amd64\gogs>

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

F:\ProgramFiles\windows_amd64\gogs>gogs backup --helpNAME:   gogs backup - Backup files and databaseUSAGE:   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 beportable 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 --helpNAME:   gogs restore - Restore files and database from backupUSAGE:   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 importbackup from other database engines, which is useful for database migrating.If corresponding files or database tables are not presented in the archive, they willbe 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、重启访问


恢复完成,正常使用。

来源:https://www.icode9.com/content-3-867351.html
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
SQL SERVER2000数据库备份和恢复存储过程(加强版本)
!!!在 PowerShell 中使用 SQL Server (1)sqlps
How to backup and restore your forum (Linux / Windows) | XenForo Community
RMAN命令详解 非常好的文章
SVN仓库备份和迁移
巧用SQL语言批量建立金蝶K3账套
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服