Gitlab恢复数据报错解决方法
阅读原文时间:2023年08月09日阅读:3

背景

在Gitlab迁移恢复数据出现must be owner of extension plpgsql解决方法;在做gitlab迁移时,按正常Gitlab备份数据gitlab-rake gitlab:backup:create,没问题,数据显示正常,但是在恢复的时候却出现报错。

Gitlab恢复数据出现错误提示:

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

  2. 重启gitlab服务

    $ 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

  3. 修改gitlab账号为超级用户

    $ 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

再次恢复数据已不报错

手机扫一扫

移动阅读更方便

阿里云服务器
腾讯云服务器
七牛云服务器

你可能感兴趣的文章