按照官 介绍:单机版对于很多中小公司足够用了,简单高效、快速直接,建议使用云主机,性能不够了直接升配,可以应对每秒上 的数据点小于100万的情形,如果只是监控机器(每台机器每个周期大概采集200个数据点)采集周期频率设置10秒的话,支撑上限是5万台
关于夜莺不再过多赘述了,直接进入正文。
正文
单机版架构
来自官方
系统版本:
安装基础软件(可选,如果有无需安装)
yum -y install vim wget
安装 Prometheus
这里可以查询官 Prometheus 版本,截止发文前为止版本为2.32.1
mkdir -p /opt/prometheuswget https://github.com/prometheus/prometheus/releases/download/v2.32.1/prometheus-2.32.1.linux-amd64.tar.gztar xf prometheus-2.32.1.linux-amd64.tar.gzcp -far prometheus-2.32.1.linux-amd64/* /opt/prometheus/
设置守护进程
Prometheus 在启动的时候要注意开启 –enable-feature=remote-write-receiver
cat <<EOF >/etc/systemd/system/prometheus.service[Unit]Description="prometheus"Documentation=https://prometheus.io/After=network.target[Service]Type=simpleExecStart=/opt/prometheus/prometheus --config.file=/opt/prometheus/prometheus.yml --storage.tsdb.path=/opt/prometheus/data --web.enable-lifecycle --enable-feature=remote-write-receiver --query.lookback-delta=2m Restart=on-failureSuccessExitStatus=0LimitNOFILE=65536StandardOutput=syslogStandardError=syslogSyslogIdentifier=prometheus[Install]WantedBy=multi-user.targetEOF
启动 Prometheus
systemctl daemon-reloadsystemctl enable prometheussystemctl restart prometheussystemctl status prometheus
数据库部分
1.安装数据库
yum -y install mariadb-server
2.启动数据库
systemctl start mariadb && systemctl enable mariadb
3.设置数据库密码
mysql -e "SET PASSWORD FOR 'root'@'localhost' = PASSWORD('xiaoyu123');"
Redis 部分
1.安装redis
需要安装EPEL源方可安装redis
yum -y install epel-releaseyum -y install redis
2.启动 redis
systemctl start redis && systemctl enable redis
安装夜莺组件
1.创建相关目录
mkdir -p /opt/n9e && cd /opt/n9e
2.下载夜莺,以官 最新版为主
wget https://github.com/didi/nightingale/releases/download/v5.2.1/n9e-5.2.1.tar.gz
3.解压文件
tar zxvf n9e-5.2.1.tar.gz
4.导入架构文件
mysql -uroot -pxiaoyu123 < docker/initsql/a-n9e.sql
修改配置文件
1.修改server配置文件
vim /opt/n9e/etc/server.conf
2.修改webapi配置文件
vim /opt/n9e/etc/webapi.conf
1.n9e-server
cat <<EOF >/etc/systemd/system/n9e-server.service[Unit]Description="n9e-server"After=network.target[Service]Type=simpleExecStart=/opt/n9e/n9e serverWorkingDirectory=/opt/n9eRestart=on-failureSuccessExitStatus=0LimitNOFILE=65536StandardOutput=syslogStandardError=syslogSyslogIdentifier=n9e-server[Install]WantedBy=multi-user.targetEOF
2.n9e-webapi
cat <<EOF >/etc/systemd/system/n9e-webapi.service[Unit]Description="n9e-webapi"After=network.target[Service]Type=simpleExecStart=/opt/n9e/n9e webapiWorkingDirectory=/opt/n9eRestart=on-failureSuccessExitStatus=0LimitNOFILE=65536StandardOutput=syslogStandardError=syslogSyslogIdentifier=n9e-server[Install]WantedBy=multi-user.targetEOF
启动夜莺组件
systemctl daemon-reloadsystemctl enable n9e-server n9e-webapisystemctl restart n9e-server n9e-webapisystemctl status n9e-server systemctl status n9e-webapi
访问前端
默认访问地址为:http://your ip address:18000
默认用户名密码为:root/root.2000
登录页
语句查询
图形
写在最后
目前V5版本已经设置 telegraf 为主要采集器,prometheus 的采集器也可以使用,相对于夜莺成为了一个分析器,最终传递到 grafana 进行展示,遗憾的是夜莺目前只支持折线图,大家感兴趣的不妨可以尝试一下,下期会就使用再进行探讨。
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!