Exporters | 安装elasticsearch_exporter

文章目录

一、下载linux版本的elasticsearch_exporter

下载地址:https://github.com/prometheus-community/elasticsearch_exporter

Shell 复制代码
wget https://github.com/prometheus-community/elasticsearch_exporter/releases/download/v1.5.0/elasticsearch_exporter-1.5.0.linux-amd64.tar.gz

二、解压安装包

Shell 复制代码
tar -zxf elasticsearch_exporter-1.5.0.linux-amd64.tar.gz -C /data
mv /data/elasticsearch_exporter-* /data/elasticsearch_exporter
chown -R root.root /data/elasticsearch_exporter

三、创建启动服务文件

Shell 复制代码
vim /usr/lib/systemd/system/elasticsearch_exporter.service
[Unit]
Description=Elasticsearch Exporter
Wants=network-online.target
After=network-online.target


[Service]
User=root
Group=root
Type=simple
ExecStart=/data/es_exporter/elasticsearch_exporter \
          --es.all \
          --es.aliases \
          --es.cluster_settings \
          --es.indices \
          --es.indices_settings \
          --es.shards \
          --es.snapshots \
          --web.listen-address ":9114" \
          --es.ssl-skip-verify \
          --es.uri http://rio:ee012e12340a177f60766d35baa81955d@192.158.134.3:9200 \
          --es.timeout 20s \
          --es.clusterinfo.interval 5m
Restart=on-failure


[Install]
WantedBy=multi-user.target

四、启动服务

Shell 复制代码
systemctl daemon-reload
systemctl enable --now elasticsearch_exporter
systemctl status elasticsearch_exporter

五、查看端口和服务

ss -nltp|grep 9114

六、prometheus-server配置

prometheus.yml配置

Shell 复制代码
scrape_configs:
  - job_name: 'elasticsearch-exporter'
    file_sd_configs:
    - files:
      - targets/elasticsearch*.yaml
      refresh_interval: 2m
    relabel_configs:
      - source_labels: [ '__address__' ]
        target_label: 'instance'
        regex: "(.*):.*"
        replacement: $1

elasticsearch_exporter.yaml

Shell 复制代码
[root@test targets]# cat elasticsearch_exporter.yaml
- targets:
  - 192.158.134.8:9114
  - 192.158.134.9:9114
  - 192.158.134.11:9114
  labels:
    app: "elasticsearch-server"
    job: "elasticsearch-server"

七、动态重启配置文件

Shell 复制代码
kill -HUP `pgrep prometheus`
相关推荐
Elasticsearch2 小时前
Elastic 社区通讯 — 2026 年 8 月
elasticsearch
lsh曙光3 小时前
ES数据备份与恢复
大数据·elasticsearch·搜索引擎
Shawn Dev6 小时前
MySQL Binlog 数据误删除恢复完全指南
数据库·mysql·elasticsearch
Elastic 中国社区官方博客8 小时前
用两行 JSON 替换你的 ILM 策略:数据流生命周期新增冻结层支持
大数据·运维·elasticsearch·搜索引擎·架构·全文检索
小张同学a.8 小时前
ELK企业级日志分析平台3——ES数据备份 & 集群监控 & ELFK+Kafka 架构部署
linux·运维·elk·elasticsearch·架构·kafka·filebeat
lsh曙光1 天前
ELK日志平台--elasticsearch部署
elasticsearch
Elasticsearch1 天前
训练量仅占 0.35%,竞争力却达到 100%:jina-embeddings-v5-omni 背后的冻结塔架构
elasticsearch
扶苏10021 天前
同一个 Git 项目整出两份,切分支互不影响?两种方案实测
大数据·git·elasticsearch
Elasticsearch1 天前
用两行 JSON 替换你的 ILM 策略:数据流生命周期新增冻结层支持
elasticsearch
江南风月2 天前
如何使用WGCLOUD实现智能运维
运维·zabbix·运维开发·prometheus