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❀1 小时前
从零实现Shell命令行解释器:原理与实战(附源码)
大数据·linux·数据库·人工智能·科技·elasticsearch·搜索引擎
岱宗夫up1 小时前
.env 文件是干啥的?为什么不能提交到 Git?
大数据·git·elasticsearch·搜索引擎·gitee·github·gitcode
星辰_mya17 小时前
Elasticsearch——待补充
大数据·elasticsearch·搜索引擎
Elastic 中国社区官方博客17 小时前
Elasticsearch:使用 Elastic Workflows 构建自动化
大数据·数据库·人工智能·elasticsearch·搜索引擎·自动化·全文检索
Elastic 中国社区官方博客18 小时前
Elastic 9.3:与数据对话、构建自定义 AI agents、实现全自动化
大数据·人工智能·elasticsearch·搜索引擎·ai·自动化·全文检索
会员源码网21 小时前
交易所 K 线模块无法启动?核心源码排查位置与实战解决方案
网络·elasticsearch
Elastic 中国社区官方博客21 小时前
Jina Rerankers 为 Elastic 推理服务(EIS)带来了快速、多语言的重排序能力
大数据·人工智能·elasticsearch·搜索引擎·ai·全文检索·jina
Fanxt_Ja21 小时前
多线程之ES同步数据
java·大数据·elasticsearch·搜索引擎
历程里程碑1 天前
Linux19 实现shell基本功能
linux·运维·服务器·算法·elasticsearch·搜索引擎·哈希算法
yqd6662 天前
elasticsearch
大数据·elasticsearch·搜索引擎