• 蓝鲸平台开启consul.conf UI界面


    #第一步:
    vi /data/bkce/etc/supervisor-consul.conf
    修改参数:
    command=/usr/bin/consul agent -config-file=/data/bkce/etc/consul.conf -config-dir=/data/bkce/etc/consul.d 
    行尾添加 -ui 参数
    完整配置如下:
    ----------------------------------------------------------------------------------------------------------------------
    [unix_http_server]
    file=/data/bkce/logs/consul/supervisor.sock   ; (the path to the socket file)
    
    ;[inet_http_server]         ; inet (TCP) server disabled by default
    ;port=127.0.0.1:9001        ; (ip_address:port specifier, *:port for all iface)
    ;username=user              ; (default is no username (open server))
    ;password=123               ; (default is no password (open server))
    
    [supervisord]
    logfile=/data/bkce/logs/consul/supervisord_out.log ; (main log file;default $CWD/supervisord_out.log)
    logfile_maxbytes=50MB        ; (max main logfile bytes b4 rotation;default 50MB)
    logfile_backups=10           ; (num of main logfile rotation backups;default 10)
    loglevel=info                ; (log level;default info; others: debug,warn,trace)
    pidfile=/data/bkce/logs/consul/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
    nodaemon=false               ; (start in foreground if true;default false)
    minfds=1024                  ; (min. avail startup file descriptors;default 1024)
    minprocs=200                 ; (min. avail process descriptors;default 200)
    
    [rpcinterface:supervisor]
    supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
    
    [supervisorctl]
    serverurl=unix:///data/bkce/logs/consul/supervisor.sock ; use a unix:// URL  for a unix socket
    ;serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket
    ;username=chris              ; should be same as http_username if set
    ;password=123                ; should be same as http_password if set
    ;prompt=mysupervisor         ; cmd line prompt (default "supervisor")
    ;history_file=~/.sc_history  ; use readline history if available
    
    [program:consul-agent]
    directory=/usr/bin/
    command=/usr/bin/consul agent -config-file=/data/bkce/etc/consul.conf -config-dir=/data/bkce/etc/consul.d -ui
    autostart=true
    autorestart=true
    redirect_stderr=true
    stdout_logfile=/data/bkce/logs/consul/consul.log
    ----------------------------------------------------------------------------------------------------------------------
    
    
    
    #第二步:
    nginx配置目录新增consul.conf 内容如下:
    ----------------------------------------------------------------------------------------------------------------------
    upstream CONSUL {
        server 127.0.0.1:8500 max_fails=1  fail_timeout=30s;
    }
    
    proxy_next_upstream  http_502 http_504 error timeout invalid_header;
    
    server {
        listen 80;
        server_name  consul-5.bkty.xyz;
    
        client_max_body_size    512m;
        access_log  /data/bkce/logs/nginx/consul_fqdn_access.log;
    
    #    ### ssl config begin ###
    #    listen 80 ssl;
    #    include /data/bkce/etc/nginx/bk.ssl;
    #    # force https-redirects
    #    if ($scheme = http) {
    #        return 301 https://$server_name$request_uri;
    #    }
    #    ### ssl config end ###
    
        # ============================ consul ============================
        # CONSUL_SERVICE HOST/PORT
        location / {
            proxy_pass http://CONSUL;
            proxy_pass_header Server;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Scheme $scheme;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header X-Forwarded-Host $http_host;
            proxy_set_header Host $http_host;
            proxy_redirect off;
            proxy_read_timeout 600;
        }
    }
    ----------------------------------------------------------------------------------------------------------------------
    
    
    学习方法:
    拷贝一份其他配置文件 如: cp job.conf consul.conf
    修改: upstream OPEN_JOB {
    改为: upstream CONSUL {    反向代理中的 CONSUL 名
    
    
    修改: proxy_pass http://OPEN_JOB;
    改为: proxy_pass http://CONSUL;
    
    
    修改: [server_name]选项中的: server_name  job-5.bkty.xyz
    改为: [server_name]选项中的: server_name  consul-5.bkty.xyz;
    
    
    #第三步 添加解析:
    host文件添加解析:
    139.155.175.122 consul-5.bkty.xyz
    
    重启nginx服务;
    nginx -s reload
    
  • 相关阅读:
    [置顶] Guava学习之Lists
    Study notes for B-tree and R-tree
    uva 620 Cellular Structure
    [置顶] 程序员面试之道(《程序员面试笔试宝典》)之看着别人手拿大把的offer,不淡定了怎么办?
    HDU 4046 Panda (ACM ICPC 2011北京赛区网络赛)
    有N个正实数(注意是实数,大小升序排列) x1 , x2 ... xN,另有一个实数M。 需要选出若干个x,使这几个x的和与 M 最接近。 请描述实现算法,并指出算法复杂度
    C# 未能加载文件或程序集“MySQLDriverCS..." 错误解决
    LA 3942 Remember the Word(前缀树&树上DP)
    原根-快速求解一个数的原根
    线程初步了解
  • 原文地址:https://www.cnblogs.com/superlinux/p/14023688.html
Copyright © 2020-2023  润新知