一、备份

修改配置文件

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 学习笔记之备份恢复及邮箱配置的更多相关文章

  1. Centos7安装gitlab11 学习笔记之基础概念、部署安装、权限管理、issue管理

    一.基础介绍 1.简介 一个基于GIT的源码托管解决方案 基于rubyonrails开发 集成了nginx postgreSQL redis sidekiq等组件 2.安装要求 2g内存以上,有点占内 ...

  2. Android安装器学习笔记(一)

    Android安装器学习笔记(一) 一.Android应用的四种安装方式: 1.通过系统应用PackageInstaller.apk进行安装,安装过程中会让用户确认 2.系统程序安装:在开机的时候自动 ...

  3. Centos7 安装 Python 的笔记

    Centos7 安装 Python 的笔记 注意:系统自带的Python2.7不要改动,最好也不要出错,不然yum之类的工具可能会出错. 安装Python3.7.0 TensorFlow对Python ...

  4. STM32 FSMC学习笔记+补充(LCD的FSMC配置)

    STM32 FSMC学习笔记+补充(LCD的FSMC配置) STM32 FSMC学习笔记 STM32 FSMC的用法--LCD

  5. CAS学习笔记五:SpringBoot自动/手动配置方式集成CAS单点登出

    本文目标 基于SpringBoot + Maven 分别使用自动配置与手动配置过滤器方式实现CAS客户端登出及单点登出. 本文基于<CAS学习笔记三:SpringBoot自动/手动配置方式集成C ...

  6. android cocos2d-x for Android安装和学习笔记(请用adt-bundle21.1或以上导入)

    引用:http://weimingtom.iteye.com/blog/1483566 (20121108)注意:这篇文章用cdt编译ndk工程的内容已过时(现在可以用adt-bundle,避免配置繁 ...

  7. mongodb 3.4 学习 (五)备份&恢复

    备份恢复命令 mongodump -h 127.0.0.1 -p 27017 -o /opt/backup -u app -p '@app' --collection demo --db app -- ...

  8. 张高兴的 Xamarin.Android 学习笔记:(一)环境配置

    最近在自学 Xamarin 和 Android ,同时发现国内在做 Xamarin 的不多.我在自学中间遇到了很多问题,而且百度到的很多教程也有些过时,现在打算写点东西稍微总结下,顺便帮后人指指路了. ...

  9. 【转】 Pro Android学习笔记(五六):配置变化

    目录(?)[-] Activity的destorycreate过程 Fragment的destorycreate过程 onSaveInstanceState saveFragmentInstanceS ...

随机推荐

  1. 解决GitHub上传大于100M文件失败

    目录 问题 解决 参考 问题 push的时候遇到以下问题: remote: error: GH001: Large files detected. You may want to try Git La ...

  2. sqlserver 触发器实例

    实例1:update USE [数据库名称]GO/****** Object: Trigger [dbo].[触发器名称] Script Date: 05/08/2014 12:40:25 ***** ...

  3. Python 中路径的有效使用

    import arcpy arcpy.GetCount_management("c:/temp/streams.shp") arcpy.GetCount_management(&q ...

  4. linux设置su和sudo为不需要密码

    一 设置sudo为不需要密码   有时候我们只需要执行一条root权限的命令也要su到root,是不是有些不方便?这时可以用sudo代替.默认新建的用户不在sudo组,需要编辑/etc/sudoers ...

  5. python命令行参数解析OptionParser类用法实例

    python命令行参数解析OptionParser类用法实例 本文实例讲述了python命令行参数解析OptionParser类的用法,分享给大家供大家参考. 具体代码如下:     from opt ...

  6. 单例模式-java

    /** * The MIT License * Copyright (c) 2014-2016 Ilkka Seppälä * <p> * Permission is hereby gra ...

  7. DTCMS会员中心添加新页面

    首先将模板文件spend_list.html放到模板文件夹 URL配置里 将需要在此页面传递的参数,在“添加表达式”中配置好 链接写法: 继承类名DTcms.Web.UI.Page.spend_lis ...

  8. 为什么每次登录要手动 source /etc/profile ...

    由于执行顺序如下,故追个查看以下文件,看看是不是 JAVA_HOME, PATH 等环境变量在后面的文件中被重写覆盖了. 1. /etc/profile2. /etc/environment3. ~/ ...

  9. vue项目使用keep-alive的作用

    在vue项目中,难免会有列表页面或者搜索结果列表页面,点击某个结果之后,返回回来时,如果不对结果页面进行缓存,那么返回列表页面的时候会回到初始状态,但是我们想要的结果是返回时这个页面还是之前搜索的结果 ...

  10. C/C++查漏补缺(常更)

    一.#define宏定义 如下程序段,则输出结果为: #define MAX 12 int main(){ cout << "20\0MAX019" << ...