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
相关推荐
Linux_Nathan14 小时前
【服务部署】ELFK架构篇之Elasticsearch
elk·elasticsearch·架构
TinpeaV14 小时前
Elasticsearch8(ES)保姆级菜鸟入门教程
大数据·spring boot·elasticsearch·搜索引擎·全文检索·postman
java_logo16 小时前
MILVUS Docker 容器化部署指南
运维·人工智能·docker·容器·prometheus·milvus
好好研究19 小时前
Git命令
大数据·git·elasticsearch
Elastic 中国社区官方博客20 小时前
使用 LangGraph.js 和 Elasticsearch 构建一个金融 AI 搜索工作流
大数据·人工智能·elasticsearch·搜索引擎·ai·金融·全文检索
W如Q扬20 小时前
filebeat使用dissect替换默认的的timestamp以及多行处理
elasticsearch·efk·filebeat
W如Q扬20 小时前
filebeat日志时区问题处理
elasticsearch·efk·filebeat
武子康20 小时前
大数据-176 Elasticsearch Filter DSL 全面实战:过滤查询、排序分页、高亮与批量操作
大数据·后端·elasticsearch
想个名字太难1 天前
ElasticSearch编程操作
java·elasticsearch·全文检索
ganshenml1 天前
【GIT】Git 本地无法识别远程分支的原因与解决方法 not a valid ref
大数据·git·elasticsearch