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

Brief introduction and installation method of zookeeper

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article introduces the relevant knowledge of "introduction and installation method of zookeeper". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

1. Introduction of zookeeper

Directly translate the What is zookeeper of the official website.

Zookeeper is an one-stop service for configuration information, naming, providing distributed synchronization and clustering service. All of these services or other representations are often used in distributed systems. Every time to achieve them, it will inevitably take a lot of work to fix bugs and (adjust) competitive conditions. Because it is difficult to implement such services, they should be treated with caution at the beginning. Otherwise they will become very fragile and difficult to manage! Even if done correctly, different implementations of these services can still lead to the complexity of post-deployment maintenance.

My level can only be translated into this way, the original text is rather strange.

Original address: http://zookeeper.apache.org/

II. Configuration and installation

Click here to download the installation package, I am using the latest 3.4.6, which is a stable version.

The installation mode is pseudo-distributed deployment. That is, multiple nodes are deployed on the same machine. The installation process is relatively simple. The same is true of multiple machines.

1. Put the downloaded installation package in the / opt/shencl/zookeeper/ directory, extract the tar-zxvf, and rename it zookeeper-3.4.6_0.

two。 Make a copy of zoo_sample.cfg and name it zoo.cfg. To edit the zoo.cfg, we are going to deploy 3 nodes, so add the following configuration

TickTime=2000

InitLimit=5

SyncLimit=2

DataDir=/opt/shencl/zookeeper/data/data0

DataLogDir=/opt/shencl/zookeeper/log/log0

ClientPort=2180

Server.0=127.0.0.1:2888:3888

Server.1=127.0.0.1:2889:3889

Server.2=127.0.0.1:2890:3890

Parameter explanation:

TickTime: the interval (in milliseconds) between the client and the server or between multiple nodes on the server to maintain the heartbeat.

InitLimit: the waiting time for the server nodes to communicate with each other when initializing. One unit is the value of tickTime.

SyncLimit: the time interval between server nodes to synchronize data. One unit is the value of tickTime.

DataDir: the directory where data files are stored.

DataLogDir: the directory where transaction log files are used to redo data.

ClientPort: the port to connect to the client.

Server.0,server.1,server.2 represents the node number, followed by three digits separated by colons, indicating the ip of the node, the port number for exchanging data, and the port number used specifically for election after a node has been hung up.

Note: initLimit,syncLimit does not need to be configured in single-node deployment mode.

3. Create a myid file in the dataDir directory and write the node number 0. Such a node is configured.

4. Copy zookeeper-3.4.6_0 to zookeeper-3.4.6_1 and zookeeper-3.4.6_2, and the place to modify is the dataDir,dataLogDir,clientPort in zoo.cfg. You also need to create a new myid file in your data directory and write your own number.

The final directory structure is as follows:

More important are ls, get,set,create,delete, and so on. The path parameter must start with /. Pay attention to the acl parameter of the create command (Access Control permission control) and the version parameter of the set command

We use the create command to create a znode / testnode, and then ls, we find that it has been created successfully!

And look at the set and get commands, changing his value to iwantchangemynode.

This is the end of the introduction and installation method of zookeeper. Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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

Servers

Wechat

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

12
Report