前言
!> 这个项目已经从滴滴抽离了,一些主程也开办自己的公司了,而且现在支持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
学无止境,谦卑而行.