Centos7安装gitlab11 学习笔记之备份恢复及邮箱配置
一、备份
修改配置文件
vim /etc/gitlab/gitlab.rb
默认路径为 # gitlab_rails['backup_path'] = "/var/opt/gitlab/backups" #可以自定义为“/data/backups/gitlab”
gitlab_rails['backup_path'] = "/data/backups/gitlab"
gitlab_rails['backup_keep_time'] = 604800 #代表只保留7天
使之生效
[root@web1 ~]# mkdir -p /data/backups/gitlab
[root@web1 ~]# gitlab-ctl reconfigure
在重启以下
[root@web1 ~]# gitlab-ctl restart
授权
[root@web1 backups]# chown -R git.git /data/backups/gitlab
加入定时任务
[root@web1 backups]# crontab -e
* * * /usr/bin/gitlab-rake gitlab:backup:create #每天2点备份一次
手动测试,手动创建备份
[root@web1 backups]# /usr/bin/gitlab-rake gitlab:backup:create
-- :: + -- Dumping database ...
Dumping PostgreSQL database gitlabhq_production ... [DONE]
-- :: + -- done
-- :: + -- Dumping repositories ...
* proj1/test ... [DONE]
[SKIPPED] Wiki
-- :: + -- done
-- :: + -- Dumping uploads ...
-- :: + -- done
-- :: + -- Dumping builds ...
-- :: + -- done
-- :: + -- Dumping artifacts ...
-- :: + -- done
-- :: + -- Dumping pages ...
-- :: + -- done
-- :: + -- Dumping lfs objects ...
-- :: + -- done
-- :: + -- Dumping container registry images ...
-- :: + -- [DISABLED]
Creating backup archive: 1558020748_2019_05_16_11..4_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 ... done. ( removed)
[root@web1 backups]# cd /data/backups/gitlab/
[root@web1 gitlab]# ll
total
-rw------- git git May 1558020748_2019_05_16_11.10.4_gitlab_backup.tar
[root@web1 gitlab]# ### 1558020748_2019_05_16_11.10.4为事件戳,date -d 1558020748_2019_05_16_11.10.4
[root@web1 gitlab]# date -d @1558020748
Thu May 16 23:32:28 CST 2019
[root@web1 gitlab]#
###
二、恢复数据
首先删除项目,然后恢复测试


开始恢复
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
gitlab-rake gitlab:backup:restore BACKUP=1558020748_2019_05_16_11.10.4
gitlab-ctl restart

三、只备份代码方法为
[root@web1 gitlab]# cd /var/opt/gitlab/
[root@web1 gitlab]# ll
total
drwxr-x--- gitlab-prometheus root May alertmanager
drwx------ git root May : backups
-rw------- root root May : bootstrapped
drwx------ git root May : gitaly
drwx------ git root May : git-data
drwxr-xr-x git root May : gitlab-ci
drwxr-xr-x git root May gitlab-monitor
drwxr-xr-x git root May gitlab-rails
drwx------ git root May gitlab-shell
drwxr-x--- git gitlab-www May : gitlab-workhorse
drwx------ root root May logrotate
drwxr-x--- root gitlab-www May : nginx
drwxr-xr-x root root May : node-exporter
drwx------ gitlab-psql root May postgres-exporter
drwxr-xr-x gitlab-psql root May : postgresql
drwxr-x--- gitlab-prometheus root May prometheus
-rw-r--r-- root root May public_attributes.json
drwxr-x--- gitlab-redis git May : redis
-rw-r--r-- root root May : trusted-certs-directory-hash
[root@web1 gitlab]# cd git-data/
[root@web1 git-data]# ll
total
drwxrws--- git root May : repositories
[root@web1 git-data]# cd repositories/
[root@web1 repositories]# ll
total
drwx--S--- git root May : +gitaly
drwxr-s--- git root May : proj1
[root@web1 repositories]# cd proj1/
[root@web1 proj1]# ll
total
drwxr-sr-x git root May : test.git
[root@web1 proj1]#
四、邮件配置
添加如下配置即可
gitlab_rails['time_zone'] = 'Asia/Shanghai'
gitlab_rails['gitlab_email_enabled'] = true
gitlab_rails['gitlab_email_from'] = 'zhangxingeng@126.com'
gitlab_rails['gitlab_email_display_name'] = 'gitlab'
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.126.com"
gitlab_rails['smtp_port'] =
gitlab_rails['smtp_user_name'] = "zhangxingeng"
gitlab_rails['smtp_password'] = "your_password"
gitlab_rails['smtp_domain'] = "126.com"
gitlab_rails['smtp_authentication'] = "login"
转载请注明出处:https://www.cnblogs.com/zhangxingeng/p/10874979.html
Centos7安装gitlab11 学习笔记之备份恢复及邮箱配置的更多相关文章
- Centos7安装gitlab11 学习笔记之基础概念、部署安装、权限管理、issue管理
一.基础介绍 1.简介 一个基于GIT的源码托管解决方案 基于rubyonrails开发 集成了nginx postgreSQL redis sidekiq等组件 2.安装要求 2g内存以上,有点占内 ...
- Android安装器学习笔记(一)
Android安装器学习笔记(一) 一.Android应用的四种安装方式: 1.通过系统应用PackageInstaller.apk进行安装,安装过程中会让用户确认 2.系统程序安装:在开机的时候自动 ...
- Centos7 安装 Python 的笔记
Centos7 安装 Python 的笔记 注意:系统自带的Python2.7不要改动,最好也不要出错,不然yum之类的工具可能会出错. 安装Python3.7.0 TensorFlow对Python ...
- STM32 FSMC学习笔记+补充(LCD的FSMC配置)
STM32 FSMC学习笔记+补充(LCD的FSMC配置) STM32 FSMC学习笔记 STM32 FSMC的用法--LCD
- CAS学习笔记五:SpringBoot自动/手动配置方式集成CAS单点登出
本文目标 基于SpringBoot + Maven 分别使用自动配置与手动配置过滤器方式实现CAS客户端登出及单点登出. 本文基于<CAS学习笔记三:SpringBoot自动/手动配置方式集成C ...
- android cocos2d-x for Android安装和学习笔记(请用adt-bundle21.1或以上导入)
引用:http://weimingtom.iteye.com/blog/1483566 (20121108)注意:这篇文章用cdt编译ndk工程的内容已过时(现在可以用adt-bundle,避免配置繁 ...
- mongodb 3.4 学习 (五)备份&恢复
备份恢复命令 mongodump -h 127.0.0.1 -p 27017 -o /opt/backup -u app -p '@app' --collection demo --db app -- ...
- 张高兴的 Xamarin.Android 学习笔记:(一)环境配置
最近在自学 Xamarin 和 Android ,同时发现国内在做 Xamarin 的不多.我在自学中间遇到了很多问题,而且百度到的很多教程也有些过时,现在打算写点东西稍微总结下,顺便帮后人指指路了. ...
- 【转】 Pro Android学习笔记(五六):配置变化
目录(?)[-] Activity的destorycreate过程 Fragment的destorycreate过程 onSaveInstanceState saveFragmentInstanceS ...
随机推荐
- Fiddler自动响应AutoResponder正则匹配
AutoResponder-Add-Rule Editor 两个文本框,先说第一个: Mathes: 前缀为“EXACT:”表示完全匹配(大小写敏感) 无前缀表示基本搜索,表示搜索到字符串就匹配 前缀 ...
- Qt之模型/视图(实时更新数据)
上两节简单介绍了Qt中对于模型/视图的编程,大部分助手里说的很清楚了,现在就开始实战部分吧! 在实际应用中,视图展示的数据往往并非一成不变的,那么如何实时更新成了一个很重要的问题!功能:(1)添加委托 ...
- Flutter移动电商实战 --(45)详细页_说明区域UI编写
pages/details_page/details_expain.dart 详情页面引用组件 效果展示: 最终代码: import 'package:flutter/material.dart'; ...
- SEQ!org.apache.hadoop.io.LongWritable
[uhadoop@10-13-109-236 subdir26]$ $HADOOP_HOME/bin/hadoop fs -cat /data/flumeEvents/FlumeData.155980 ...
- g 定时任务
Package cron implements a cron spec parser and job runner. cron - GoDochttps://godoc.org/github.com/ ...
- leetcode 143. Reorder List 、86. Partition List
143. Reorder List https://www.cnblogs.com/grandyang/p/4254860.html 先将list的前半段和后半段分开,然后后半段进行逆序,然后再连接 ...
- [Java复习] 缓存Cache part1
1. 在项目中是如何使用缓存的?为什么要用?不用行不行?用了可能会有哪些不良后果? 结合项目业务,主要两个目的:高性能和高并发.缓存走内存,天然支持高并发. 不良后果: 缓存与DB双写不一致 缓存雪崩 ...
- python分布式进程(windows下)
分布式进程: 在Thread和Process中,应当优选Process,因为Process更稳定,而且,Process可以分布到多台机器上,而Thread最多只能分布到同一台机器的多个CPU上. Py ...
- PHP中的符号 ->、=> 和 :: 分别表示什么意思?
php新手经常碰到的问题,->.=> 和 :: 这三个家伙是什么分别都是做什么的啊!看着就很晕. 没关系,下面我们做一下详细的解释,如果你有C++,Perl基础,你会发现这些家伙和他们里面 ...
- mysql通过binlog恢复删除数据
删除误操作有时会意外出现,如果你有备份表数据的好习惯,那么至少你可以追回备份前的那些数据.如果我们打开了mysql的binlog,那么可以通过它的增量操作日志来恢复数据.怎么打开binlog前篇已有说 ...