Gitlab恢復(fù)數(shù)據(jù)報(bào)錯(cuò)解決方法

背景

在Gitlab遷移恢復(fù)數(shù)據(jù)出現(xiàn)must be owner of extension plpgsql解決方法;在做gitlab遷移時(shí),按正常Gitlab備份數(shù)據(jù)gitlab-rake gitlab:backup:create,沒(méi)問(wèn)題,數(shù)據(jù)顯示正常,但是在恢復(fù)的時(shí)候卻出現(xiàn)報(bào)錯(cuò)。

Gitlab恢復(fù)數(shù)據(jù)出現(xiàn)錯(cuò)誤提示:

Restoring PostgreSQL database gitlabhq_production ... ERROR:  must be owner of extension pg_trgm
ERROR:  must be owner of extension btree_gist
ERROR:  must be owner of extension btree_gist
ERROR:  must be owner of extension pg_trgm

解決方案

  1. 修改postgresql配置
$ vim /var/opt/gitlab/postgresql/data/postgresql.conf
listen_addresses = '*'
# 最下面新增兩行
$ vim /var/opt/gitlab/postgresql/data/pg_hba.conf
local   all         all                               trust
host    all         all                               127.0.0.1/32 trust
  1. 重啟gitlab服務(wù)
$ gitlab-ctl restart
ok: run: logrotate: (pid 29367) 1s
ok: run: nginx: (pid 29371) 0s
ok: run: postgresql: (pid 29389) 0s
ok: run: redis: (pid 29391) 0s
ok: run: sidekiq: (pid 29404) 0s
ok: run: unicorn: (pid 29413) 0s
  1. 修改gitlab賬號(hào)為超級(jí)用戶
$ su - gitlab-psql
$ /opt/gitlab/embedded/bin/psql -h 127.0.0.1 gitlabhq_production
psql (9.2.8)
Type "help" for help.
 
gitlabhq_production=# ALTER USER gitlab WITH SUPERUSER;
ALTER ROLE
gitlabhq_production=# \q

再次恢復(fù)數(shù)據(jù)已不報(bào)錯(cuò)

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容