. NET Configuration Center version-zookeper

Source: Internet
Author: User
Tags zookeeper zookeeper client

Introduction    zookeeper Basic concepts and roles not introduced here, now a lot of companies are using it, talking about its role, may be the first to think of is the configuration center, you can store the configuration as a node in the zookeeper, other applications can "focus" This node, when the configured value changes, other applications can be quickly notified.     Here is a detail, that is, the number of notifications, I first met zookeeper, thought "concern" after a node, the value of the node after the change can be notified, but the reality is that the client in the "concern" after a node, The first change of this node will be notified, and subsequent changes will not be notified, if you want to change the previous changes, you need to "pay attention" to the node after the first change notification, that is, zoookeeper in the "notice" notification is a one-time, similar to the Web request/ Response.     Based on this situation, Zookeeper's Java client curator did some optimizations, but. NET has not, based on this, I wrote a zookeeper watch help class, can achieve "one attention, multiple notifications." The core of Zookeeperwatchhelp  zookeeperwatchhelp is simple: After a node is "concerned", when the node changes, notification to the application, immediately after the "attention", and then execute the change handler.    Current code is open source, address is:https://github.com/zhaoyb/zookeeperwatcherhelp  Configuration Center zookeeper version     The previous configuration center is heartbeat-based, and when the configuration changes and is not immediately notified to the client, it may not be applicable for some scenarios, so upgrade to the zookeeper version.    zookeeper version of the core idea: the Application ID (AppId) as a node into the zookeeper, node's data is the version number of the application, when modifying the configuration, in addition to modifying the application version number, Also modify the data in the zookeeper to use node. The client initiates the use, registers the attention to the data changes of the specified node, notifies the client when the value of the node changes, and the client requests the server to pull the latest configuration.   zookeeper Configuration Center-server when it starts, it actively creates a node as the root node of the configuration center. In the event of a change in configuration,The update version number is processed and data for the corresponding node in the zookeeper is updated. The name of the node is the name of the app.  zookeeper version of the configuration center-the client client startup mode and before the start, the first instantiation of the Zookeeper object, need to zookeeper the server's host and port, these are actually configuration, So we get the configuration under the server-specific application (these configurations need to be configured beforehand), instantiate the zookeeper configuration, and register the concern after pulling to the zookeeper configuration. The   zookeeper client itself has a heavy-connection mechanism, so when one server goes down, it is automatically re-attached to another machine, which is transparent to the upper-level application, but to ensure high availability, a downgrade process is done every 20 seconds ( This time can be longer) active to the server to verify the version number.  

. NET Configuration Center version-zookeper

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.