'gitlab-rails dbconsole command returns 'primary' database not configured for 'production'
Our Gitlab is version 14.x and is running in a docker container.
I believe I have found the solution to a problem we are experiencing with Gitlab Community Edition. Solution is here >>> https://docs.gitlab.com/ee/raketasks/backup_restore.html#reset-runner-registration-tokens
However, I'm stuck at the first hurdle. Running gitlab-rails dbconsole causes a log stream output. And checking the detail it appears as though this line is outlining the culprit.
`db_config': 'primary' database is not configured for 'production'
I have checked the correct database.yml file and can see the ONLY db environment is in fact the production one.
I have tried running gitlab-rails dbconsole -e production too. Same problem output.
Any guidance would be very much appreciated. Thanks.
Solution 1:[1]
Solution to this problem for me at lease was to run this command, as root.
gitlab-psql -d gitlabhq_production
Solution 2:[2]
A workaround may be to run gitlab-rails dbconsole --db main
I created an issue for this: https://gitlab.com/gitlab-org/gitlab/-/issues/358603
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Mikey007 |
| Solution 2 | stanhu |
