美文网首页
Gitlab恢复数据报错解决方法

Gitlab恢复数据报错解决方法

作者: 济南打工人 | 来源:发表于2021-11-30 09:54 被阅读0次

    背景

    在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
    
    1. 重启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
    
    1. 修改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
    

    再次恢复数据已不报错

    相关文章

      网友评论

          本文标题:Gitlab恢复数据报错解决方法

          本文链接:https://www.haomeiwen.com/subject/dnarxrtx.html