Closed jsoladur closed 6 years ago
Interesting idea and I see the benefit of this. Going to work on the Consul part first.
Been playing and testing with it. Upon registration, I queried Consul for it's services:
{
"mock-1": {
"Kind": "",
"ID": "mock-1",
"Service": "mock-service",
"Tags": [
"mock"
],
"Meta": {
"GET": "/mock/get, /mock/*/get, /mock/1/get, /mock/*/get, /mock/1/get"
},
"Port": 9090,
"Address": "192.168.10.23",
"EnableTagOverride": false,
"CreateIndex": 0,
"ModifyIndex": 0,
"ProxyDestination": "",
"Connect": null
}
}
... and the checks:
{
"service:mock-1": {
"Node": "97068118c16b",
"CheckID": "service:mock-1",
"Name": "Service 'mock-service' check",
"Status": "passing",
"Notes": "",
"Output": "HTTP GET http://192.168.10.23:9090/mock/cmd?config=current: 200 OK Output: <SNIPPED/>",
"ServiceID": "mock-1",
"ServiceName": "mock-service",
"ServiceTags": [
"mock"
],
"Definition": {},
"CreateIndex": 0,
"ModifyIndex": 0
}
}
See also the attachments where I made screenshots of Consul before and after
@josemariasoladuran is this something you wanted?
Yes, it's exatly that I wanted. Only one detail. Send Consul the URL of health check microservices mock, and implemented handleGet for URL /health. It's very important in order to Consul can check the live of the microservice mock. Thank you for your quickly support!
¿What happen with Eureka? It's a Netflix service registry and I think that it is the most used.
@Technolords is important that you can register the microservice mock in the more than one endpoint Consul or Eureka. Sometimes, the microservices ecosystems replicate service discovery
Oke, I'll make this flexible so you can register with many service registries, so the mock becomes shared between clusters if needed to be.
Current configuration (prototype) looks like:
<service-registration>
<consul address="192.168.10.14" port="8500">
<service address="192.168.10.10" port="9090" id="mock-1" name="mock-service" >
<health-check enabled="true" interval="60s" deregister-after="90m"/>
</service>
</consul>
</service-registration>
... so the extension will look like:
<service-registration>
<consul ... />
<consul ... />
<eureka ... />
<eureka ... />
</service-registration>
Btw, to answer your question regarding health checks. This is covered and working. An example of a failed health check looks like:
Implemented, tested, released and documented:
If I want integrate in the Netflix microservices ecosystem, I need that I can config in the XML file the endpoint Eureka Service Registry or Consul Service Registry in order to registry this microservice, as if it were a real service