Elasticsearch的Marvel插件

Marvel是Elastic公司推出的商业监控方案,是用来监控Elasticsearch集群,历史状态的有力工具,便于性能优化以及故障诊断。监控主要分为六个层面,分别是集群层、节点层、索引层、分片层、事件层、Sense。

1.1.1 安装

Marvel是以Elasticsearch插件的形式存在的。在最新版本中Marvel有两个组件,一个是代理,需要安装在Elasticsearch集群中,一个是Kibana的插件,需要安装在Kibana中。

安装步骤:

1) 在Elasticsearch中安装Marvel插件。

bin/plugin install license

bin/plugin install marvel-agent

2) 在Kibana中安装Marvel插件

bin/kibana plugin --install elasticsearch/marvel/latest

3) 启动Elasticsearch和Kibana

bin/elasticsearch

bin/kibana

安装好后在浏览器中输入:http://127.0.0.1:5601/即可看到界面如图9.1所示。

 

图9.1 Kibana首页

然后在界面的菜单中选择Marvel,会看到如图9.2所示的界面:

 

图9.2 Marvel首页

然后点击elasticsearch,看到如图9.3所示的监控界面

 

图9-3 Marvel 监控页

本文由赛克 蓝德(secisland)原创,转载请标明作者和出处。

1.1.2 配置

l 监控参数配置

可以通过在每个节点的elasticsearch.yml中配置Marvel参数来控制从Elasticsearch集群中采集数据,可以添加一个自定义索引模板来更改索引监控的设置,从一个集群收集的数据中创建存储。

监控设置的参数在elasticsearch.yml文件中,从marvel.agent开始。

marvel.agent.cluster.state.timeout

设置用于收集群集状态的超时时间。默认为10秒。

marvel.agent.cluster.stats.timeout

设置用于收集群集统计的超时时间。默认为10秒。

marvel.agent.indices

控制哪些索引数据被收集,默认所有索引。指定索引的名称可以以逗号分隔的分开,例如test1,test2,test3。名称中可以包含通配符,例如test*。你可以明确地包括或排除相关索引。例如,包括所有以test开头,但要排除test3的索引,写法如下:+test*或者-test3。

marvel.agent.index.stats.timeout

设置用于收集索引统计的超时。默认为10秒。

marvel.agent.indices.stats.timeout

设置用于收集总索引统计的超时时间。默认为10秒。

marvel.agent.exporters

配置代理监测数据。默认情况下,代理安装在本地的群集上,它监视数据,使用HTTP协议把数据发送到一个单独的监控集群上,例如:

marvel.agent.exporters:

  id1:                              # default local exporter

    type: local

 

  id2:                                     # example of an http exporter

    type: http                             # exporter type, local or http

    host: [ "http://domain:port",... ]     # host(s) to send data to over http or https

 

    auth:

      username: <string>            # basic auth username

      password: <string>            # basic auth password

 

    connection:

      timeout: <time_value>         # http connection timeout (default: 6s)

      read_timeout: <time_value>    # http response timeout (default: connection.timeout * 10)

      keep_alive: true | false      # use persistent connections (default: true)

 

    ssl:

      hostname_verification: true | false  # check host certificate (default: true)

      protocol: <string>                   # security protocol (default: TLSv1.2)

      truststore.path: /path/to/file       # absolute path to the truststore

      truststore.password: <string>        # password for the truststore

      truststore.algorithm: <string>       # format for the truststore (default: SunX509)

 

    index:

      name:

        time_format: <string>              # time format suffix for marvel indices (default: "YYYY.MM.dd")

marvel.agent.index.recovery.active_only

控制是否所有的恢复数据被收集。设置为true收集有效的恢复数据。默认为false。

marvel.agent.index.recovery.timeout

设置用于收集恢复数据的超时时间。默认为10秒。

marvel.agent.interval

控制收集数据样本的频率。默认设置为10秒,设置为-1表示禁用数据收集。

marvel.history.duration

设置监控创建的索引将被自动删除的保留时间。默认为7天。设置为-1来禁用自动删除监控索引。

l 监控索引配置

监控使用一个索引模板来配置用于存储从集群中收集数据的索引。

可以通过如下命令检索默认的模板:

GET /_template/.marvel-es

默认情况下,模板配置一个分片和一个复制的监控索引。要覆盖默认设置,可以添加自己的模板,例如:

PUT /_template/custom_marvel

{

    "template": ".marvel*",

    "order": 1,

    "settings": {

        "number_of_shards": 5,

        "number_of_replicas": 2

    }

}

l Kibana配置相关

在Kibana 的配置文件(kibana.yml)中可以设置Marvel监控参数,在大多数情况下,默认值已经可以很好工作。

marvel.max_bucket_size

从检索索引节点指标聚合中返回执行聚合检索索引和节点的桶的数量。默认为10000。

marvel.min_interval_seconds

时间桶所能表示的最小秒数。默认为10秒。

marvel.node_resolver

被认为是唯一节点的标志。

marvel.report_stats

是否将集群统计数据发送到Elastic公司。默认为true。

l Tribe部落节点监控配置

如果你通过一个部落节点连接到一个集群,需要在部落节点以及集群中的节点上安装监控代理来监控集群。如果群集上设置了权限,则还需要在部落节点上安装和配置权限。

排除部落节时需要在elasticsearch.yml配置文件中设置marvel.enabled为false,例如:

node.name: tribe

marvel.enabled: false

tribe:

  t1:

    cluster.name: cluster1

    discovery.zen.ping.unicast.hosts: ["cluster1-node1:9300", "cluster1-node2:9300"]

有了这个配置后,部落节点被包含在监控用户界面中显示的节点数中,但不包含在节点列表中,因为它不将任何数据导出到监视群集中。

下面的示例是在监控所有部落级的数据:

node.name: tribe

marvel.enabled: false

 

tribe:

  t1:

    cluster.name: cluster1

    discovery.zen.ping.unicast.hosts: ["cluster1-node1:9300", "cluster1-node2:9300"]

    marvel:

      enabled: true

      agent.exporters:

        id1:

          type: http

          host: ["monitoringhost:9200"]

当启用部落节点的数据收集时,它包含在节点计数和节点列表中。值得注意的是,部落节点只支持HTTP的输出,部落节点的数据必须发送到外部监控群集上。

赛克蓝德(secisland)后续会逐步对Elasticsearch的最新版本的各项功能进行分析,近请期待。也欢迎加入secisland公众号进行关注。

转载于:https://my.oschina.net/secisland/blog/734885

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值