2017-06-29 45 views
1

我想對使用consul註冊爲外部服務的服務運行HTTP檢查。到目前爲止,檢查已獲得註冊,但從未被調用。 我錯過了什麼。在外部服務使用方上啓用HTTP檢查

{ 
"Datacenter": "dc1", 
"Node": "new", 
"Address": .google.com", 
"Service": { 
    "ID":"re", 
    "Service": "search2", 
    "Port": 80 
}, 
"Check":{ 
     "Node":"new", 
     "CheckID":"Test", 
     "HTTP":"http://www.google", 
     "ServiceID":"re" 
} 
} 

回答

0

您必須指定Interval檢查服務health.You可以如下做到這一點:

對於TCP端口檢查:

{ 
"check": { 
"id": "http", 
"name": "http TCP on port 80", 
"tcp": "localhost:80", 
"interval": "10s", 
"timeout": "1s" 
} 
} 

對於HTTP API檢查:

{ 
"check": { 
"id": "api", 
"name": "HTTP API on port 5000", 
"http": "https://localhost:5000/health", 
"tls_skip_verify": false, 
"method": "POST", 
"header": {"x-foo":["bar", "baz"]}, 
"interval": "10s", 
"timeout": "1s" 
} 
} 
+0

此方法適用於在本地節點上運行的服務,但不適用於外部服務。 –

+0

hi @deepak:我是運行領事的Windows平臺。我試過了你發佈的類似配置。但健康檢查從未註冊。任何想法?我的整個配置是在這裏:{ 「服務」:{ 「ID」: 「somename」, \t 「名」: 「nameofthissevice」, 「服務」: 「爲MyService」, 「地址」:「127.0.0.1 「 」端口「:62133, 」enableTagOverride「:假的, \t 」檢查「:{ 」ID「: 」somename「, 」名「: 」nameofthissevice「, 」HTTP「:」 HTTP:/ /127.0.0.1:62133/Service1.svc/MyService/PingMe」, 「tls_skip_verify」:假, 「方法」: 「GET」, 「間隔」: 「10秒」, 「超時」: 「1」 } } } – NANDAKUMAR