Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install Zookeeper for Mac

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "how to install Zookeeper in Mac". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to install Zookeeper in Mac.

What is Zookeeper?

There is a sentence on Zookeeper's website: ZooKeeper is a centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services.

This roughly describes that Zookeeper is mainly a distributed service coordination framework that implements distributed applications such as synchronous services, configuration maintenance and naming services. Is a high-performance distributed data consistency solution.

Zookeeper is the configuration center for centralized storage and management of distributed systems.

CP system

Zookeeper is a CP (consistency + partition fault tolerance), that is, the access request to Zookeeper at any time can get consistent data results, and the system is fault tolerant to network segmentation.

However, it does not guarantee the availability of each service request. That is, in extreme circumstances, ZooKeeper may discard some requests, and consumer programs need to re-request to get the results.

Brew install zookeeper

Brew search zookeepker

Zookeeper supports brew installation

Installation

Brew install zookeeper

Main installation file path after successful installation

/ usr/local/Cellar/zookeeper/3.4.13

Configuration file path

/ usr/local/etc/zookeeper

Contains four main files

A brief introduction to Zookeeper-Zookeeper configuration-Tounan Technology

Here is an extension to explain the difference between windows system and Linux and Mac system: configuration files are separated from installation files. This difference in way of thinking is useful.

Start

$zkServer start:

View statu

$zkServer status:

ZooKeeper JMX enabled by default

Using config: / usr/local/etc/zookeeper/zoo.cfg

Mode: standalone

Standalone here refers to stand-alone mode.

PHP client sudo pecl install zookeeper.

[direct terminal operation, one of the manifestations of mac's productivity]

Build process completed successfullyInstalling'/ usr/local/Cellar/php@7.2/7.2.18/pecl/20170718/zookeeper.so'install ok: the main role of channel://pecl.php.net/zookeeper-0.6.4Extension zookeeper enabled in php.ini https://pecl.php.net/package/zookeeperZookeeper

Its main function is to maintain and monitor the state changes of the data you store. By monitoring the changes in the state of these data, data-based cluster management can be achieved.

ZNode

ZNode is the smallest unit of data in Zookeeper, and each ZNode can save data and mount child nodes at the same time, so it forms a hierarchical namespace called tree.

A brief introduction to ZooKeeper-ZNode- Tunan Technology

Watcher data change Notification

Zookeeper uses Watcher mechanism to realize the publish / subscribe function of distributed data.

A brief introduction to ZooKeeper-Watcher Mechanism-Tounan Technology

A specific case of distributed coordination

From the official account javaEdge

As shown in the figure above, system A sends a request to MQ, and then system B consumes the message and processes it. How does system A know the processing result of system B?

The coordination between distributed systems can be realized with ZK!

After sending a request, system A can register a listener on the value of a node on ZK. Once system B has finished processing, modify the value of that node in ZK, and A will immediately receive a notification, which can be solved perfectly.

This is a typical real-time notification and communication model.

Different clients register the same data node on the ZooKeeper with Watcher and listen for changes in the data node (including the data node itself and its children). If the data node changes, then all subscribed clients can receive the corresponding Watcher notification and deal with it accordingly.

Summary

This article starts with the installation of Zookeeper extension in PHP environment, and briefly introduces the basic concepts and usage scenarios of Zookeeper, which is not complete. If PHP and Zookeeper are clients of a distributed system, the use cases on the Internet are very limited, just like the use of circuit breaker assembly in PHP environment, there are very few cases, and the stability can not be guaranteed.

At this point, I believe you have a deeper understanding of "Mac how to install Zookeeper". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report