启动Prometheus报错main process exited, code=exited, status=2/INVALIDARGUMENT

文章讲述了在遇到Prometheus服务因目录权限不足引发的错误时,如何通过查看日志定位问题并使用`sudochown`和`sudochmod`命令调整权限,确保查询文件的可访问性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

碰到这个异常主要是因为目录权限不足导致,可通过以下命令查看日志:

sudo journalctl -n 50 -u prometheus

其中参数prometheus为prometheus 的服务启动名称如:/etc/systemd/system/prometheus.service

得到详细日志信息:

l=error component=activeQueryTracker msg="Error opening query log file" file=/data/prometheus/queries.active err="open /data/prometheus/queries.active: permission denied"

说明prometheus用户在/data/prometheus目录权限不足,为该权限赋予足够权限:

sudo chown 755 /data/prometheus

sudo chown 755 /data/prometheus/queries.active

sudo chmod 755 /data/prometheus/queries.active

sudo chown 755 prometheus:prometheus /data/prometheus

sudo chown 755 prometheus:prometheus /data/prometheus/queries.active

如果该目录已经存在queries.active,要先删除再次尝试启动Prometheus服务

thanos报错,报的Endpoint url cannot have fully qualified paths.\ninitialize s3 client\ngithub.com/thanos-io/objstore/providers/s3.NewBucketWithConfig\n\t/go/pkg/mod/github.com/thanos-io/objstore@v0.0.0-20241111205755-d1dd89d41f97/providers/s3/s3.go:270\ngithub.com/thanos-io/objstore/providers/s3.NewBucket\n\t/go/pkg/mod/github.com/thanos-io/objstore@v0.0.0-20241111205755-d1dd89d41f97/providers/s3/s3.go:186\ngithub.com/thanos-io/objstore/client.NewBucket\n\t/go/pkg/mod/github.com/thanos-io/objstore@v0.0.0-20241111205755-d1dd89d41f97/client/factory.go:70\nmain.runReceive\n\t/app/cmd/thanos/receive.go:196\nmain.registerReceive.func1\n\t/app/cmd/thanos/receive.go:107\nmain.main\n\t/app/cmd/thanos/main.go:143\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:272\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1700\ncreate s3 client\ngithub.com/thanos-io/objstore/client.NewBucket\n\t/go/pkg/mod/github.com/thanos-io/objstore@v0.0.0-20241111205755-d1dd89d41f97/client/factory.go:91\nmain.runReceive\n\t/app/cmd/thanos/receive.go:196\nmain.registerReceive.func1\n\t/app/cmd/thanos/receive.go:107\nmain.main\n\t/app/cmd/thanos/main.go:143\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:272\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1700\npreparing receive command failed\nmain.main\n\t/app/cmd/thanos/main.go:145\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:272\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1700" 3月 11 10:20:04 localhost.localdomain systemd[1]: thanos-receive.service: Main process exited, code=exited, status=1/FAILURE,怎么解决
03-12
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值