温馨提示×

centos中filebeat如何卸载

小樊
38
2026-09-06 01:59:28
栏目: 智能运维

在 CentOS 中卸载 Filebeat,一般取决于你最初是用 RPM 包 还是 二进制/TAR 包 安装的。下面分别说明。


一、如果是通过 RPM / YUM 安装的(最常见)

1. 停止 Filebeat 服务

systemctl stop filebeat
systemctl disable filebeat

2. 卸载 Filebeat

yum remove filebeat -y

或使用 rpm

rpm -e filebeat

3. 删除残留文件和目录

rm -rf /etc/filebeat
rm -rf /var/lib/filebeat
rm -rf /var/log/filebeat

二、如果是通过 TAR 包 / 二进制安装的

1. 停止 Filebeat

如果是手动启动的:

ps -ef | grep filebeat
kill -9 <pid>

如果配置了 systemd(非 RPM):

systemctl stop filebeat
systemctl disable filebeat
rm -f /etc/systemd/system/filebeat.service
systemctl daemon-reload

2. 删除安装目录

假设安装在 /opt/filebeat

rm -rf /opt/filebeat

3. 删除配置和数据

rm -rf /etc/filebeat
rm -rf /var/lib/filebeat
rm -rf /var/log/filebeat

三、验证是否已卸载

which filebeat
filebeat version
rpm -qa | grep filebeat

若无输出,说明已卸载干净。


如果你不确定是哪种安装方式,可以发我以下命令的输出,我帮你判断:

rpm -qa | grep filebeat
which filebeat
ls -l /etc/filebeat

0