从边缘主机卸载 Elastic Agent
要卸载 Elastic Agent,请在 Elastic Agent 运行所在的目录中运行 uninstall
命令。
务必在 Elastic Agent 安装目录之外的目录中运行 uninstall
命令。
例如,在 Windows 系统上,安装位置是 C:\Program Files\Elastic\Agent
。请在 C:\Program Files\Elastic
或 \tmp
,甚至在您的默认主目录中运行 uninstall 命令
C:\"Program Files"\Elastic\Agent\elastic-agent.exe uninstall
您必须以 root 用户身份运行此命令。
sudo /Library/Elastic/Agent/elastic-agent uninstall
您必须以 root 用户身份运行此命令。
sudo /opt/Elastic/Agent/elastic-agent uninstall
以管理员身份打开 PowerShell 提示符(右键单击 PowerShell 图标并选择 以管理员身份运行)。
在 PowerShell 提示符下,运行
C:\"Program Files"\Elastic\Agent\elastic-agent.exe uninstall
按照提示确认您要卸载 Elastic Agent。该命令会在停止并卸载 Elastic Agent 之前,停止并卸载所有受管程序,例如 Beats 和 Elastic Endpoint。
如果您遇到问题,请参阅 常见问题排查。
如果您使用的是 DEB 或 RPM,可以使用包管理器来删除已安装的包。
对于已加入 Elastic Defend 集成并启用了 Agent 防篡改保护的主机,您需要在命令中包含 uninstall token,使用 --uninstall-token
标志。有关更多信息,请参阅 阻止卸载 Elastic Agent。
如果在安装过程中出现故障,您可能需要手动删除 Elastic Agent 文件。
要从您的系统中手动删除 Elastic Agent
如果 agent 由 Fleet 管理,请取消注册 agent。
对于独立 agent,请备份您想要保留的任何配置文件。
在您的主机上,停止 agent。如果任何 Elastic Agent 相关进程仍在运行,也请停止它们。
提示搜索这些进程,如果它们仍在运行则停止:
filebeat
、metricbeat
、fleet-server
和elastic-endpoint
。从您的系统中手动删除 Elastic Agent 文件。例如,如果您在 macOS 上运行 Elastic Agent,请删除
/Library/Elastic/Agent/*
。不确定文件安装在哪里?请参阅安装布局。如果您配置了 Elastic Defend 集成,请同时删除为 endpoint protection 安装的文件。目录结构类似于 Elastic Agent,例如
/Library/Elastic/Endpoint/*
。注意当您从 macOS 主机(10.13、10.14 或 10.15)中移除 Elastic Defend 集成时,Endpoint System Extension 会有意地保留在磁盘上。如果您想移除该扩展,请参阅您操作系统的文档。