gitlab应用和数据库分离

修改配置文件
Redis部分

vim /etc/gitlab/gitlab.rb
# Disable the built-in Redis
redis['enable'] = false
# Fill in the connection details
gitlab_rails['redis_host'] = "<redis-endpoint>"
gitlab_rails['redis_port'] = 6379

Postgresql部分

sudo -u postgres psql
#设置密码
\password postgres
#创建授权
create user gitlab with password '12345678';
create database gitlabhq_production OWNER gitlab;
GRANT ALL PRIVILEGES ON DATABASE gitlabhq_production TO gitlab;

修改配置

 postgresql['enable'] = false
 gitlab_rails['db_adapter'] = "postgresql"
 gitlab_rails['db_encoding'] = "utf8"
 gitlab_rails['db_database'] = "gitlabhq_production"
 gitlab_rails['db_username'] = "postgres"
 gitlab_rails['db_password'] = 'FM3.1415926'
 gitlab_rails['db_host'] = 192.168.2.32
 ```
如希望免密码认证
```shell
vim /var/lib/pgsql/10/data/pg_hba.conf 
host   all        all  192.168.2.0/24 trust

修改监听地址

vim /var/lib/pgsql/10/data/postgresql.conf
listen_addresses = '192.168.2.32'

安装扩展

yum search contrib
yum install postgresql12-contrib.x86_64

postgres=# create extension pg_trgm;
postgres=# select * from pg_extension;

查看

sudo gedit /opt/gitlab/embedded/service/gitlab-rails/config/database.yml
THE END
分享
二维码
PXC
< <上一篇
下一篇>>
文章目录
关闭
目 录