Metricbeat安装教程——Linux——Metricbeat监控ES集群

Metricbeat安装教程------Linux

一、安装

下载安装包:

官网下载地址:https://www.elastic.co/cn/downloads/beats/metricbeat

上传包到linux 切换到安装目录下

解压:tar -zxvf metricbeat-7.17.1-linux-x86_64.tar.gz

重命名安装文件夹 mv metricbeat-7.17.1-linux-x86_64 metricbeat

cd xxxx(metricbeat安装目录)/metricbeat
二、配置文件修改

注意:冒号后面有个空格,否则会导致配置文件格式错误,启动时报错

1、elasticsearch.yml

设置被监控的ES集群处于可监控状态

powershell 复制代码
PUT _cluster/settings
{
  "persistent": {
    "xpack.monitoring.collection.enabled": true
  }
}

且禁用生产集群默认的 Elasticsearch 指标监控

powershell 复制代码
PUT _cluster/settings
{
  "persistent": {
    "xpack.monitoring.elasticsearch.collection.enabled": false
  }
}

修改后检查结果

powershell 复制代码
GET _cluster/settings

2、

查看已启动模块

powershell 复制代码
./metricbeat modules list

若system 模块已被启动,禁用该模块

powershell 复制代码
./metricbeat modules disable system

启动 elasticsearch-xpack 模块

powershell 复制代码
./metricbeat modules enable elasticsearch-xpack

查看上述配置是否修改成功

powershell 复制代码
./metricbeat modules list

3、elasticsearch-xpack.yml

配置需要监控的ES集群IP:xx.xx.xx.01

powershell 复制代码
cd xxxx(metricbeat安装目录)/metricbeat
cd modules.d
vi elasticsearch-xpack.yml
powershell 复制代码
#设置需要监控的ES集群IP:xx.xx.xx.01
- module: elasticsearch
  xpack.enabled: true
  period: 10s   #采集监控数据的间隔时间
  hosts: ["http://xx.xx.xx.01:9200"]  #被监控的ES节点IP
  username: "elastic"  #对应的ES用户名
  password: "xxxxxx"   #对应的ES密码

4、metricbeat.yml

配置监控数据需要输出到的ES集群IP:xx.xx.xx.02

powershell 复制代码
cd xxxx(metricbeat安装目录)/metricbeat
vi metricbeat.yml
powershell 复制代码
#-------------------------- Elasticsearch output ------------------------------
output.elasticsearch:
  # Array of hosts to connect to.
  hosts: ["xx.xx.xx.02:9200"] #监控数据输出到的ES集群IP
 
  # Protocol - either `http` (default) or `https`.
  #protocol: "https"
 
  # Authentication credentials - either API key or username/password.
  #api_key: "id:api_key"
  username: "elastic"       #对应输出的ES集群的用户名
  password: "xxxxxx"        #对应输出的ES集群的密码

三:启动Metricbeat

1、控制台启动服务

powershell 复制代码
cd xxxx(metricbeat安装目录)/metricbeat
./metricbeat -e

2、后台启动

powershell 复制代码
cd xxxx(metricbeat安装目录)/metricbeat
nohup ./metricbeat & >/dev/null 2>&1

四、判断是否启动成功

1、检查metricbeat进程

powershell 复制代码
ps -ef|grep metricbeat

2、查看kibana

菜单栏拉到最后倒数第二行:Stack Monitoring

点进去,会看到OverView Nodes(显示被监控ES集群的节点数) Indices (显示被监控ES集群的索引数)

点进OverView可总览集群信息,点进Nodes,在Advanced中可查看详细信息
五、停止metricbeat

1、若后台启动,找到对应进程号,直接杀进程即可

powershell 复制代码
ps -ef|grep metricbeat
kill -9 进程号

2、若控制台启动,直接ctrl+c

参考:https://blog.csdn.net/UbuntuTouch/article/details/105134860

相关推荐
likfishdn16 分钟前
Linux的文件与目录管理
linux·运维·服务器
chian-ocean36 分钟前
Linux 文件缓冲区:高效数据访问的幕后推手
linux·运维·服务器
加油=^_^=38 分钟前
【Linux】进程优先级 | 进程调度(三)
linux·运维·服务器
吃汤圆的抹香鲸1 小时前
GoLand 安装包 绿色版 Win,Mac,Linux 包含IntelliJ全家桶 专为Go语言设计的集成开发环境(IDE)
linux·windows·macos·go·intellij-idea·go1.19
追寻光1 小时前
Cannot find a valid baseurl for repo: base/7/x86_64
linux
元气满满的热码式1 小时前
Docker数据卷操作实战
linux·运维·docker·云原生·容器
kngines1 小时前
【实战 ES】实战 Elasticsearch:快速上手与深度实践-1.3.1单节点安装(Docker与手动部署)
大数据·elasticsearch·docker
陆沙1 小时前
deepseek-r1-centos-本地服务器配置方法
linux·服务器·centos
吃汤圆的抹香鲸2 小时前
Rider 安装包 绿色版 Win/Mac/Linux 适合.NET和游戏开发者使用 2025全栈开发终极指南:从零配置到企业级实战
linux·运维·windows·sql·游戏·macos·.net
sz66cm2 小时前
Linux基础 -- ARM 32 位架构动态注入代码技术文档
linux·arm开发·架构