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
相关推荐
2301_781668611 小时前
Elasticsearch 02
大数据·elasticsearch·搜索引擎
赵孝正7 小时前
GitLab 分支管理与 Push 问题全解析
大数据·elasticsearch·gitlab
一刀到底2118 小时前
springboot3.3.5 集成elasticsearch8.12.2 ssl 通过 SSL bundle name 来实现
网络·elasticsearch·ssl·springboot3
Elasticsearch8 小时前
Elasticsearch:智能搜索的 MCP
elasticsearch
g66x13 小时前
自建prometheus监控腾讯云k8s集群
kubernetes·腾讯云·prometheus
苦逼IT运维1 天前
Jenkins 监控方案:Prometheus + Grafana 实践
jenkins·grafana·prometheus
AAA修煤气灶刘哥1 天前
ES 地理查询玩明白,产品要的 “附近的店” 再也难不倒我!(附 DSL+Java 实战)
java·后端·elasticsearch
AAA修煤气灶刘哥1 天前
ES 聚合爽到飞起!从分桶到 Java 实操,再也不用翻烂文档
后端·elasticsearch·面试
Elasticsearch1 天前
Elastic Observability 中 Discover 的跟踪,用于深入的应用洞察
elasticsearch
Elasticsearch1 天前
使用 cloud-native Elasticsearch 与 ECK 运行
elasticsearch