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
相关推荐
武子康11 小时前
大数据-184 Elasticsearch Doc Values 机制详解:列式存储如何支撑排序/聚合/脚本
大数据·后端·elasticsearch
周杰伦_Jay14 小时前
【Elasticsearch】核心概念,倒排索引,数据操纵
大数据·elasticsearch·搜索引擎
cai_cai014 小时前
springAlibaba + ollama + es 完成RAG知识库功能
大数据·elasticsearch·搜索引擎
库库茯苓14 小时前
Kibana报错:Unable to retrieve version information from Elasticsearch nodes (解决方法)Window11环境
elasticsearch·kibana
nhdh14 小时前
ELK(elasticsearch-7.6.2,kibana-7-6-2,Logstash-7.6.2)单节点部署
大数据·elk·elasticsearch
新元代码15 小时前
Git在Windows环境下的安装与使用教程
大数据·elasticsearch·搜索引擎
小园子的小菜15 小时前
深入理解Elasticsearch内部线程池:类型与核心作用解析
大数据·elasticsearch·搜索引擎
ZePingPingZe19 小时前
SpringBoot整合Sharding-jdbc分库分表及ES搜索引擎解决无分片键查询
spring boot·elasticsearch·搜索引擎
Mr.wangh19 小时前
SpringCloudConfig(配置中心)
大数据·elasticsearch·搜索引擎·springcloud·config
小园子的小菜20 小时前
深度解析Elasticsearch网络通信原理:节点协同与链接机制
大数据·elasticsearch·搜索引擎