gitlab应用和数据库分离

  • A+
所属分类:Linux

一.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
1.设置密码
\password postgres
输入新的密码:
再次输入:
2.创建授权
create user gitlab with password '12345678';
create database gitlabhq_production OWNER gitlab;
GRANT ALL PRIVILEGES ON DATABASE gitlabhq_production TO gitlab;
3.配置
 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
如希望免密码认证
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'
4.安装扩展
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

avatar

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: