[How to play with ZooKeeper] 4: ZK deployment, zookeeperzk deployment

Source: Internet
Author: User

[How to play with ZooKeeper] 4: ZK deployment, zookeeperzk deployment

 

 

 

 

 

 

 

 

See my blog


ZooKeeper has two deployment modes: cluster mode and standalone mode. the cluster mode is generally used in the production environment, which requires a high availability of the system and does not cause the entire system to become unavailable due to spof. the standalone mode is the minimum requirement of ZooKeeper, which is only used for testing and development.

Cluster deployment

PrepareAt least threeTo build a ZooKeeper cluster, why at least three servers? For more information, see why it is recommended that ZooKeeper be deployed on an odd number of machines.

Why is it recommended that ZooKeeper be deployed on an odd number of machines?

The official website strongly recommends that you deploy an odd number of zookeeper machines because of the election mechanism of ZooKeeper, and more than half of the machines with votes may become leaders, therefore, when only two servers or more than half of the servers in the cluster are down, the Leader cannot be elected. in fact, this is a problem of maximizing cluster resource utilization. For example, a cluster has three nodes, and one node can be suspended. At this time, there are more than half of the remaining two nodes. When a cluster has four nodes, only one node can be attached at most, because if another node is attached, there will be two nodes left in the entire cluster, which cannot meet the condition of more than half of the cluster. the Disaster Tolerance capabilities of both are the same. so, you know

Pseudo cluster deployment

During the study, we recommend that you use the pseudo cluster mode to change the requirements for multiple hardware to one machine. it is easy to implement. decompress the ZooKeeper package to three different directories, and modify the configuration file above, only the server startup port and client listening port, and the ip address remains unchanged. you can.

System Requirements

On the operating system, ZooKeeper supports mainstream operating systems, such as GNU/Linux, Sun Solaris, FreeBSD, MacOSX, Win32, win64 and so on (it seems like the mainstream operating system is like this ). in software, ZooKeeper is written in java and requires at leastUse JDK 6 or later. For FreeBSD operating system, openjdk7.

ZooKeeper is positioned as a cluster. Therefore, it is recommended to deploy the cluster in the study. However, considering the limited server resources in the development environment, you can also use a single machine to deploy the cluster, making it easier to learn.

Standalone deployment

Standalone deployment is even simpler. You only need to modify the following configurations in step 1 of cluster deployment to start. so easy!

tickTime=2000initLimit=10syncLimit=5dataDir=/data/zookeeperclientPort=2181
End

In general, the deployment of zookeeper is very simple. During the study, we recommend that you use the pseudo cluster mode to deploy zookeeper. When using zookeeper in the production environment, you also need to adjust the corresponding configuration of zookeeper according to the hardware conditions.

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.