Service Discovery in distributed systems using the Consul example. Alexander Sigachev

I propose to get acquainted with the decoding of the report of Alexander Sigachev Service Discovery in distributed systems on the example of Consul.


Service Discovery was created so that at a minimal cost you can connect a new application to our existing environment. Using Service Discovery, we can maximize the separation of either a container in the form of a docker or a virtual service from the environment in which it is running.



I greet everyone! I am Alexander Sigachev, I work for Inventos. And today I will introduce you to such a concept as Service Discovery. We will consider Service Discovery on the example of Consul.



What problems does Service Discovery solve?


Service Discovery was created so that at a minimal cost you can connect a new application to our existing environment. Using Service Discovery, we can maximize the separation of either a container in the form of a docker or a virtual service from the environment in which it is running.


What does it look like? In the classic web example, this is the frontend that accepts a user’s request. It then routes it to the backend. In this example, this load-balancer balances on two backend.



, . , , Service Discovery. Service Discovery load-balancer. Load-balancer backend . backend, , , .



Service Discovery?


Service Discovery nginx, backend-.



Service Discovery , .


?


  • , , Service Discovery, .
  • Service Discovery .
  • , Service Discovery, , , , .

, . , , , Service Discovery. , Service Discovery .


- , , , .



. Load-balancer nginx . , Consul. consul-template. . , ( Golang). , , , Service Discovery «reload». , nginx .



Consul?


  • – Service Discovery.


  • – Health Checking.


  • KV Store.


  • Multi Datacenter.



? KV Store . Health Checking . Multi Datacenter , . , Amazon , -, , , , .



, Consul .


  • Consul – , Go. Go – 1 , . .
  • , .
  • «datacenter» - .
  • Consensus – raft. , Consul. , .
  • Gossip – , . . - . , , . , .
  • LAN Gossip – -.
  • WAN Gossip – , -. , .
  • RPC – .

RPC. , Consul . . . , , .


, . , . , , , .



, . , . . , UDP/TCP. - . .



API Consul?


, API Consul.


DNS API. Consul 8600 . , DNS. IP-.


HTTP API – 8500 JSON , IP , host, . token.



, Consul?


, . Agent . . , .


– production. . , bootstrap , . . , . , , , . . , , bootstrap, . , .


. , , . , .



Health Checks?


Consul Json . – google.com. , 30 . , .


– . curl localhost 10 .


Service Discovery. , .



Consul UI-, . , .


«». , , Consul. . -, .



«Nodes». , -. , , . . , . - , .


Consul , .



: -, Consul ?


: - . – -, . . Consul.


: . . Consul -?


: . -. – - . , , , .


: , -, Service Discovery - , Consul?


: . , . , name, . Consul.


: UI . UI, , production-. ? ? - ?


: UI Service Discovery. .


: ?


: Consul localhost. , - proxy. .


: ? Health Checks. , .


: , .


: , .


: – .


: Service Discovery Consul ?


: . – , . , -, 1- . , , Kubernetes, . Kubernetes Service Discovery Etcd. , Consul. Service Discovery Consul.


: ? Consul , ?


: . , .


: Consul ?


: , . , , service.consul. . production , , , DNS.


: . . , Consul, , ?


Answer: Yes. If we work on DNS, then it works as without Consul when we use DNS names. Usually modern applications do not pull the domain name in every request, because we have installed connect, everything works and in the near future we practically do not use it. If connect is broken, then - yes, we again ask where we have the base and go to it.

Source: https://habr.com/ru/post/undefined/


All Articles