1 Interview questions ：Dubbo in zookeeper To be a registration center , If the registry cluster hangs up , Can publishers and subscribers communicate with each other ?
tolerable , start-up dubbo Time , Consumers will zk Pull address interface and other data of registered producers , Cache locally . On every call , Call according to the address stored locally
Registry peer cluster , After any one goes down , Will automatically switch to another
Registration center down , Service providers and consumers can still communicate through the local cache
Service provider stateless , Any one After downtime , Does not affect use
All service providers down , Service consumers will not be able to use , And reconnects indefinitely waiting for the server to recover
2 dubbo The difference between connecting registry and direct connection
In the development and test environment , Often need to bypass the registry , Test only the specified service provider , You may need a point-to-point direct connection at this time ,
Point to point direct connection , Will be in service interface units , Ignore provider list for registry ,
Service registry , Dynamic registration and discovery services , Make the location of services transparent , And obtain the address list of service provider from the consumer , Realize soft load balancing and Failover,
The registry returns the service provider address list to the consumer , If there is a change , Registration center will push change data to consumers based on long connection .
Service consumers , From provider address list , Based on soft load balancing algorithm , Select a provider to call , If the call fails , Select another call . Registration center is responsible for the registration and search of service address , Equivalent to directory service , Service providers and consumers interact with the registry only at startup , Registry does not forward requests , The service consumer obtains the service provider address list from the registration center , And call the provider directly according to the load algorithm , Registration Center , Service provider , Long connection among service consumers , Except for monitoring center , Registry perceives the existence of service provider through long connection , Service provider down , The registration center will immediately notify consumers of the event
Registration center and monitoring center all down , Does not affect running providers and consumers , Consumer cached provider list locally
Registration center and monitoring center are optional , Service consumers can directly connect with service providers
3,Dubbo How to solve the security mechanism
Dubbo adopt Token Token prevents users from bypassing the registry direct connection , Then manage authorization on the registry .Dubbo Black and white list of services , To control the callers allowed by the service .