美文网首页
grafana 高可用

grafana 高可用

作者: xyz098 | 来源:发表于2020-01-20 10:54 被阅读0次

grafana 可视化工具 how to setup grafana ha

install

wget https://dl.grafana.com/oss/release/grafana-5.3.4-1.aarch64.rpm 
yum localinstall grafana-5.3.4-1.aarch64.rpm 

/etc/init.d/grafana-server start
/etc/init.d/iptables status &> /dev/null && iptables -I INPUT 1 -p tcp -m state --state NEW -m tcp --dport 3000 -j ACCEPT && service iptables save

# UI (默认用户密码 admin/admin)
http://127.0.0.1:3000

problem

  • 数据共享存储问题
  • 处理session问题
  • nginx的upstream代理

configuration

  • grafana

    # 建库
    > create database grafana
    
    # egrep -v  "^$|;|#"  /etc/grafana/grafana.ini
    [paths]
    data = /var/lib/grafana
    [server]
    http_port = 3000
    root_url = http://127.0.0.1/dash
    
    ; db共享
    [database]
    type = mysql
    host = 127.0.0.1:3306
    name = grafana
    user = abc
    password = abc
    
    ; session共享
    [session]
    provider = mysql
    provider_config = abc:abc@tcp(127.0.0.1:3306)/grafana
    cookie_name = grafana_sess
    cookie_secure = false
    session_life_time = 86400
    
    [security]
    admin_user = admin
    admin_password = 123@t8t.com
    
    [auth.anonymous]
    enabled = true
    
  • nginx nginx-upstream容错说明

    upstream mdash {
            server 127.0.0.1:3000 weight=10 fail_timeout=10s;
            server 192.168.1.1:3000 weight=10 fail_timeout=10s;
            keepalive 65;
    }
    server {
            listen       80;
            server_name  dash.abc.com;
            access_log   /var/log/nginx/dash_abc_access.log main;
            error_log    /var/log/nginx/dash_abc_error.log;
    
         location /dash/ {
                  proxy_set_header  Host $host;
                  proxy_set_header  X-Real-IP  $remote_addr;
                  proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
                  proxy_set_header X-Forwarded-For $remote_addr;
                  proxy_connect_timeout   30;
                  proxy_send_timeout      30;
                  proxy_read_timeout      30;
                  # nginx容错
                  proxy_next_upstream     http_500 http_502 error timeout invalid_header http_503; 
                  proxy_pass http://mdash/;
            }
    } 
    

相关文章

网友评论

      本文标题:grafana 高可用

      本文链接:https://www.haomeiwen.com/subject/aghjzctx.html