缺少文件
下载地址 github.com/prometheus/… 下载版本 prometheus-2.48.0-rc.2.windows-amd64 下载之后,在根目录下cmd命令行后,执行prometheus.exe --config.file=prometheus.yml 出现如下错误
Microsoft Windows [版本 10.0.19045.3693]
(c) Microsoft Corporation。保留所有权利。
D:\tools\prometheus-2.48.0-rc.2.windows-amd64>prometheus.exe --config.file=prometheus.yml
ts=2023-11-22T15:37:35.355Z caller=main.go:539 level=info msg="No time or size retention was set so using the default time retention" duration=15d
ts=2023-11-22T15:37:35.355Z caller=main.go:583 level=info msg="Starting Prometheus Server" mode=server version="(version=2.48.0-rc.2, branch=HEAD, revision=6e2586b1c74158be78034a52e080c70337700a62)"
ts=2023-11-22T15:37:35.356Z caller=main.go:588 level=info build_context="(go=go1.21.3, platform=windows/amd64, user=root@9d4d1836b1a6, date=20231103-01:59:20, tags=builtinassets,stringlabels)"
ts=2023-11-22T15:37:35.356Z caller=main.go:589 level=info host_details=(windows)
ts=2023-11-22T15:37:35.356Z caller=main.go:590 level=info fd_limits=N/A
ts=2023-11-22T15:37:35.356Z caller=main.go:591 level=info vm_limits=N/A
ts=2023-11-22T15:37:35.359Z caller=query_logger.go:115 level=error component=activeQueryTracker msg="Failed to create directory for logging active queries"
ts=2023-11-22T15:37:35.360Z caller=query_logger.go:93 level=error component=activeQueryTracker msg="
Error opening query log file" file=D:\tools\prometheus-2.48.0-rc.2.windows-amd64\data\queries.active err="open data\\queries.active: The system cannot find the path specified."
panic: Unable to create mmap-ed active query log
goroutine 1 [running]:
github.com/prometheus/prometheus/promql.NewActiveQueryTracker({0x33f24cc, 0x5}, 0x14, {0x3d1c320, 0xc0006912c0})
/app/promql/query_logger.go:123 +0x411
main.main()
/app/cmd/prometheus/main.go:645 +0x77b2
原因是prometheus根目录下缺少data文件夹以及queries.active文件
解决方案
在项目根目录下添加data文件夹,文件夹里面添加queries.active文件
无法访问
D:\tools\prometheus-2.48.0-rc.2.windows-amd64>prometheus.exe --config.file=prometheus.yml
ts=2023-11-22T15:43:26.932Z caller=main.go:539 level=info msg="No time or size retention was set so using the default time retention" duration=15d
ts=2023-11-22T15:43:26.933Z caller=main.go:583 level=info msg="Starting Prometheus Server" mode=server version="(version=2.48.0-rc.2, branch=HEAD, revision=6e2586b1c74158be78034a52e080c70337700a62)"
ts=2023-11-22T15:43:26.933Z caller=main.go:588 level=info build_context="(go=go1.21.3, platform=windows/amd64, user=root@9d4d1836b1a6, date=20231103-01:59:20, tags=builtinassets,stringlabels)"
ts=2023-11-22T15:43:26.933Z caller=main.go:589 level=info host_details=(windows)
ts=2023-11-22T15:43:26.933Z caller=main.go:590 level=info fd_limits=N/A
ts=2023-11-22T15:43:26.933Z caller=main.go:591 level=info vm_limits=N/A
ts=2023-11-22T15:43:26.934Z caller=query_logger.go:74 level=error component=activeQueryTracker msg="Failed to read query log file" err=EOF
ts=2023-11-22T15:43:26.934Z caller=query_logger.go:93 level=error component=activeQueryTracker msg="
Error opening query log file" file=D:\tools\prometheus-2.48.0-rc.2.windows-amd64\data\queries.active
err="open data\\queries.active: Access is denied."
panic: Unable to create mmap-ed active query log
goroutine 1 [running]:
github.com/prometheus/prometheus/promql.NewActiveQueryTracker({0x33f24cc, 0x5}, 0x14, {0x3d1c320, 0xc000629360})
/app/promql/query_logger.go:123 +0x411
main.main()
/app/cmd/prometheus/main.go:645 +0x77b2
原因是执行命令的时候,项目根目录下的data文件夹下的queries.active文件没有访问权限
解决方案
window下给用户授权