国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > Java > 正文

spring cloud consul注冊的服務報錯critical的解決

2024-07-14 08:43:31
字體:
來源:轉載
供稿:網友

測試spring cloud 使用consul注冊服務的時候,出現critical,如下:

spring,cloud,consul,服務報錯,critical

怎么解決這個問題,現在只能看到health check檢查失敗了。

受限調用這個請求Get http://consulIp:8500/v1/agent/checks,調完請求,就會拿到返回數據:

{  ......  "service:test-service-xx-xx-xx-xx": {    "Node": "zookeeper-server1",    "CheckID": "service:test-service-xx-xx-xx-xx",    "Name": "Service 'test-service' check",    "Status": "critical",    "Notes": "",    "Output": "HTTP GET http://xxx.xx.xxx.xxx:19008/actuator/health: 404 Output: <html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Fri Mar 15 11:03:30 CST 2019</div><div>There was an unexpected error (type=Not Found, status=404).</div><div>No message available</div></body></html>",    "ServiceID": "test-service-xx-xx-xx-xx",    "ServiceName": "test-service",    "ServiceTags": [      "version=1.0",      "secure=false"    ],    "Definition": {},    "CreateIndex": 0,    "ModifyIndex": 0  }    ........}

就能看到consul調用http://xxx.xx.xxx.xxx:19008/actuator/health來檢查servoce健康,卻發現接口404,所以才會在頁面出現錯誤。

我的測試環境是:

  • spring cloud Finch1ey.SR2
  • consul v1.4.3

bootstrap.yml配置是:

spring: cloud:  consul:   host: xxx.xxx.xxx.xxx   port: 8500   discovery:    prefer-ip-address: true    tags: version=1.0    instance-id: ${spring.application.name}:${spring.cloud.client.ip-address}    healthCheckInterval: 15s    health-check-url: http://${spring.cloud.client.ip-address}:${server.port}/actuator/health

顯然consul不能在這個服務上找到actuator/health接口,因為我用了actuator,所以service中應該配置了spring cloud actuator。

經過檢查發現沒有配置,所以actuator這個端點不能使用,加上這個包,問題就解決了。

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持VeVb武林網。


注:相關教程知識閱讀請移步到JAVA教程頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 广东省| 南乐县| 巴彦淖尔市| 邛崃市| 灵丘县| 揭西县| 扎赉特旗| 南江县| 黔东| 龙游县| 上高县| 枣庄市| 澄江县| 延安市| 兴仁县| 文山县| 罗山县| 长兴县| 乌拉特中旗| 萍乡市| 石河子市| 客服| 驻马店市| 准格尔旗| 中宁县| 安溪县| 西充县| 南宁市| 南岸区| 崇左市| 洛宁县| 淅川县| 庐江县| 新乡市| 广昌县| 申扎县| 台中市| 东乌| 绥芬河市| 南汇区| 沙雅县|