Nightingale——滴滴夜莺部署【一】

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
云数据库 RDS PostgreSQL,集群系列 2核4GB
简介: Nightingale——滴滴夜莺部署【一】

前言

!> 这个项目已经从滴滴抽离了,一些主程也开办自己的公司了,而且现在支持docker直接部署,具体的访问nightingale代码仓库吧。

夜莺(Nightingale)是滴滴基础平台联合滴滴云研发和开源的企业级监控解决方案。旨在满足云原生时代企业级的监控需求。Nightingale在产品完成度、系统高可用、以及用户体验方面,达到了企业级的要求,可满足不同规模用户的场景,小到几台服务,大到数十万都可以完美支撑。兼顾云原生和裸金属,支持应用监控和系统监控,插件机制灵活,插件丰富完善,具有高度的灵活性和可扩展性。

Nightingale 在 Open-Falcon 的基础上,结合滴滴内部的最佳实践,在性能、可维护性、易用性方面做了大量的改进,作为集团统一的监控解决方案,支撑了滴滴内部数十亿监控指标,覆盖了从系统、容器、到应用等各层面的监控需求,周活跃用户数千。

我们简单快捷,直接使用all-in-one来安装部署夜莺的这套监控系统~

步骤

下载n9e-1.3.0-438ec4a.el7.x86_64.rpm-bundle.tar.gz并进行解压和安装

wget https://dl.cactifans.com/n9e/1.3.0/n9e-1.3.0-438ec4a.el7.x86_64.rpm-bundle.tar.gz && tar -zxvf n9e-1.3.0-438ec4a.el7.x86_64.rpm-bundle.tar.gz && yum install n9e-* -y

安装相应的nginx和mysql

推荐使用oneinstack直接一键安装~

wget -c http://mirrors.linuxeye.com/oneinstack-full.tar.gz && tar xzf oneinstack-full.tar.gz && ./oneinstack/install.sh --nginx_option 1 --db_option 2 --dbinstallmethod 1 --dbrootpwd oneinstack --memcached  --reboot

mysql 导入表结构并创建相应的用户

mysql -uroot -p </usr/local/n9e/sql/n9e_hbs.sql
mysql -uroot -p </usr/local/n9e/sql/n9e_mon.sql
mysql -uroot -p </usr/local/n9e/sql/n9e_uic.sql

安全考虑,建议为 n9e 独立建立 mysql 用户,在 mysql 里创建 n9e 用户并授权

mysql>create user n9e@127.0.0.1 identified by '你的密码';
mysql>grant all on n9e_hbs.* to n9e@127.0.0.1;
mysql>grant all on n9e_mon.* to n9e@127.0.0.1;
mysql>grant all on n9e_uic.* to n9e@127.0.0.1;
mysql> flush privileges;

修改配置文件mysql.yml中的密码,通过sed或者手动都可以

vi /usr/local/n9e/etc/mysql.yml
---
uic:
  addr: "n9e:你的密码@tcp(127.0.0.1:3306)/n9e_uic?charset=utf8&parseTime=True&loc=Asia%2FShanghai"
  max: 16
  idle: 4
  debug: false
mon:
  addr: "n9e:你的密码@tcp(127.0.0.1:3306)/n9e_mon?charset=utf8&parseTime=True&loc=Asia%2FShanghai"
  max: 16
  idle: 4
  debug: false
hbs:
  addr: "n9e:你的密码@tcp(127.0.0.1:3306)/n9e_hbs?charset=utf8&parseTime=True&loc=Asia%2FShanghai"
  max: 16
  idle: 4
  debug: false

修改Nginx的配置文件

cat /usr/local/n9e/etc/nginx.conf 
   #放到http中
    proxy_connect_timeout   500ms;
    proxy_send_timeout      1000ms;
    proxy_read_timeout      3000ms;
    proxy_buffers           64 8k;
    proxy_busy_buffers_size    128k;
    proxy_temp_file_write_size 64k;
    proxy_redirect off;
    proxy_next_upstream error invalid_header timeout http_502 http_504;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Real-Port $remote_port;
    proxy_set_header Host $http_host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# server内容
     upstream n9e.monapi {
        server 127.0.0.1:5800;
        keepalive 10;
    }
    upstream n9e.index {
        server 127.0.0.1:5830;
        keepalive 10;
    }
    upstream n9e.transfer {
        server 127.0.0.1:5810;
        keepalive 10;
    }
    server {
        listen      52000; #监听端口改成自己对外的接口
        server_name  _;
        root         /usr/share/nginx/html;
        # Load configuration files for the default server block.
        location / {
            root /usr/local/n9e/pub;
        }
        location /api/portal {
            proxy_pass http://n9e.monapi;
        }
        location /api/index {
            proxy_pass http://n9e.index;
        }
        location /api/transfer {
            proxy_pass http://n9e.transfer;
        }
    }

nginx的完整配置

cat /usr/local/nginx/conf/nginx.conf
user www www;
worker_processes auto;
error_log /data/wwwlogs/error_nginx.log crit;
pid /var/run/nginx.pid;
worker_rlimit_nofile 51200;
events {
  use epoll;
  worker_connections 51200;
  multi_accept on;
}
http {
  include mime.types;
  default_type application/octet-stream;
  server_names_hash_bucket_size 128;
  client_header_buffer_size 32k;
  large_client_header_buffers 4 32k;
  client_max_body_size 1024m;
  client_body_buffer_size 10m;
  sendfile on;
  tcp_nopush on;
  keepalive_timeout 120;
  server_tokens off;
  tcp_nodelay on;
  fastcgi_connect_timeout 300;
  fastcgi_send_timeout 300;
  fastcgi_read_timeout 300;
  fastcgi_buffer_size 64k;
  fastcgi_buffers 4 64k;
  fastcgi_busy_buffers_size 128k;
  fastcgi_temp_file_write_size 128k;
  fastcgi_intercept_errors on;
    proxy_connect_timeout   500ms;
    proxy_send_timeout      1000ms;
    proxy_read_timeout      3000ms;
    proxy_buffers           64 8k;
    proxy_busy_buffers_size    128k;
    proxy_temp_file_write_size 64k;
    proxy_redirect off;
    proxy_next_upstream error invalid_header timeout http_502 http_504;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Real-Port $remote_port;
    proxy_set_header Host $http_host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  
  #Gzip Compression
  gzip on;
  gzip_buffers 16 8k;
  gzip_comp_level 6;
  gzip_http_version 1.1;
  gzip_min_length 256;
  gzip_proxied any;
  gzip_vary on;
  gzip_types
    text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml
    text/javascript application/javascript application/x-javascript
    text/x-json application/json application/x-web-app-manifest+json
    text/css text/plain text/x-component
    font/opentype application/x-font-ttf application/vnd.ms-fontobject
    image/x-icon;
  gzip_disable "MSIE [1-6]\.(?!.*SV1)";
  ##Brotli Compression
  #brotli on;
  #brotli_comp_level 6;
  #brotli_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript image/svg+xml;
  ##If you have a lot of static files to serve through Nginx then caching of the files' metadata (not the actual files' contents) can save some latency.
  #open_file_cache max=1000 inactive=20s;
  #open_file_cache_valid 30s;
  #open_file_cache_min_uses 2;
  #open_file_cache_errors on;
######################## default ############################
  server {
    listen 80;
    server_name _;
    access_log /data/wwwlogs/access_nginx.log combined;
    root /data/wwwroot/default;
    index index.html index.htm index.php;
    #error_page 404 /404.html;
    #error_page 502 /502.html;
    location /nginx_status {
      stub_status on;
      access_log off;
      allow 127.0.0.1;
      deny all;
    }
    location ~ [^/]\.php(/|$) {
      #fastcgi_pass remote_php_ip:9000;
      fastcgi_pass unix:/dev/shm/php-cgi.sock;
      fastcgi_index index.php;
      include fastcgi.conf;
    }
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
      expires 30d;
      access_log off;
    }
    location ~ .*\.(js|css)?$ {
      expires 7d;
      access_log off;
    }
    location ~ ^/(\.user.ini|\.ht|\.git|\.svn|\.project|LICENSE|README.md) {
      deny all;
    }
  }
######################## nightingale ############################
   upstream n9e.monapi {
        server 127.0.0.1:5800;
        keepalive 10;
    }
    upstream n9e.index {
        server 127.0.0.1:5830;
        keepalive 10;
    }
    upstream n9e.transfer {
        server 127.0.0.1:5810;
        keepalive 10;
    }
    server {
        listen      52000;
        server_name  _;
        root         /usr/share/nginx/html;
        # Load configuration files for the default server block.
        location / {
            root /usr/local/n9e/pub;
        }
        location /api/portal {
            proxy_pass http://n9e.monapi;
        }
        location /api/index {
            proxy_pass http://n9e.index;
        }
        location /api/transfer {
            proxy_pass http://n9e.transfer;
        }
    }
########################## vhost #############################
  include vhost/*.conf;
}

验证配置是否正确

nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

重新载入nginx

service nginx reload

启动所有组件服务

systemctl enable --now n9e-collector n9e-tsdb n9e-transfer n9e-monapi n9e-judge n9e-index

查看服务状态

cd /usr/local/n9e/
#查看有哪些命令
./control -h
Usage: ./control {start|stop|restart|status|build|pack} <module>
#查看所有服务状态(一共6个) | 全部启动后就可以进行下一步, 若某一个没启动可到/usr/local/n9e/logs中去查看相关服务的日志
 ./control status
root      18322  0.1  0.1 996288 25792 ?        Sl   May08   2:27 /usr/local/n9e/n9e-index
root      18351  0.1  0.1 1069996 22916 ?       Sl   May08   2:50 /usr/local/n9e/n9e-judge
root      18381  0.2  0.1 1152172 28780 ?       Sl   May08   5:28 /usr/local/n9e/n9e-collector
n9e       66032  0.1  0.1 1408048 28484 ?       Ssl  May08   2:53 /usr/local/n9e/n9e-tsdb
n9e       66116  0.6  0.1 1061668 23156 ?       Ssl  May08  13:21 /usr/local/n9e/n9e-transfer
n9e       66131  0.6  0.1 1070460 29588 ?       Ssl  May08  13:13 /usr/local/n9e/n9e-monapi
#启动(单个模块/所有模块 )
./control start collector 
./control start all

访问

使用浏览器打开http://公网ip 即可访问,默认账号 root 密码 root

学无止境,谦卑而行.

相关实践学习
如何快速连接云数据库RDS MySQL
本场景介绍如何通过阿里云数据管理服务DMS快速连接云数据库RDS MySQL,然后进行数据表的CRUD操作。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助 &nbsp; &nbsp; 相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
打赏
0
0
0
0
67
分享
相关文章
【云原生监控系列第一篇】一文详解Prometheus普罗米修斯监控系统(山前前后各有风景,有风无风都很自由)(一)
【云原生监控系列第一篇】一文详解Prometheus普罗米修斯监控系统(山前前后各有风景,有风无风都很自由)(一)
1848 0
【云原生监控系列第一篇】一文详解Prometheus普罗米修斯监控系统(山前前后各有风景,有风无风都很自由)(一)
无痛入门Prometheus:一个强大的开源监控和告警系统,如何快速安装和使用?
Prometheus 是一个完全开源的系统监控和告警工具包,受 Google 内部 BorgMon 系统启发,自2012年由前 Google 工程师在 SoundCloud 开发以来,已被众多公司采用。它拥有活跃的开发者和用户社区,现为独立开源项目,并于2016年加入云原生计算基金会(CNCF)。Prometheus 的主要特点包括多维数据模型、灵活的查询语言 PromQL、不依赖分布式存储、通过 HTTP 拉取时间序列数据等。其架构简单且功能强大,支持多种图形和仪表盘展示模式。安装和使用 Prometheus 非常简便,可以通过 Docker 快速部署,并与 Grafana 等可
1034 2
Nightingale——夜莺监控系统部署企业微信机器人告警系【四】
Nightingale——夜莺监控系统部署企业微信机器人告警系【四】
256 1
Nightingale——夜莺监控系统部署企业微信机器人告警系【四】
AutoMQ 开源可观测性方案:夜莺 Flashcat
在现代企业中,随着数据处理需求的不断增长,AutoMQ [1] 作为一种高效、低成本的流处理系统,逐渐成为企业实时数据处理的关键组件。然而,随着集群规模的扩大和业务复杂性的增加,确保 AutoMQ 集群的稳定性、高可用性和性能优化变得尤为重要。因此,集成一个强大而全面的监控系统对于维护 AutoMQ 集群的健康运行至关重要。夜莺监控系统以其高效的数据采集、灵活的告警管理和丰富的可视化能力,成为企业监控AutoMQ 集群的理想选择。通过使用夜莺监控系统,企业可以实时掌握 AutoMQ 集群的运行状态,及时发现和解决潜在问题,优化系统性能,确保业务的连续性和稳定性。
128 2
AutoMQ 开源可观测性方案:夜莺 Flashcat
Nightingale——夜莺监控版本升级
Nightingale——夜莺监控版本升级
78 0
阿里巴巴鹰眼系统简介
微服务框架带来的好处十分多,比如说它提高了开发的效率,它具备更好的扩展性。可是微服务其实是一把双刃剑,微服务同时也带来了一些问题,比如:
4051 0
阿里巴巴鹰眼系统简介
《2021 阿里云可观测技术峰会演讲实录合辑(下)》——一、基于OPLG从0到1构建统一可观测平台实践——场景实践2:如何基于Prometheus和Grafana做统一的监控和告警
《2021 阿里云可观测技术峰会演讲实录合辑(下)》——一、基于OPLG从0到1构建统一可观测平台实践——场景实践2:如何基于Prometheus和Grafana做统一的监控和告警
305 0