增加了sentinel-prometheus相关依赖,但是9092端口无法被监听,配置设置csp.sentinel.prometheus.fetch.port=9093也无效
按照文档,在我的spring boot项目中增加3个依赖
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-prometheus-metric-exporter</artifactId>
<version>1.8.7</version>
</dependency>
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient</artifactId>
<version>0.3.0</version>
</dependency>
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_httpserver</artifactId>
<version>0.3.0</version>
</dependency>
因为一个服务器下面会运行多个spring boot项目,且每个项目都需要暴露sentinel监控数据给 prometheus,于是涉及端口占用问题,需要自定义端口 bootstrap.yml增加自定义端口,这个端口不会被监听,还是会使用9092启动,于是只有第一个启动的应用可以暴露数据
csp:
sentinel:
prometheus:
fetch:
port: 9093
csp.sentinel.prometheus.fetch.port 这个配置应该如何配置呢?请教
按照文档,在我的spring boot项目中增加3个依赖
<dependency> <groupId>com.alibaba.csp</groupId> <artifactId>sentinel-prometheus-metric-exporter</artifactId> <version>1.8.7</version> </dependency> <dependency> <groupId>io.prometheus</groupId> <artifactId>simpleclient</artifactId> <version>0.3.0</version> </dependency> <dependency> <groupId>io.prometheus</groupId> <artifactId>simpleclient_httpserver</artifactId> <version>0.3.0</version> </dependency>因为一个服务器下面会运行多个spring boot项目,且每个项目都需要暴露sentinel监控数据给 prometheus,于是涉及端口占用问题,需要自定义端口 bootstrap.yml增加自定义端口,这个端口不会被监听,还是会使用9092启动,于是只有第一个启动的应用可以暴露数据
csp: sentinel: prometheus: fetch: port: 9093csp.sentinel.prometheus.fetch.port 这个配置应该如何配置呢?请教
已解决,看了源代码https://github.com/alibaba/Sentinel/blob/1.8/sentinel-core/src/main/java/com/alibaba/csp/sentinel/config/SentinelConfigLoader.java#L82,原来需要单独写在下面这个配置文件当中: private static final String DEFAULT_SENTINEL_CONFIG_FILE = "classpath:sentinel.properties";