
DorisDB提供两种监控报警的方案,第一种是使用内置的DorisManager,其自带的Agent从各个Host采集监控信息上报到Center Service然后做可视化展示,也提供了邮件和Webhook的方式发送报警通知。
但是如果用户为了二次开发需求,需要自己搭建部署监控服务,也可以使用开源的Prometheus+Grafana的方案,DorisDB提供了兼容Prometheus的信息采集接口,可以通过直接链接BE/FE的HTTP端口来获取集群的监控信息。
如果采购DorisDB企业版,则提供DorisManager进行监控;
如果使用Apache Doris、DorisDB标准版、百度Palo,则需要采用开源Prometheus+Grafana监控方案。

0. ENV
1) 介质环境准备
prometheus主程序:prometheus-2.27.1.linux-amd64.tar.gzprometheus主机监控程序:node_exporter-1.1.2.linux-amd64.tar.gzgrafana主程序:grafana-7.5.7-1.x86_64.rpm已安装DoridDB版本:DorisDB 1.15.2
2) 监控环境
Prometheus、grafana服务器:192.168.80.30DorisDB服务器:doris1、doris2、doris3
3) 端口使用情况
prometheus 9090grafana 3000fe 8030be 8040
1. Prometheus+Grafana监控方案
未购买DorisDB企业版用户,需要自建监控告警系统,使用开源的Prometheus+Grafana方案。
如果仅仅需要将监控数据接入自有的Prometheus系统,可以通过下列接口访问:
FE: fe_host:fe_http_port/metricsBE: be_host:be_web_server_port/metrics
如果需要JSON格式可以访问:
FE: fe_host:fe_http_port/metrics?type=jsonBE: be_host:be_web_server_port/metrics?type=json
本文只配置了对DorisDB监控,对DorisDB主机监控未配置,且未对配置DorisDB告警。
2. 安装prometheus
1) 介质下载
下载页面:
https://prometheus.io/download/
也可直接下载:
wget https://github.com/prometheus/prometheus/releases/download/v2.27.1/prometheus-2.27.1.linux-amd64.tar.gzwget https://github.com/prometheus/node_exporter/releases/download/v1.1.2/node_exporter-1.1.2.linux-amd64.tar.gz
2)安装GO语言
prometheus及相关组件如node_exporter、mysqld_exporter都是GO语言开发,需要先安装golang。
# wget -O etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo# yum -y install go# go versiongo version go1.15.5 linux/amd64
3) 安装prometheus
a. 二进制版,解压就能用
# tar zxvf prometheus-2.27.1.linux-amd64.tar.gz -C monitor/
b.创建软连接,便于管理
# ln -sv monitor/prometheus-2.27.1.linux-amd64/ monitor/prometheus
c.创建prometheus用户和组
groupadd -g 3434 prometheususeradd -u 3434 -g 3434 -s sbin/nologin -M prometheus
d.创建prometheus数据目录
mkdir monitor/prometheus/datachown -R prometheus:prometheus monitor/prometheus/datachown -R prometheus:prometheus monitor/prometheus
e.配置prometheus服务
vim /usr/lib/systemd/system/prometheus.service #新建并添加如下内容[Unit]Description=prometheusAfter=network.target[Service]Type=simpleUser=prometheusExecStart=/monitor/prometheus/prometheus \--config.file=/monitor/prometheus/prometheus.yml \--storage.tsdb.path=/monitor/prometheus/data \--storage.tsdb.retention=15d \--web.read-timeout=5m \--web.max-connections=10 \--query.max-concurrency=20 \--query.timeout=2m \--web.enable-lifecycle \--web.enable-admin-apiRestart=on-failure[Install]WantedBy=multi-user.target
f.参数解释
--config.file=/etc/prometheus/prometheus.yml #prometheus配置文件--storage.tsdb.path=/var/lib/prometheus #prometheus 存储数据路径--storage.tsdb.retention=15d #prometheus采集数据保留时间--web.read-timeout=5m #请求链接的最大等待时间--web.max-connections=10 #最大链接数--query.max-concurrency=20 #最大支持的并发查询量--query.timeout=2m #单个查询超时时间--web.enable-lifecycle #热加载--web.enable-admin-api #可以删除时序数据
g.启动prometheus
[root@monitor ~]# systemctl enable prometheus[root@monitor ~]# systemctl start prometheus
h.查看端口已启用
[root@monitor ~]# netstat -anlptu | grep :9090
i.访问Prometheus的web界面
http://192.168.80.30:9090
3. 安装grafnana
1) 下载并安装
进入下载页面:
https://grafana.com/grafana/download
选择当前版本7.5.7,Open Source版本,系统选择Linux
Red Hat, CentOS, RHEL, and Fedora(64 Bit)SHA256: 5e7649985bed0e4994f10b86c938bd1e895e394e39b58946dc08e2ff3573e89b# wget https://dl.grafana.com/oss/release/grafana-7.5.7-1.x86_64.rpm# yum -y install grafana-7.5.7-1.x86_64.rpm
可以视需求更改grafana数据、插件路径,此处默认。
2) 启动grafana服务
[root@monitor soft]# systemctl enable grafana-server[root@monitor soft]# systemctl start grafana-server[root@monitor soft]# systemctl status grafana-server[root@monitor soft]# ss -antlp | grep 3000LISTEN 0 128 [::]:3000 [::]:* users:(("grafana-server",pid=24985,fd=8))
3) 登录gra
打开浏览器
http://192.168.80.30:3000输入用户名和口令admin/admin => 首次登陆更改密码
作者:王坤,微信公众号:rundba,欢迎转载,转载请注明出处。
如需公众号转发,请联系wx:landnow。





