gitlab 使用 备份 恢复 优化

gitlab常用命令

查看运行状态
gitlab-ctl status

启动
gitlab-ctl start

停止
gitlab-ctl stop

重启
gitlab-ctl restart

查看版本
cat /opt/gitlab/embedded/service/gitlab-rails/VERSION

重载配置
gitlab-ctl reconfigure

 

gitlab备份

备份命令

gitlab-rake gitlab:backup:create

打开 /etc/gitlab/gitlab.rb配置文件查看备份参数  默认参数添加#注释状态 可以去掉#自行修改

gitlab_rails['backup_path'] = "/var/opt/gitlab/backups"   # 默认备份文件存在位置

gitlab_rails['backup_keep_time'] = 604800                    #默认备份文件保存时间  7天

可以设置定时任务进行自动备份或者编写脚本实现定时本地备份并同步到其他机器实现备份冗余提高安全性

0 4 * * * root gitlab-rake gitlab:backup:create CRON=1

 

gitlab恢复

首先停止数据传输连接服务

gitlab-ctl stop unicorn

gitlab-ctl stop sidekiq

恢复数据

gitlab-rake gitlab:backup:restore BACKUP=具体要恢复的文件名

gitlab-ctl restart

 

如果是恢复到新的机器上需要将 gitlab.rb 和 gitlab-secrets.json 手动复制到相应路径下

 

 

gitlab.rb路径:/etc/gitlab/gitlab.rb

gitlab-secrets.json路径:/etc/gitlab/gitlab-secrets.json

 

 

gitlab占用内存过大优化参数

#进程超时时间
unicorn['worker_timeout'] = 60
#进程数
unicorn['worker_processes'] = 10
#进程最小内存 200M
unicorn['worker_memory_limit_min'] = "200 * 1 << 20"
#进程最大内存 300M
unicorn['worker_memory_limit_max'] = "300 * 1 << 20"
#并发数
sidekiq['concurrency'] = 16
#数据库缓存
postgresql['shared_buffers'] = "256MB"
#数据库并发数
postgresql['max_worker_processes'] = 8

转载 https://www.cnblogs.com/jxd283465/p/11525629.html

posted @   运维笔记123  阅读(319)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 如何调用 DeepSeek 的自然语言处理 API 接口并集成到在线客服系统
· 【译】Visual Studio 中新的强大生产力特性
· 2025年我用 Compose 写了一个 Todo App
点击右上角即可分享
微信分享提示