Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

zookeeper as a service registry

I want to use the ZooKeeper as a service registry which replicated identical services can register themselves and clients may discover available services's url to call them. As a starter to ZooKeeper I need the basic java code for registering and discovering the services on ZooKeeper.

like image 649
nourani Avatar asked Jan 29 '13 15:01

nourani


People also ask

Is ZooKeeper a service registry?

ZooKeeper is a centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services. All of these kinds of services are used in some form or another by distributed applications.

Can ZooKeeper be used for service discovery?

You can implement dynamic service discovery by including an additional indirection step through ZooKeeper. The HS2 instances register with ZooKeeper under a namespace. When a HiveServer2 instance comes up, it registers itself with ZooKeeper by adding a znode in ZooKeeper.

What is service registry in microservices?

Microservices Service Registry A service registry is a database used to keep track of the available instances of each microservice in an application. The service registry needs to be updated each time a new service comes online and whenever a service is taken offline or becomes unavailable.

How do I start a ZooKeeper service?

To start the ZooKeeper server on a Linux system, use the Zookeeper/zookeeper/bin/zkServer.sh restart command from your Watson Explorer installation directory. On Microsoft Windows systems, use the Zookeeper\zookeeper\bin\zkServer. cmd command.


1 Answers

Check out Curator Discovery (part of Apache Curator), a Zookeeper-based service registry written in Java.

In SOA/distributed systems, services need to find each other. i.e. a web service might need to find a caching service, etc. DNS can be used for this but it is nowhere near flexible enough for services that are constantly changing. A Service Discovery system provides a mechanism for:

  • Services to register their availability
  • Locating a single instance of a particular service
  • Notifying when the instances of a service change
like image 73
sourcedelica Avatar answered Sep 18 '22 15:09

sourcedelica