• 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

    # 注意

    只有连接Postgresql master库, gitlab才能正常使用。  

  • 相关阅读:
    http-Content-Type
    ip地址和端口号
    node中的js-核心模块
    http-url 发送请求
    http 发送请求
    node http核心模块
    node 写文件
    bzoj-3170 3170: [Tjoi 2013]松鼠聚会(计算几何)
    codeforces 710E E. Generate a String(dp)
    codeforces 710C C. Magic Odd Square(构造)
  • 原文地址:https://www.cnblogs.com/linkenpark/p/8359216.html
Copyright © 2020-2023  润新知