본문 바로가기
Back Side/etc

prometheus Error: connect ECONNREFUSED 127.0.0.1:9090 fix

by developerBeluga 2024. 1. 9.
728x90
반응형

 

 

 

 

 

문제

MSA 환경에서 A서비스에서 prometheus에 질의를 해야하는 코드를 작성했다.

포스트맨으로 A서비스 API를 실행한 결과 Error: connect ECONNREFUSED 127.0.0.1:9090라는 오류가 나왔다.

 

 

해결

1. prometheus:9090으로 변경하기

await axios.get('http://prometheus:9090/api/v1/query_range', {

 

바로 잘된다.

혹시 안되는 사람은 아래 github 링크를 보고 다른걸 시도해보길 바란다.

https://github.com/grafana/grafana/issues/46434

 

Error reading Prometheus: Post "http://localhost:9090/api/v1/query": dial tcp 127.0.0.1:9090: connect: connection refused · Iss

1.when i use grafana to configure the prometheus, the prometheus service is normal, i can visit the ui from http://localhost:9090,all the targets is up. the error info is : Error reading Prometheus...

github.com

 

 

 

 

 

 

 

 

 

fin.

 

 

 

 

 

728x90
반응형

댓글