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
相关推荐
lpfasd1231 小时前
git-团队协作基础
chrome·git·elasticsearch
苗壮.6 小时前
「个人 Gitee 仓库」与「企业 Gitee 仓库」同步的几种常见方式
大数据·elasticsearch·gitee
Elastic 中国社区官方博客8 小时前
如何使用 Ollama 在本地设置和运行 GPT-OSS
人工智能·gpt·elasticsearch·搜索引擎·ai·语言模型
Elasticsearch10 小时前
Elastic Streams 中的数据协调:稳健架构深度解析
elasticsearch
Elasticsearch10 小时前
使用 Instrumentation Score 和 Elastic 的 OpenTelemetry 数据质量洞察
elasticsearch
青鱼入云12 小时前
ES索引配置字段解读
大数据·elasticsearch·搜索引擎
小牛马爱写博客12 小时前
ELK 企业级日志分析系统部署与实践
elk·elasticsearch·kibana·logstash
玥轩_52114 小时前
Git命令速查手册
大数据·git·elasticsearch·gitee·github·命令速查
Ribou15 小时前
Elasticsearch 9.2.0 三节点集群配置
大数据·elasticsearch·搜索引擎
Saintsafa15 小时前
centos安装ES
elasticsearch·centos