gitlab下的postgresql备份

 

1.pu_dump备份
su - gitlab-psql
pg_dump -h /var/opt/gitlab/postgresql -d gitlabhq_production -f /tmp/gitlabhq_production.sql

 

2.异地恢复
创建数据库
create database gitlabhq_production;


创建用户
create user gitlab with password 'gitlab';
alter database gitlabhq_production owner to gitlab;

su - postgres
psql -h localhost -U postgres -p5432 -d gitlabhq_production</tmp/gitlabhq_production.sql

posted @ 2025-03-20 13:58  slnngk  阅读(44)  评论(0)    收藏  举报