登录gitlab使用的postgresql
1.查看配置文件
[root@node1 myproj]# cat /var/opt/gitlab/gitlab-rails/etc/database.yml
# This file is managed by gitlab-ctl. Manual changes will be
# erased! To change the contents below, edit /etc/gitlab/gitlab.rb
# and run `sudo gitlab-ctl reconfigure`.
production:
main:
adapter: postgresql
encoding: unicode
collation:
database: gitlabhq_production
username: "gitlab"
password:
host: "/var/opt/gitlab/postgresql"
port: 5432
socket:
sslmode:
sslcompression: 0
sslrootcert:
sslca:
load_balancing: {"hosts":[]}
prepared_statements: false
database_tasks: true
statement_limit: 1000
connect_timeout:
keepalives:
keepalives_idle:
keepalives_interval:
keepalives_count:
tcp_user_timeout:
application_name:
variables:
statement_timeout:
ci:
adapter: postgresql
encoding: unicode
collation:
database: gitlabhq_production
username: "gitlab"
password:
host: "/var/opt/gitlab/postgresql"
port: 5432
socket:
sslmode:
sslcompression: 0
sslrootcert:
sslca:
load_balancing: {"hosts":[]}
prepared_statements: false
database_tasks: false
statement_limit: 1000
connect_timeout:
keepalives:
keepalives_idle:
keepalives_interval:
keepalives_count:
tcp_user_timeout:
application_name:
variables:
statement_timeout:
2.查看/etc/passwd文件里边gitlab对应的系统用户
[root@node1 myproj]# cat /etc/passwd
gitlab-www:x:986:979::/var/opt/gitlab/nginx:/bin/false
git:x:985:978::/var/opt/gitlab:/bin/sh
gitlab-redis:x:984:977::/var/opt/gitlab/redis:/bin/false
gitlab-psql:x:983:976::/var/opt/gitlab/postgresql:/bin/sh
gitlab-prometheus:x:982:975::/var/opt/gitlab/prometheus:/bin/sh
3.根据上面的配置信息登陆postgresql数据库
[root@node1 myproj]# su - gitlab-psql
-sh-4.1$ psql -h /var/opt/gitlab/postgresql -d gitlabhq_production 连接到gitlabhq_production库
gitlabhq_production=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
---------------------+-------------+----------+-------------+-------------+---------------------------------
gitlabhq_production | gitlab | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
postgres | gitlab-psql | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | gitlab-psql | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/"gitlab-psql" +
| | | | | "gitlab-psql"=CTc/"gitlab-psql"
template1 | gitlab-psql | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/"gitlab-psql" +
| | | | | "gitlab-psql"=CTc/"gitlab-psql"
(4 rows)
4.数据目录存放路径
[root@node1 data]# pwd
/var/opt/gitlab/postgresql/data
浙公网安备 33010602011771号