国产探花免费观看_亚洲丰满少妇自慰呻吟_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教程頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 磴口县| 永春县| 馆陶县| 洱源县| 扶余县| 晴隆县| 遵义县| 象山县| 朝阳区| 周口市| 贵港市| 洛浦县| 喀喇沁旗| 佳木斯市| 黄骅市| 宝坻区| 邢台市| 新乡市| 辉南县| 阜康市| 永善县| 玉田县| 招远市| 南投市| 南安市| 共和县| 永宁县| 清水河县| 临猗县| 临高县| 响水县| 漳州市| 平昌县| 普兰店市| 伽师县| 左权县| 达孜县| 鹤壁市| 龙井市| 交口县| 四川省|