1. Introduction
The coordinated operation of each process under distributed scenario is inseparable from zookeeper, and zookeeper is already a fact standard for distributed coordination services in the Big data field.
This article only describes the installation method for zookeeper.
2. Node planning is as follows:
Xufeng-1 |
Xufeng-2 |
Xufeng-3 |
Zookeeper |
Zookeeper |
Zookeeper |
3. Directory Planning
Drwxrwxr-x.3Hadoop Hadoop4096July A the: thehadoop-DATADRWXRWXR-X.3Hadoop Hadoop4096July A -: theHADOOPLIBDRWXRWXR-X.3Hadoop Hadoop4096July A the: .javalrwxrwxrwx.1Hadoop Hadoop -July A the: - Zookeeper/opt/hadoop/hadooplib/cdh5.4.2/zookeeper-3.4.5-cdh5.4.2DRWXRWXR-X.2Hadoop Hadoop4096July A the: -Zookeeper-config
In the above:
1. The soft link form is advantageous to the subsequent version upgrade does not affect the environment variable and so on parameter's setting.
2. The configuration file is independent of the package to facilitate the upgrade without affecting the existing operating parameters.
4. Start the installation
"Operations on individual nodes"
A. Set environment variable parameters:
#zookeeperexport zookeeper_home=/opt/hadoop/zookeeperexport zoocfgdir=/opt/hadoop/ Zookeeper-config
B. Setting the configuration file
Copy the files under Conf in the package to the Zookeeper-config folder
rename zoo_sample.cfg to Zoo.cfg
[[Email protected]1hadoop]$ CD zookeeper-config/[[Email protected]-1zookeeper-config]$ ll Total dosage A-rwxr-x---.1Hadoop Hadoop535July A the: +configuration.xsl-rwxr-x---.1Hadoop Hadoop2717July A -: -log4j.properties-rwxr-x---.1Hadoop Hadoop913July A the: AZoo.cfg
C. Modify the Zoo.cfg to add the following three lines of information according to the environment information
# The port at which the clients would connectclientport=2181server. 1=xufeng-1:2888:3888server. 2=xufeng-2:2888:3888server. 3=xufeng-3:2888:3888# # is sure to read the maintenance section of the< /c17>
D. View the datadir parameter setting information in the ZOO.CFG configuration and create the myID file in this directory on each host, respectively:
[[Email protected]1 hadoop]$ cd hadoop-data/zookeeper/[[email protected]-18 1 hadoop hadoop 2 July : myID
E. Set myID content, write myID 2,xufeng-3 file in myID file on Xufeng-1 host as written in myID file to write 3 according to step C's settings in the 1,xufeng-2 files.
E. Configuring log directories and Parameters
Add the following two variables to the ~/.brash_profile:
Export zoo_log_dir=/opt/hadoop/zookeeper/logsexport zoo_log4j_prop='info,rollingfile '
Complete the above installation section
5. Start Zookeeper
At every few points,
A. Executing the zkserver.sh start startup script
[[Email protected]3default/opt/hadoop/zookeeper-config/zoo.cfgstarting Zookeeper ... STARTED
Note: I heard that CentOS6 has a bug: need to shut down the firewall to connect the port:
So when you start zookeeper and find that there is no route hosts error in the log, this is probably the reason why you can execute the following command: service iptables stop chkconfig iptables off
B. View the status of each zookeeper:
[[Email protected]1zookeeper]$ zkserver.sh statusjmx enabled bydefaultUsing config:/opt/hadoop/zookeeper-config/Zoo.cfgmode: leader[[email protected]-2zookeeper]$ zkserver.sh statusjmx enabled bydefaultUsing config:/opt/hadoop/zookeeper-config/Zoo.cfgmode: follower[[email protected]-3hadoop]$ zkserver.sh statusjmx enabled bydefaultUsing config:/opt/hadoop/zookeeper-config/Zoo.cfgmode: follower
Above.
[Hadoop] [Will install]zookeeper