elasticsearch_exporter启动报错 failed to fetch and decode node stats

最近把服务器迁移到了ubuntu系统,结果发现在centos还正常运行的elasticsearch_exporter,用systemd启动后一直报错 failed to fetch and decode node stats

在网上翻了大半年,竟然都无解!这种报错,很明显就是你的ES密码中有特殊字符导致的,但问题是如何解决呢?比如ES是密码是abc#

如果elasticsearch_exporter.service 这么写,就报错了

bash 复制代码
[Service]
User=root
Nice=10
ExecStart=/var/kingdee/elasticsearch_exporter/elasticsearch_exporter --es.uri "http://elastic:abc#@1.1.1.1:9200"
ExecStop=/bin/pkill elasticsearch_exporter
Restart=on-failure

想了各种办法,比如加引号,加\,都是徒劳。终于偶然看到这个:

原来是需要用URL加密才行啊!

于是在站长工具,如此即可

于是结果是 abc%23 ,这就完了吗,没有!发现报另外的错误: Failed to resolve unit specifiers in http://XXXXXX: Invalid slot

起因就是%符号,在systemd是有固定涵义的,所以需要转义,不是加\,而是再加一个%

于是,正确的姿势是这样的:

bash 复制代码
[Service]
User=root
Nice=10
ExecStart=/var/kingdee/elasticsearch_exporter/elasticsearch_exporter --es.uri "http://elastic:abc%%23@1.1.1.1:9200"
ExecStop=/bin/pkill elasticsearch_exporter
Restart=on-failure
相关推荐
Cx330❀2 小时前
【LangChain】LangChain 核心技术全景指南:从基础入门到 LCEL 链式编程
大数据·elasticsearch·搜索引擎·性能优化·langchain·全文检索
云间月131417 小时前
Elasticsearch 数据怎么看?部署 Kibana,从索引查询到可视化图表
大数据·elasticsearch·jenkins
Elasticsearch18 小时前
每个搜索团队都需要的三个 SLO:使用 OpenTelemetry 监控搜索延迟、可用性和质量
elasticsearch
OPEN-F1 天前
Python进阶教程:Git版本控制与团队协作
git·python·elasticsearch
玹外之音1 天前
Spring AI + Elasticsearch 向量存储实战:从零构建智能文档检索系统
人工智能·spring·elasticsearch
小闫BI设源码1 天前
Elasticsearch面试必看:如何让客户端精准选择节点高效执行请求?
java·elasticsearch·面试宝典·深入解析
醉颜凉1 天前
Elasticsearch 相关性评分核心解密:tie_breaker 参数作用原理与实战调优全解析
大数据·elasticsearch·jenkins
zhangfeng11332 天前
CANN 社区任务提交 PR 踩坑与修复全记录(GitCode 平台)
大数据·elasticsearch·gitcode
Elasticsearch2 天前
开启终端新体验:全新 Elastic CLI 实用指南(技术预览版)
elasticsearch
Elasticsearch2 天前
Elasticsearch 9.5 跑在 5 年前的老 PC 上,日志硬扫每秒 343 万行
elasticsearch