I. Single-machine installation, configuration:
1. Download the Zookeeper binary installation package
: http://apache.dataguru.cn/zookeeper/zookeeper-3.4.3/zookeeper-3.4.3.tar.gz
The address above should have expired. The latest address is http://mirrors.hust.edu.cn/apache/zookeeper/zookeeper-3.4.9/.
2. Unzip the Zookeeper installation package
Store the zookeeper-3.4.3.tar.gz file in the/home/hadoop directory for decompression:
[Email protected]:~$ sudo tar-zxvf zookeeper-3.4.3.tar.gz[email protected]:~$ chown-r hadoop:hadoop zookeeper-3.4.3
or zookeeper online installation address has changed and need click to download, so it is not recommended to use the online wget
[Email protected]:~$ wget http://www.apache.org/dist/zookeeper/zookeeper-3.3.3/zookeeper-3.3.3.tar.gz[email protected]:~$ Tar zxvf zookeeper-3.3.3.tar.gz
3. Setting Environment Variables
Add the following red message to the/ETC/PROFILE,/HOME/HADOOP/.BASHRC file this is a bit of a problem I use to see is Vi/etc/profile
#set Java Environment
zookeeper_home=/home/hadoop/zookeeper-3.4.3
mahout_home=/home/hadoop/mahout-distribution-0.7
pig_home=/home/hadoop/pig-0.9.2
hbase_home=/home/hadoop/hbase-0.94.3
hive_home=/home/hadoop/hive-0.9.0
hadoop_home=/home/hadoop/hadoop-1.1.1
java_home=/home/hadoop/jdk1.7.0
Path= $JAVA _home/bin:$ZOOKEEPER _home/bin: $PIG _home/bin: $MAHOUT _home/bin: $HBASE _home/bin: $HIVE _home/bin: $HADOOP _home/bin: $HADOOP _home/conf: $PATH
Classpath=.: $JAVA _home/lib/dt.jar:$ZOOKEEPER _home/lib: $HBASE _home/lib: $MAHOUT _home/lib: $PIG _home/lib: $HIVE _home/lib: $JAVA _home/lib/tools.jar
Export Zookeeper_home
Export Mahout_home
Export Pig_home
Export Hbase_home
Export Hadoop_home
Export Java_home
Export Hive_home
Export PATH
Export CLASSPATH
4. Configuration
The configuration file is stored in the $zookeeper_home/conf/directory, the ZOO_SAMPLE.CFD file name is changed to Zoo.cfg, the default configuration is as follows: This article needs to note that there is no comment or the new folder after data will be annotated Cause the zookeeper service to come to an end (I'll introduce the troubleshooting process at the bottom)
# The number of milliseconds of each tickticktime=2000# the number of ticks the initial# synchronization phase can TA keinitlimit=10# the number of ticks so can pass between# sending a request and getting an acknowledgementsynclimit=5# th e directory where the snapshot is stored.# DoNot use/tmp forStorage,/tmp Here are just# example Sakes.datadir=/home/hadoop/zookeeper-3.4.3/data #这是我修改后的 # the port atwhichThe clients'll connectclientport=2181## be sure to read the maintenance section of the# Administrator guide before Turni ng on autopurge.## http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance## the number of Snapshots to retaininchdatadir#autopurge.snapretaincount=3# Purge Task Intervalinchhours# Set to ' 0 ' to disable Auto purge feature#autopurge.purgeinterval=1
Configuration Description:
Ticktime: This time is the time interval between the Zookeeper server or between the client and the server to maintain the heartbeat, that is, each ticktime time sends a heartbeat.
DataDir: As the name implies is Zookeeper to save the data directory, by default, Zookeeper will write the data log file is also stored in this directory.
ClientPort: This port is the port that the client connects to the Zookeeper server, Zookeeper listens to the port and accepts the client's access request.
5. Start Zookeeper
When these configuration items are configured, you can now start zookeeper:
[Email protected]:~/netstat-at| grep 2181 #查看zookeeper端口 [email protected]:~/netstat-nat #查看端口信息 [email protected]:~/zookeeper-3.4.3/bin$./ Zkserver. SH start #启动 [email protected]:~/zookeeper-3.4.3/bin$ JPS #查看启动的服务名称 [email protected]:~/ zookeeper-3.4.3/bin$./zkserversh stop #关闭
After starting to check whether Zookeeper is already in service, you can check the Netstat-at|grep 2181 command to see if there is a ClientPort port number in the listener service.
Here to add the zookeeper if the service does not come to the troubleshooting http://www.myexception.cn/open-source/1906016.html
Two. cluster installation, configuration:
Zookeeper Cluster Build click here
Zookeeper Installation and configuration