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`
相关推荐
qq_5470261796 小时前
Canal实时同步MySQL数据到Elasticsearch
数据库·mysql·elasticsearch
星光一影13 小时前
基于SpringBoot智慧社区系统/乡村振兴系统/大数据与人工智能平台
大数据·spring boot·后端·mysql·elasticsearch·vue
梁正雄1 天前
6、prometheus资源规划
运维·服务器·服务发现·prometheus·监控
Elasticsearch1 天前
在 Kibana 中引入 Elasticsearch 查询规则界面
elasticsearch
Elastic 中国社区官方博客1 天前
使用 Mastra 和 Elasticsearch 构建具有语义回忆功能的知识 agent
大数据·数据库·人工智能·elasticsearch·搜索引擎·ai·全文检索
新手小白*1 天前
Elasticsearch+Logstash+Filebeat+Kibana部署【7.1.1版本】
大数据·elasticsearch·搜索引擎
梁正雄2 天前
4、prometheus-服务发现k8s api-2
kubernetes·服务发现·prometheus
lpfasd1232 天前
git-团队协作基础
chrome·git·elasticsearch
苗壮.2 天前
「个人 Gitee 仓库」与「企业 Gitee 仓库」同步的几种常见方式
大数据·elasticsearch·gitee
Elastic 中国社区官方博客2 天前
如何使用 Ollama 在本地设置和运行 GPT-OSS
人工智能·gpt·elasticsearch·搜索引擎·ai·语言模型