direct access to to gitlab database

2019-03-09 18:13发布

I am running the AWS AMI from gitlab. I am trying to access the postgres database directly using psql. I thought I could just use the credentials in database.yml, since the rails application is working fine:

/opt/gitlab/embedded/bin/psql -U gitlab -d gitlabhq_production

But I get:

psql: FATAL:  Peer authentication failed for user "gitlab"

How can the rails app be connecting to the database while psql cannot?

标签: gitlab
5条回答
老娘就宠你
2楼-- · 2019-03-09 18:36

su - git
/opt/gitlab/embedded/bin/psql -U gitlab -d gitlabhq_production -h /var/opt/gitlab/postgresql

works for me with gitlab-ce and the embedded postgres. Optional for better interactive working start a bash as git. The (unix)-user git seems to be a peer to the postgresuser gitlab, authenticates without a password (/var/opt/gitlab/postgresql/data/pg_hba.conf).

查看更多
放荡不羁爱自由
3楼-- · 2019-03-09 18:46
sudo -u gitlab-psql /opt/gitlab/embedded/bin/psql -h /var/opt/gitlab/postgresql -d gitlabhq_production
查看更多
爷的心禁止访问
4楼-- · 2019-03-09 18:49
sudo -u gitlab-psql /opt/gitlab/embedded/bin/psql -h /var/opt/gitlab/postgresql/ gitlabhq_production
查看更多
姐就是有狂的资本
5楼-- · 2019-03-09 18:49

But this one does give you full access:

sudo -u gitlab-psql psql template1
查看更多
Explosion°爆炸
6楼-- · 2019-03-09 18:51

googled and found an issue about this.

so, just type sudo gitlab-rails dbconsole :D

查看更多
登录 后发表回答