gitlab使用外部的postgresql、外部的redis服务器

postgresql创建用户

su - postgres
psql
create role gitlab login encrypted password 'pass';
\du ;显示用户

 

postgresql新建数据库

su - postgres
psql
create database gitlabhq_production owner=gitlab ENCODING = 'UTF8';
\l ;列表数据库

 

 

postgresql扩展pg_trgm

yum -y install postgresql96-contrib-9.6.8    # 默认的 yum -y install postgresql-contrib

su - postgres

-bash-4.2$ psql gitlabhq_production   # 或使用\c 库名   来切换数据库
psql (9.6.6)
Type "help" for help.

postgres=# CREATE EXTENSION pg_trgm;

查看extension
select extname,extowner,extnamespace,extrelocatable,extversion from pg_extension;
 
 

 

 

编辑 /etc/gitlab/gitlab.rb 

 

external_url 'http://url'


## postgresql connect

postgresql['enable'] = false
gitlab_rails['db_adapter'] = "postgresql"
gitlab_rails['db_encoding'] = "utf8"
gitlab_rails['db_database'] = "gitlabhq_production"
gitlab_rails['db_pool'] = 30
gitlab_rails['db_username'] = "gitlab"
gitlab_rails['db_password'] = "pass"
gitlab_rails['db_host'] = "10.100.12.63"
gitlab_rails['db_port'] = "5432"



## redis connet(单实例、或主从集群)
redis['enable'] = false
gitlab_rails['redis_host'] = "redis_host"
gitlab_rails['redis_port'] = 6379
gitlab_rails['redis_password'] = "redis_password"
gitlab_rails['redis_database'] = 0


## redis sentinel哨兵集群
# redis连接方式只设置一种就可以,CE版也可以连接redis sentinel集群
redis['enable'] = false gitlab_rails['redis_sentinels'] = [ {'host' => 'sentinel-0.conf.com', 'port' => 26379}, {'host' => 'sentinel-1.conf.com', 'port' => 26379}, {'host' => 'sentinel-2.conf.com', 'port' => 26379}, {'host' => 'sentinel-3.conf.com', 'port' => 26379}, ] redis['master_name'] = 'mymaster' redis['master_password'] = 'redis_auth_pass'
gitlab_rails['redis_database'] = 0

 

 

 

sudo gitlab-ctl reconfigure

#检查是否使用自定义配置
cat /opt/gitlab/embedded/service/gitlab-rails/config/database.yml

 

gitlab-ctl start

 

当 unicorn 没有还没有启动时会报502

netstat -tulpn | grep :8080
tcp 0 0 127.0.0.1:8080 0.0.0.0:* LISTEN 3906/unicorn master

 

postgrepsql 连接测试

psql -h {host} -p {port} -U {USERNAME} -W  [DBNAME]

gitlab的客户端为gitlab-psql

 

转载于:https://www.cnblogs.com/linkenpark/p/8359216.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值