背景
在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
解決方案
- 修改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
- 重啟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
- 修改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ò)