IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 大数据 -> Flink部署——Metric Reporters -> 正文阅读

[大数据]Flink部署——Metric Reporters


Flink 允许向外部系统报告指标。有关 Flink 公制系统的更多信息,请访问 公制系统文档

Reporter

通过在 conf/flink-conf.yaml 中配置一个或多个报告器,可以向外部系统公开指标。这些报告器将在启动时在每个作业和任务管理器上实例化。

  • metrics.reporter..:通用设置报告器命名。
  • metrics.reporter..class:用于报告器的跟踪器类,命名为
  • metrics.reporter..factory.class:报告方工厂类使用,为报告器命名
  • metrics.reporter..interval: 用于名为的报告器的报告器间隔
  • metrics.reporter..scope.delimiter:用于名为 的报告器的标识符(默认值使用 metrics.scope.delimiter)的分隔符。
  • metrics.reporter..scope.variables.excludes:(可选)分号 (;)基于标签的报告者应该忽略的变量的单独列表(例如,Prometheus,InfluxDB)。
  • metrics.reporters: (可选)以逗号分隔的包含报告者姓名列表。默认情况下,将使用所有已配置的报告器。
  • metrics.reporter..scope.variables.additional: (可选)变量及其值的逗号分隔映射,由冒号 (😃 分隔。这些映射由基于标签的报告器(例如Prometheux,InfluxDB)添加到变量映射中。

所有报告者必须至少具有类或工厂.class属性。可以/应该使用哪个属性取决于报告器实现。有关详细信息,请参阅各个报告器配置部分。某些报告器(称为“计划”)允许指定报告间隔。下面将列出特定于每个报告器的更多设置。

指定多个报告器的示例报告器配置

metrics.reporters: my_jmx_reporter,my_other_reporter

metrics.reporter.my_jmx_reporter.factory.class: org.apache.flink.metrics.jmx.JMXReporterFactory
metrics.reporter.my_jmx_reporter.port: 9020-9040
metrics.reporter.my_jmx_reporter.scope.variables.excludes: job_id;task_attempt_num
metrics.reporter.my_jmx_reporter.scope.variables.additional: cluster_name:my_test_cluster,tag_name:tag_value

metrics.reporter.my_other_reporter.class: org.apache.flink.metrics.graphite.GraphiteReporter
metrics.reporter.my_other_reporter.host: 192.168.1.1
metrics.reporter.my_other_reporter.port: 10000

要点:当Flink启动时,包含reporter程序的jar必须是可访问的。支持factory.class属性的记者可以作为插件加载。否则jar必须放在/lib文件夹中。默认情况下,Flink附带的reporter(即本页记录的所有reporter)是可用的。

您可以通过实现org.apache.flink.metrics.reporter.MetricReporter接口来编写自己的Reporter。如果Reporter应该定期发送报告,那么您也必须实现Scheduled接口。通过另外实现MetricReporterFactory,您的reporter也可以作为插件加载。

以下部分列出了支持的reporter。

JMX

(org.apache.flink.metrics.jmx.JMXReporter)
您不必包含额外的依赖项,因为JMX报告程序在默认情况下是可用的,但不是激活的。

参数:

  • port——(可选)JMX侦听连接的端口。为了能够在一台主机上运行报告程序的多个实例(例如,当一个TaskManager与JobManager同时存在时),建议使用9250-9260这样的端口范围。当指定一个范围时,实际的端口将显示在相关的作业或任务管理器日志中。如果设置了这个设置,Flink将为给定的端口/范围启动一个额外的JMX连接器。在默认的本地JMX接口上,度量总是可用的。

配置样例:

metrics.reporter.jmx.factory.class: org.apache.flink.metrics.jmx.JMXReporterFactory
metrics.reporter.jmx.port: 8789

通过JMX公开的度量标准由域和键属性列表标识,它们共同构成对象名称。

域总是以org.apache.flink开头,后面跟着一个通用度量标识符。与通常的标识符不同,它不受作用域格式的影响,不包含任何变量,并且在作业中是常量。这样一个域的示例是org.apache.flink.job.task.numBytesOut。

键-属性列表包含与给定度量相关的所有变量的值,无论配置的范围格式如何。这样一个列表的示例是host=localhost,job_name=MyJob,task_name=MyTask。

因此,域标识一个指标类,而键-属性列表标识该指标的一个(或多个)实例。

Graphite

(org.apache.flink.metrics.graphite.GraphiteReporter)

参数:

  • host - the Graphite server host
  • port - the Graphite server port
  • protocol - protocol to use (TCP/UDP)

配置样例:

metrics.reporter.grph.factory.class: org.apache.flink.metrics.graphite.GraphiteReporterFactory
metrics.reporter.grph.host: localhost
metrics.reporter.grph.port: 2003
metrics.reporter.grph.protocol: TCP
metrics.reporter.grph.interval: 60 SECONDS

InfluxDB

(org.apache.flink.metrics.influxdb.InfluxdbReporter)
为了使用这个reporter必须拷贝/opt/flink-metrics-influxdb-1.15.0.jar到flink部署目录的plugins/influxdb下面。

参数:

key默认值类型描述
connectTimeout10000Integer(可选)InfluxDB连接超时
consistencyONEEnum(可选)指标的InfluxDB一致性级别,包括:ALL,ANY,ONE,QUORUM
db(none)String使用fluxdb数据库存储指标
host(none)Stringthe InfluxDB server host
password(none)String(可选)用于身份验证的InfluxDB数据库用户的密码
port8086IntegerInfluxDB 数据库服务端口
retentionPolicy(none)String(可选)指标的InfluxDB保留策略
schemehttpEnumString
username(none)String(可选)用于身份验证的InfluxDB数据库用户名
writeTimeout10000Integer(可选)指标的InfluxDB写超时

Example configuration:

metrics.reporter.influxdb.factory.class: org.apache.flink.metrics.influxdb.InfluxdbReporterFactory
metrics.reporter.influxdb.scheme: http
metrics.reporter.influxdb.host: localhost
metrics.reporter.influxdb.port: 8086
metrics.reporter.influxdb.db: flink
metrics.reporter.influxdb.username: flink-metrics
metrics.reporter.influxdb.password: qwerty
metrics.reporter.influxdb.retentionPolicy: one_hour
metrics.reporter.influxdb.consistency: ANY
metrics.reporter.influxdb.connectTimeout: 60000
metrics.reporter.influxdb.writeTimeout: 60000
metrics.reporter.influxdb.interval: 60 SECONDS

reporter程序将使用http协议和指定的保留策略(或在服务器上指定的默认策略)向fluxdb服务器发送指标。所有Flink指标变量(请参阅所有变量列表)都导出为fluxdb标签。

Prometheus

(org.apache.flink.metrics.prometheus.PrometheusReporter)
参数:

  • port——(可选)Prometheus出口商监听的端口,默认为9249。为了能够在一台主机上运行报告程序的多个实例(例如,当一个TaskManager与JobManager同时存在时),建议使用9250-9260这样的端口范围。
  • filterLabelValueCharacters -(可选)是否过滤标签值字符。如果启用,所有不匹配[a-zA-Z0-9:_]的字符将被删除,否则没有字符将被删除。在禁用此选项之前,请确保您的标签值满足普罗米修斯要求。

Example configuration:

metrics.reporter.prom.class: org.apache.flink.metrics.prometheus.PrometheusReporter

Flink指标类型映射到普罗米修斯指标类型如下:

FlinkPrometheusNote
CounterGauge普罗米修斯计数器不能被减少。
GaugeGauge只支持数字和布尔值。
HistogramSummaryQuantiles .5, .75, .95, .98, .99 and .999
MeterGauge仪表输出仪表的速率.

所有Flink指标变量(参见所有变量列表)都作为标签导出到普罗米修斯。

PrometheusPushGateway

(org.apache.flink.metrics.prometheus.PrometheusPushGatewayReporter)

参数:

Example configuration:

metrics.reporter.promgateway.class: org.apache.flink.metrics.prometheus.PrometheusPushGatewayReporter
metrics.reporter.promgateway.hostUrl: http://localhost:9091
metrics.reporter.promgateway.jobName: myJob
metrics.reporter.promgateway.randomJobNameSuffix: true
metrics.reporter.promgateway.deleteOnShutdown: false
metrics.reporter.promgateway.groupingKey: k1=v1;k2=v2
metrics.reporter.promgateway.interval: 60 SECONDS

PrometheusPushGatewayReporter将指标推送到Pushgateway,可以被Prometheus抓取。

StatsD

(org.apache.flink.metrics.statsd.StatsDReporter)
Parameters:

  • host - the StatsD server host
  • port - the StatsD server port

Example configuration:

metrics.reporter.stsd.factory.class: org.apache.flink.metrics.statsd.StatsDReporterFactory
metrics.reporter.stsd.host: localhost
metrics.reporter.stsd.port: 8125
metrics.reporter.stsd.interval: 60 SECONDS

Datadog

(org.apache.flink.metrics.datadog.DatadogHttpReporter)

注意,Flink度量中的任何变量,例如, <job_name>, <tm_id>, <subtask_index>, <task_name>, and <operator_name>,,都将作为标签发送给Datadog。标签将类似于host:localhost和job_name:myjobname。

注意:Histograms是一系列遵循Datadog Histograms命名惯例的量规(.)。默认情况下报告最小聚合,而sum不可用。与datadog提供的Histograms相比,报告的聚合不是针对特定的报告间隔计算的。

Parameters:

  • apikey - Datadog API密钥
  • tags - (可选的)全局标记,当发送到Datadog时将应用于指标。标签之间只能用逗号分隔
  • proxyHost - (可选)发送给Datadog时使用的代理主机。
  • proxyPort - (可选)发送给Datadog时使用的代理端口,默认为8080。
  • dataCenter - (可选)需要连接的数据中心(EU/US),默认为US。
  • maxMetricsPerRequest - (可选)每个请求中包含的度量的最大数量,默认为2000。

Example configuration:

metrics.reporter.dghttp.factory.class: org.apache.flink.metrics.datadog.DatadogHttpReporterFactory
metrics.reporter.dghttp.apikey: xxx
metrics.reporter.dghttp.tags: myflinkapp,prod
metrics.reporter.dghttp.proxyHost: my.web.proxy.com
metrics.reporter.dghttp.proxyPort: 8080
metrics.reporter.dghttp.dataCenter: US
metrics.reporter.dghttp.maxMetricsPerRequest: 2000
metrics.reporter.dghttp.interval: 60 SECONDS

Slf4j

(org.apache.flink.metrics.slf4j.Slf4jReporter)

Example configuration:

metrics.reporter.slf4j.factory.class: org.apache.flink.metrics.slf4j.Slf4jReporterFactory
metrics.reporter.slf4j.interval: 60 SECONDS
  大数据 最新文章
实现Kafka至少消费一次
亚马逊云科技:还在苦于ETL?Zero ETL的时代
初探MapReduce
【SpringBoot框架篇】32.基于注解+redis实现
Elasticsearch:如何减少 Elasticsearch 集
Go redis操作
Redis面试题
专题五 Redis高并发场景
基于GBase8s和Calcite的多数据源查询
Redis——底层数据结构原理
上一篇文章      下一篇文章      查看所有文章
加:2022-06-29 19:08:56  更:2022-06-29 19:10:32 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年4日历 -2024/4/24 8:38:26-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码