Difference between Consul Service definition Address and Service Address
Consul service definition json is as follows
{
"Address": "192.168.10.10",
"TaggedAddresses": {
"lan": "192.168.10.10",
"wan": "10.0.10.10"
},
"CreateIndex": 51,
"ModifyIndex": 51,
"Node": "foobar",
"ServiceAddress": "172.17.0.3",
"ServiceEnableTagOverride": false,
"ServiceID": "32a2a47f7992:nodea:5000",
"ServiceName": "foobar",
"ServicePort": 5000,
"ServiceTags": [
"tacos"
]
}
Now as per the documentation provided at https://www.consul.io/docs/agent/http/catalog.html#catalog_service
the definition of address and service address is as follows:
A. Does this mean Address is the address of consul server node and service address is address of the node where service resides?
OR
B. Does this mean Address is the address of consul agent residing with the service. If this is the case does this mean address and service address are same?
which of the above is correct?
I suppose, that Address is the address of consul agent and ServiceAddress is the address which is used to access this service. This can be the same addresses, but they can also differ.
For example, you can have a single host with a number of interfaces, one of them is used to make Consul agents interact with each other, and another one is used to access your service.
Or you can have a single node with a number of microservices deployed with Docker. You can start a single Consul Agent with this node's address, and register a number of microservices running in containers and communicated with each other by container inner IP-addresses. In that case, you will get service info where Address is equals to node's IP and ServiceAddress is equals to the IP of the container with service.
链接地址: http://www.djcxy.com/p/93986.html上一篇: React Native Image.prefetch如何工作?
下一篇: 领事服务定义地址和服务地址之间的区别