【Mac】mac 安装 prometheus 报错 prometheus: prometheus: cannot execute binary file


在这里插入图片描述

1.概述

1.下载

官网:https://prometheus.io/download/

github : https://github.com/prometheus/prometheus/releases/tag/v2.17.1

这里下载prometheus-2.17.1.linux-amd64.tar.gz版本的。

2.解压

(base) lcc@lcc prometheus-2.17.1.linux-amd64$ pwd
/Users/lcc/soft/prometheus/prometheus-2.17.1.linux-amd64
(base) lcc@lcc prometheus-2.17.1.linux-amd64$ ll
total 285808
drwxr-xr-x@ 10 lcc  staff       320  3 27 02:24 ./
drwxr-xr-x   5 lcc  staff       160  5 11 16:16 ../
-rw-r--r--@  1 lcc  staff     11357  3 27 02:22 LICENSE
-rw-r--r--@  1 lcc  staff      3184  3 27 02:22 NOTICE
drwxr-xr-x@  4 lcc  staff       128  3 27 02:22 console_libraries/
drwxr-xr-x@  9 lcc  staff       288  3 27 02:22 consoles/
-rwxr-xr-x@  1 lcc  staff  84338005  3 27 00:20 prometheus*
-rw-r--r--@  1 lcc  staff       926  3 27 02:22 prometheus.yml
-rwxr-xr-x@  1 lcc  staff  48235996  3 27 00:22 promtool*
-rwxr-xr-x@  1 lcc  staff  13732141  3 27 00:22 tsdb*
(base) lcc@lcc prometheus-2.17.1.linux-amd64$

prometheus.yml配置文件的内容可以看出,该配置文件就是让prometheus监控自己
关于配置文件的详细说明请参考prometheus configuration

3.启动

启动prometheus服务

(base) lcc@lcc prometheus-2.17.1.linux-amd64$ ./prometheus --config.file="prometheus.yml"
-bash: ./prometheus: cannot execute binary file

4.解惑

linux系统下遇到cannot execute binary file的问题,一般由以下情况造成:

非root用户或者无执行权限
编译环境不同(程序由其他操作环境复制过来)

对于第一种情况,采用增加执行权限即可chmod +x program

对于第二种情况,建议将该程序二进制包拷贝过来,重新编译程序。因为我在实际操作过程中发现我将美国的VPS的整个操作系统环境打包后下载到本地服务器上解压后运行其中的程序会有如题所示问题出现,百思不得其解,系统都为centos5.2,最终发现是两者编译环境不同所致:

美国VPS是AMD64位处理器
本地服务器是INTEL64位处理器

这两者的硬件编译环境有所差别,导致了这个问题。当然,下载的某些程序非二进制包,可以直接执行的,但却出现该问题,也是因为内核匹配不了CPU,intel是x86的,amd是amd64或是32位版本

重新下载版本:prometheus-2.17.1.darwin-amd64 这样的版本就好了。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

九师兄

你的鼓励是我做大写作的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值