• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to Create and Restore a Backup in Gitlab-CE 12.0.3 on CentOS 7.6

  • 00:21 vim /etc/gitlab/gitlab.rb
  • 00:38 cd /opt/project1
  • 00:51 gitlab-rake gitlab:backup:create
  • 01:11 gitlab-ctl stop unicorn
  • 01:15 gitlab-ctl stop sidekiq
  • 01:20 gitlab-ctl stop
  • 01:43 gitlab-rake gitlab:backup:restore BACKUP=1564476430_2019_07_30_12.0.3
  • 02:03 gitlab-ctl restart
  • 02:17 gitlab-rake gitlab:check SANITIZE=true
{{postValue.id}}

How to Create And Restore A Backup In Gitlab-CE 12.0.3 On CentOS 7.6

Backup Creation Process:

Navigate to GitLab configuration file to verify the GitLab backup location as follows

[root@linuxhelp ~]# vim /etc/gitlab/gitlab.rb
gitlab_rails['backup_path'] = "/opt/project1/"

Navigate to backup location /opt/project as follows

[root@linuxhelp ~]# cd /opt/project1

Create a backup using rake command

[root@linuxhelp project1]# gitlab-rake gitlab:backup:create
2019-07-30 14:17:07 +0530 -- Dumping database ... 
Dumping PostgreSQL database gitlabhq_production ... [DONE]
2019-07-30 14:17:10 +0530 -- done
2019-07-30 14:17:10 +0530 -- Dumping repositories ...
.
.
.
.
done
Deleting old backups ... skipping
Warning: Your gitlab.rb and gitlab-secrets.json files contain sensitive data 
and are not included in this backup. You will need these files to restore a backup.
Please back them up manually.
Backup task is done.

List the directories to check the backup file

[root@linuxhelp project1]# ls -la
total 132
drwx------  2 git  root     60 Jul 30 14:17 .
drwxr-xr-x. 5 root root     46 Jul 29 07:55 ..
w-------  1 git  git  133120 Jul 30 14:17 1564476430_2019_07_30_12.0.3_gitlab_backup.tar

BackUp Restore Process

Stop the service of unicorn and sidekiq as follows

oot@linuxhelp project1]# gitlab-ctl stop unicorn
ok: down: unicorn: 0s, normally up
root@linuxhelp project1]# gitlab-ctl stop sidekiq
ok: down: sidekiq: 1s, normally up

Stop the service of gitlab as follows

root@linuxhelp project1]# gitlab-ctl stop
ok: down: alertmanager: 0s, normally up
ok: down: gitaly: 1s, normally up
ok: down: gitlab-monitor: 0s, normally up
ok: down: gitlab-workhorse: 0s, normally up
ok: down: grafana: 0s, normally up
ok: down: logrotate: 0s, normally up
ok: down: nginx: 1s, normally up
ok: down: node-exporter: 0s, normally up
ok: down: postgres-exporter: 1s, normally up
ok: down: postgresql: 0s, normally up
ok: down: prometheus: 0s, normally up
ok: down: redis: 1s, normally up
ok: down: redis-exporter: 0s, normally up
ok: down: sidekiq: 18s, normally up
ok: down: unicorn: 35s, normally up

Now restore the backup by executing the following command

root@linuxhelp project1]# gitlab-rake gitlab:backup:restore BACKUP=1564476430_2019_07_30_12.0.3
Unpacking backup ... done
Before restoring the database, we will remove all existing
tables to avoid future upgrade problems. Be aware that if you have
custom tables in the GitLab database these tables and all data will be
removed.

 you want to continue (yes/no)? yes
Removing all tables. Press `Ctrl-C` within 5 seconds to abort
2019-07-30 14:19:43 +0530 -- Cleaning the database ... 
rake aborted!
PG::ConnectionBad: could not connect to server: No such file or directory
	Is the server running locally and accepting
	connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:27:in `block (3 levels) in <top (required)>'
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/backup.rake:56:in `block (3 levels) in <top (required)>'
/opt/gitlab/embedded/bin/bundle:23:in `load'
/opt/gitlab/embedded/bin/bundle:23:in `<main>'
Tasks: TOP => gitlab:db:drop_tables
(See full trace by running task with --trace)

List the directories to verify the files

oot@linuxhelp project1]# ls -la
total 156
drwx------  4 git  root    225 Jul 30 14:19 .
drwxr-xr-x. 5 root root     46 Jul 29 07:55 ..
-rw-------  1 git  git  133120 Jul 30 14:17 1564476430_2019_07_30_12.0.3_gitlab_backup.tar
-rw-------  1 git  git     149 Jul 30 14:17 artifacts.tar.gz
-rw-r--r--  1 git  git     190 Jul 30 14:17 backup_information.yml
-rw-------  1 git  git     151 Jul 30 14:17 builds.tar.gz
drwxr-xr-x  2 git  git      29 Jul 30 14:17 db
-rw-------  1 git  git     151 Jul 30 14:17 lfs.tar.gz
-rw-------  1 git  git     155 Jul 30 14:17 pages.tar.gz
drwx------  2 git  git       6 Jul 30 14:17 repositories
-rw-------  1 git  git     151 Jul 30 14:17 uploads.tar.gz

Now restart the service of gitlab as follows

oot@linuxhelp project1]# gitlab-ctl restart
ok: run: alertmanager: (pid 29134) 0s
ok: run: gitaly: (pid 29143) 1s
ok: run: gitlab-monitor: (pid 29166) 0s
ok: run: gitlab-workhorse: (pid 29171) 1s
ok: run: grafana: (pid 29178) 0s
ok: run: logrotate: (pid 29186) 0s
ok: run: nginx: (pid 29192) 1s
ok: run: node-exporter: (pid 29207) 0s
ok: run: postgres-exporter: (pid 29211) 1s
ok: run: postgresql: (pid 29216) 0s
ok: run: prometheus: (pid 29218) 1s
ok: run: redis: (pid 29233) 0s
ok: run: redis-exporter: (pid 29238) 1s
ok: run: sidekiq: (pid 29243) 0s
ok: run: unicorn: (pid 29249) 1s

Sanitize the Database and also check the status of database

root@linuxhelp project1]# gitlab-rake gitlab:check SANITIZE=true
Checking GitLab subtasks ...

Checking GitLab Shell ...

GitLab Shell: ... GitLab Shell version >= 9.3.0 ? ... OK (9.3.0)
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
.
.
.
.
.
Git version >= 2.21.0 ? ... yes (2.21.0)
Git user has default SSH configuration? ... yes
Active users: ... 2

Checking GitLab App ... Finished


Checking GitLab subtasks ... Finished

With this,Gitlab-CE 12.0.3 backup has been created and restored successfully On CentOS 7.6

Tags:
caden
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

What is the use of Sidekiq In gitlab backup?

A

Sidekiq is the background job processor which is required to stop while restoring the Backup in gitlab

Q

What is Gitlab Unicorn used for?

A

Unicorn is a daemon that loads and runs Ruby On rails application which is GItlab.

Q

What does Unicorn Do in gitlab?

A

Unicorn replaces the Crashed workers without dropping user requests in Gitlab

Q

Does rails servers have limited connections to maintain at one time in gitlab?

A

Yes,rails servers have limited connections to maintain at one time in gitlab

Q

Why Does rails servers have limited connections to maintain at one time in Gitlab?

A

In Gitlab,rails servers have limited connections to maintain at one time because web server is a single threaded and multi-processed

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Elijah ?
Remote Desktop Connection Has Stopped Working

When accessing my remote machine server using remote desktop on a windows machine I am getting this error

forum (1)

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.