Use zookeeper and thrift to build the HA logserver

Source: Internet
Author: User
Introduction to zookeeper

Zookeeper is a distributed, open-source distributed application.ProgramThe coordination service contains a simple set of primitives. distributed applications can implement synchronization services, configuration maintenance, and naming services based on it. Currently, Zookeeper is used in hadoop/hbase for node management. With zookeeper, you can easily develop some distributed control tools, such as distributed lock, barrier, countdown, and semaphore, some even use zookeeper to develop a distributed collections.

Zookeeper Client

We build a distributed logserver system, mainly using Zookeeper's directory service. zookeeper itself has APIs for us to use some of Zookeeper's features. However, Zookeeper's API interfaces are too stiff and inconvenient to use, however, many companies are using such a powerful zookeeper. They will certainly find problems with the existing APIs and certainly have a lot of excellent APIs. So we found the curator, curator is an open-source zookeeper client framework of Netflix. during the use of zookeeper, Netflix found that the client provided by zookeeper is too low-layer, and the application side needs to handle a lot of things on its own, so it wrapped it on the basis of it, provides a better client framework.

Curator mainly solves three problems:

Encapsulate connection processing between zookeeper client and zookeeper server;

Provides a set of fluent APIs;

Provides abstract encapsulation of zookeeper application scenarios (recipe, such as the shared lock service and cluster leader election mechanism.

The Zookeeper implemented by curator has the following features:

Use curator

Use curator to register a logserver with zookeeper.CodeSee the init method in the zookeepermanager class of logserver:

Use curator to obtain the logserver information registered to zookeeper from zookeeper. For the code, see the init method in the zoologclient class of the logserver project:

To sum up, you can use curator to register a logserver with zookeeper. The log client then uses curator to obtain the registered zookeeper information. When a logserver is on the machine, Zookeeper can notify the log client, to obtain the new logserver service.

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.