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%%[email protected]:9200"
ExecStop=/bin/pkill elasticsearch_exporter
Restart=on-failure
相关推荐
黑眼圈的小熊猫6 小时前
Git开发
大数据·git·elasticsearch
小宋10219 小时前
Linux安装Elasticsearch详细教程
大数据·elasticsearch·搜索引擎
Elasticsearch9 小时前
Elasticsearch:用向量找到你最合拍的音乐好友 - Spotify Wrapped,第五部分
elasticsearch
Elastic 中国社区官方博客12 小时前
Elasticsearch:加快 HNSW 图的合并速度
大数据·数据库·人工智能·elasticsearch·搜索引擎·ai·全文检索
gqkmiss16 小时前
Git 常用命令集与实际使用 Demo
大数据·git·elasticsearch·git 命令·git 命令大全
听说唐僧不吃肉18 小时前
Prometheus实现负载均衡并将多个实例数据汇总到一个主Prometheus
负载均衡·prometheus
Elastic 中国社区官方博客19 小时前
Elasticsearch 向量数据库,原生支持 Google Cloud Vertex AI 平台
大数据·数据库·人工智能·elasticsearch·搜索引擎·语言模型·自然语言处理
敏君宝爸21 小时前
SpringBoot2.x整合Prometheus+Grafana以及自定义采集
spring boot·grafana·prometheus
老友@1 天前
Elasticsearch 全面解析
大数据·elasticsearch·搜索引擎
惜鸟1 天前
Elasticsearch文档标签检索方案设计
后端·elasticsearch