问题描述
限时送ChatGPT账号..我编写了一个非常基本的 Spring Boot 2 应用程序,它连接到 Zookeeper 以进行服务发现(通过使用 spring-cloud-starter-zookeeper-discovery
).
I've written a very basic Spring Boot 2 application that connects to Zookeeper for service discovery (by using spring-cloud-starter-zookeeper-discovery
).
应用程序在 /services/example-service
注册,值如下:
The application gets registered at /services/example-service
with the following value:
{"name":"example-service","id":"cb14ad15-4d33-4f1c-a420-29980ddf2fa8","address":"bf3fb9191373","port":8080,"sslPort":null,"payload":{"@class":"org.springframework.cloud.zookeeper.discovery.ZookeeperInstance","id":"application-1","name":"example-service","metadata":{}},"registrationTimeUTC":1524120820273,"serviceType":"DYNAMIC","uriSpec":{"parts":[{"value":"scheme","variable":true},{"value":"://","variable":false},{"value":"address","variable":true},{"value":":","variable":false},{"value":"port","variable":true}]}}
地址是一个 id,因为我已经用 Docker 部署了堆栈.
The address is an id because I've deployed the stack with Docker.
我的 Prometheus 配置如下所示:
My Prometheus configuration looks like this:
- job_name: 'example-service'
metrics_path: '/actuator/prometheus'
serverset_sd_configs:
- servers:
- zookeeper:2181
paths:
- '/services/example-service'
Prometheus 的服务发现页面显示了以下发现的标签:
The service discovery page of Prometheus shows the following discovered labels:
__address__=":0" __meta_serverset_endpoint_host="" __meta_serverset_endpoint_port="0" __meta_serverset_path="/services/example-service/cb14ad15-4d33-4f1c-a420-29980ddf2fa8" __meta_serverset_shard="0" __meta_serverset_status="" __metrics_path__="/actuator/prometheus" __scheme__="http" job="example-service"
知道为什么 __address__
是 :0
吗?
Any idea why __address__
is :0
?
推荐答案
Serverset 发现是一个 使用 Zookeeper 的特定方式,您的应用程序未遵循该方式.在这种情况下,您可能需要 文件服务发现.
Serverset discovery is a particular way of using Zookeeper, which your application is not following. In this case you probably want file service discovery.
这篇关于Prometheus:发现的服务地址是空的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论