1. Zookeeper Introduction
Apache Zookeeper is a software project for the Apache Software Foundation, which addresses scheduling problems in large distributed systems, zookeeper originally developed by Yahoo.
Zookeeper, as a distributed and highly available centralized scheduling service, runs in a service cluster that we call the zookeeper cluster. Distributed consistency, group management, leader elections are implemented through this service, so in our own applications there is no need to reinvent the wheel to implement them. The Apache zookeeper is implemented through the Java language.
2. Download and install
Before downloading and installing zookeeper, make sure your system has the Java Runtime Environment (Java 6 and above) installed
Zookeeper Download the way there are many, we give the official download path here http://www.apache.org/dyn/closer.cgi/zookeeper/
Choose the appropriate version of the download, this article using the zookeeper-3.4.10 version for you to explain.
2.1 CentOS7 Download Zookeeper
If your machine is not a Linux system, the first choice is to install a virtual machine, recommend you to use VirtualBox
After the virtual machine is installed, we enter the virtual machine and create a data directory, which commands the following
Mkdir/data
Enter the data directory, download zookeeper and unzip, here we use the wget command to download
wget http://apache.fayea.com/zookeeper/zookeeper-3.4.10/zookeeper-3.4.10.tar.gz
After the download is complete, unzip the downloaded package using the TAR command
Tar-c/DATA-ZXF zookeeper-3.4.10.tar.gz
2.2. Configure Zookeeper
After the decompression is complete, our next step is to configure the zookeeper,conf directory to be the zookeeper configuration information, by default, Zookeeper run requires a configuration file called Zoo.cfg, we create a zoo.cfg file and write zookeeper related configuration information.
VI zoo.cfg
Enter edit mode and write the following:
clientport=2181
2.3 Running Zookeeper
Go to the Bin directory in the Zookeeper directory to run the following command zookeeper
When the following prompts appear, the zookeeper starts successfully
Starting zookeeper ... Started
Execute the following command
We can get the following results
Mode:standalone
This shows that our zookeeper has started successfully and is running in standalone mode.
2.4 Configuration file parameter explanation
Ticktime: This parameter is in milliseconds, mainly for session registration and heartbeat detection between client and zookeeper server, and the session timeout is twice times the minimum time for this parameter.
Datadir:zookeeper the local data store path, which includes the transaction log at the time of the data snapshot and data update, by default, uncompressed zookeeper does not have this directory, and if the directory is not available on the server, the user is required to create the directory and give read and write permission.
Clientport:client link listening port, which the client uses to establish a connection with the Zookeeper service, which can be set to any number of values, and different zookeeper services can be configured to listen on different ports, which by default are 2181.
The end of this article, relatively speaking, the configuration of the Zookeeper standalone mode is relatively simple, next we will tell you how to configure the zookeeper of the stand-alone multiple nodes and clusters, please look forward to ...