Apache Zookeeper 和 Elasticsearch 集成

由 InfluxData 构建的开源数据连接器 Telegraf 提供支持,实现强大的性能和简单的集成。

info

这不是大规模实时查询的推荐配置。 为了进行查询和压缩优化、高速摄取和高可用性,您可能需要考虑Apache Zookeeper 和 InfluxDB

50 亿+

Telegraf 下载量

#1

时序数据库
来源:DB Engines

10 亿+

InfluxDB 下载量

2,800+

贡献者

目录

强大的性能,无限的扩展能力

收集、组织和处理海量高速数据。 当您将任何数据视为时序数据时,它都会变得更有价值。 借助 InfluxDB,排名第一的时序平台,专为与 Telegraf 协同扩展而构建。

查看入门方法

输入和输出集成概述

Zookeeper Telegraf 插件从 Zookeeper 服务器收集和报告指标,从而方便监控和性能分析。 它利用“mntr”命令输出收集对于维护 Zookeeper 运行状况至关重要的基本统计信息。

Telegraf Elasticsearch 插件无缝地将指标发送到 Elasticsearch 服务器。 该插件处理模板创建和动态索引管理,并支持各种 Elasticsearch 特定的功能,以确保数据格式正确,以便存储和检索。

集成详情

Apache Zookeeper

Telegraf 的 Zookeeper 插件旨在通过执行“mntr”命令从 Zookeeper 服务器收集重要统计信息。 此插件充当监控工具,捕获与 Zookeeper 性能相关的重要指标,包括连接详细信息、延迟和各种操作统计信息,从而方便评估 Zookeeper 部署的运行状况和效率。 与启用 Prometheus 指标提供程序时推荐使用的 Prometheus 输入插件相比,Zookeeper 插件访问“mntr”命令的原始输出,使其专为不采用 Prometheus 进行指标报告的配置量身定制。 这种独特的方法允许管理员直接从 Zookeeper 收集 Java Properties 格式的指标,确保全面了解 Zookeeper 的运行状态,并能够及时响应性能异常。 它在 Zookeeper 作为集中式服务运行的环境中尤其出色,用于维护分布式系统的配置信息和名称,从而为故障排除和容量规划提供不可估量的见解。

Elasticsearch

此插件将指标写入 Elasticsearch,这是一个分布式 RESTful 搜索和分析引擎,能够近乎实时地存储大量数据。 它旨在处理 Elasticsearch 5.x 到 7.x 版本,并利用其动态模板功能来正确管理数据类型映射。 该插件支持高级功能,例如模板管理、动态索引命名以及与 OpenSearch 的集成。 它还允许配置 Elasticsearch 节点的身份验证和运行状况监控。

配置

Apache Zookeeper

[[inputs.zookeeper]]
  ## An array of address to gather stats about. Specify an ip or hostname
  ## with port. ie localhost:2181, 10.0.0.1:2181, etc.

  ## If no servers are specified, then localhost is used as the host.
  ## If no port is specified, 2181 is used
  servers = [":2181"]

  ## Timeout for metric collections from all servers. Minimum timeout is "1s".
  # timeout = "5s"

  ## Float Parsing - the initial implementation forced any value unable to be
  ## parsed as an int to be a string. Setting this to "float" will attempt to
  ## parse float values as floats and not strings. This would break existing
  ## metrics and may cause issues if a value switches between a float and int.
  # parse_floats = "string"

  ## Optional TLS Config
  # enable_tls = false
  # tls_ca = "/etc/telegraf/ca.pem"
  # tls_cert = "/etc/telegraf/cert.pem"
  # tls_key = "/etc/telegraf/key.pem"
  ## If false, skip chain & host verification
  # insecure_skip_verify = true

Elasticsearch


[[outputs.elasticsearch]]
  ## The full HTTP endpoint URL for your Elasticsearch instance
  ## Multiple urls can be specified as part of the same cluster,
  ## this means that only ONE of the urls will be written to each interval
  urls = [ "http://node1.es.example.com:9200" ] # required.
  ## Elasticsearch client timeout, defaults to "5s" if not set.
  timeout = "5s"
  ## Set to true to ask Elasticsearch a list of all cluster nodes,
  ## thus it is not necessary to list all nodes in the urls config option
  enable_sniffer = false
  ## Set to true to enable gzip compression
  enable_gzip = false
  ## Set the interval to check if the Elasticsearch nodes are available
  ## Setting to "0s" will disable the health check (not recommended in production)
  health_check_interval = "10s"
  ## Set the timeout for periodic health checks.
  # health_check_timeout = "1s"
  ## HTTP basic authentication details.
  ## HTTP basic authentication details
  # username = "telegraf"
  # password = "mypassword"
  ## HTTP bearer token authentication details
  # auth_bearer_token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"

  ## Index Config
  ## The target index for metrics (Elasticsearch will create if it not exists).
  ## You can use the date specifiers below to create indexes per time frame.
  ## The metric timestamp will be used to decide the destination index name
  # %Y - year (2016)
  # %y - last two digits of year (00..99)
  # %m - month (01..12)
  # %d - day of month (e.g., 01)
  # %H - hour (00..23)
  # %V - week of the year (ISO week) (01..53)
  ## Additionally, you can specify a tag name using the notation {{tag_name}}
  ## which will be used as part of the index name. If the tag does not exist,
  ## the default tag value will be used.
  # index_name = "telegraf-{{host}}-%Y.%m.%d"
  # default_tag_value = "none"
  index_name = "telegraf-%Y.%m.%d" # required.

  ## Optional Index Config
  ## Set to true if Telegraf should use the "create" OpType while indexing
  # use_optype_create = false

  ## Optional TLS Config
  # tls_ca = "/etc/telegraf/ca.pem"
  # tls_cert = "/etc/telegraf/cert.pem"
  # tls_key = "/etc/telegraf/key.pem"
  ## Use TLS but skip chain & host verification
  # insecure_skip_verify = false

  ## Template Config
  ## Set to true if you want telegraf to manage its index template.
  ## If enabled it will create a recommended index template for telegraf indexes
  manage_template = true
  ## The template name used for telegraf indexes
  template_name = "telegraf"
  ## Set to true if you want telegraf to overwrite an existing template
  overwrite_template = false
  ## If set to true a unique ID hash will be sent as sha256(concat(timestamp,measurement,series-hash)) string
  ## it will enable data resend and update metric points avoiding duplicated metrics with different id's
  force_document_id = false

  ## Specifies the handling of NaN and Inf values.
  ## This option can have the following values:
  ##    none    -- do not modify field-values (default); will produce an error if NaNs or infs are encountered
  ##    drop    -- drop fields containing NaNs or infs
  ##    replace -- replace with the value in "float_replacement_value" (default: 0.0)
  ##               NaNs and inf will be replaced with the given number, -inf with the negative of that number
  # float_handling = "none"
  # float_replacement_value = 0.0

  ## Pipeline Config
  ## To use a ingest pipeline, set this to the name of the pipeline you want to use.
  # use_pipeline = "my_pipeline"
  ## Additionally, you can specify a tag name using the notation {{tag_name}}
  ## which will be used as part of the pipeline name. If the tag does not exist,
  ## the default pipeline will be used as the pipeline. If no default pipeline is set,
  ## no pipeline is used for the metric.
  # use_pipeline = "{{es_pipeline}}"
  # default_pipeline = "my_pipeline"
  #
  # Custom HTTP headers
  # To pass custom HTTP headers please define it in a given below section
  # [outputs.elasticsearch.headers]
  #    "X-Custom-Header" = "custom-value"

  ## Template Index Settings
  ## Overrides the template settings.index section with any provided options.
  ## Defaults provided here in the config
  # template_index_settings = {
  #   refresh_interval = "10s",
  #   mapping.total_fields.limit = 5000,
  #   auto_expand_replicas = "0-1",
  #   codec = "best_compression"
  # }

输入和输出集成示例

Apache Zookeeper

  1. 集群运行状况监控:集成 Zookeeper 插件以监控依赖 Zookeeper 进行配置管理和服务发现的分布式应用程序的运行状况和性能。 通过跟踪会话计数、延迟和数据大小等指标,DevOps 团队可以在潜在问题升级之前识别出来,从而确保应用程序的高可用性和可靠性。

  2. 性能基准:利用此插件在不同的工作负载场景中对 Zookeeper 性能进行基准测试。 这不仅有助于了解 Zookeeper 在负载下的行为方式,还有助于调整配置以优化吞吐量并减少高峰操作期间的延迟。

  3. 异常警报:将此插件与警报工具结合使用,创建一个主动监控系统,如果特定的 Zookeeper 指标超过阈值限制(例如打开的文件描述符计数或高延迟值),则通知工程师。 这使团队能够及时响应可能影响服务可靠性的问题。

  4. 历史数据分析:将 Zookeeper 插件收集的指标存储在时序数据库中,以分析历史性能趋势。 这使团队能够评估随时间推移变化的影响,评估扩展操作的有效性,并规划未来的容量需求。

Elasticsearch

  1. 基于时间的索引:使用此插件将指标存储在 Elasticsearch 中,以根据收集时间对每个指标进行索引。 例如,CPU 指标可以存储在名为 telegraf-2023.01.01 的每日索引中,从而实现简单的基于时间的查询和保留策略。

  2. 动态模板管理:利用模板管理功能自动创建针对您的指标量身定制的自定义模板。 这使您可以定义如何索引和分析不同的字段,而无需手动配置 Elasticsearch,从而确保用于查询的最佳数据结构。

  3. OpenSearch 兼容性:如果您使用的是 AWS OpenSearch,则可以通过激活兼容模式来配置此插件以实现无缝工作,从而确保您现有的 Elasticsearch 客户端保持功能正常,并与较新的集群设置兼容。

反馈

感谢您成为我们社区的一份子! 如果您有任何一般性反馈或在这些页面上发现任何错误,我们欢迎并鼓励您提出意见。 请在 InfluxDB 社区 Slack 中提交您的反馈。

强大的性能,无限的扩展能力

收集、组织和处理海量高速数据。 当您将任何数据视为时序数据时,它都会变得更有价值。 借助 InfluxDB,排名第一的时序平台,专为与 Telegraf 协同扩展而构建。

查看入门方法

相关集成

HTTP 和 InfluxDB 集成

HTTP 插件从一个或多个 HTTP(S) 端点收集指标。 它支持各种身份验证方法和数据格式的配置选项。

查看集成

Kafka 和 InfluxDB 集成

此插件从 Kafka 读取消息,并允许基于这些消息创建指标。 它支持各种配置,包括不同的 Kafka 设置和消息处理选项。

查看集成

Kinesis 和 InfluxDB 集成

Kinesis 插件允许从 AWS Kinesis 流中读取指标。 它支持多种输入数据格式,并提供带有 DynamoDB 的检查点功能,以实现可靠的消息处理。

查看集成