What does zookeeper do in dubbo

This article aims to express my preliminary understanding of the role of zookeeper in dubbo

After a preliminary exploration of dubbo, I don't know much about the role of zookeeper in it, because I don't have a particularly specific concept of zookeeper, so think about it here, why use zookeeper or why does dubbo have a registration center

 

one-to-one call

Server A relies on the RPC service provided by Server B, because Server B has only a single copy, then Server A only needs the ip and port of the RPC call provided by Server B at this time.

one-to-many call

In the context of the increasing number of users, Server B needs to expand horizontally. At this time, Server B has expanded to 3 servers: 01, 02, 03

The benefits of doing this are:

  • One is down, and there are two servers running normally
  • load balancing
  • ...

So for Server A, there are 3 Server Bs that can be used at once, how to choose? If I choose 01, I still need to be concerned about whether 01 has failed, and who should I choose if 01 has failed?

For Server B, how can I do load balancing?

In fact, for Server A, I don't want to care about the master and backup status of Server B. I want the entire distribution of Server B to be completely transparent to my caller, so consider this structure:

In fact, this structure is easy to understand: due to the distributed deployment of Server B, Server A has difficulty in choosing and does not know which B to choose, then we let the middleman help him choose and tell him, and then Server A knows who to look for. It will find the relevant Server. The yellow line in the figure represents the registration notification process, and the green line represents the calling process .

For example, the three servers of Server B all register an RPC interface for "get user list" to zookeeper. Server A connects to zookeeper as a client, asks zookeeper for a "get user list" interface, and gets the relevant information of this interface After that, Server A calls the service on a specific server of Server B. That is: the registration center (zookeeper) does not make actual method calls, but only acts as a transmitter of relevant information.

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324884645&siteId=291194637