1. Requirements
Install zookeeper and metaq
2. Download
Http://zookeeper.apache.org/releases.html
The current stable version is a zookeeper-3.4.6
3. Extract
Tar-XF zookeeper-3.4.6.tar.gz
Decompress the file to "/usr/local/zookeeper-3.4.6 ".
4. Copy zoo_sample.cfg under the conf directory and name it zoo. cfg.
5. Modify the zoo. cfg configuration file
# The number of milliseconds of each tick
Ticktime = 2000
# The number of ticks that the initial
# Synchronization phase can take
Initlimit = 10
# The number of ticks that can pass
# Sending a request and getting an acknowledgement
Synclimit = 5
# The directory where the snapshot is stored.
# Do not use/tmp for storage,/tmp here is just
# Example sakes.
Datadir =/datatmp/zookeeper/Data
Datalogdir =/datatmp/zookeeper/logs
# The port at which the clients will connect
Clientport = 2181
# The maximum number of client connections.
# Increase this if you need to handle more clients
# Maxclientcnxns = 60
#
# Be sure to read the Maintenance Section of
# Administrator guide before turning on autopurge.
#
# Http://zookeeper.apache.org/doc/current/zookeeperAdmin.html# SC _maintenance
#
# The number of snapshots to retain in datadir
# Autopurge. snapretaincount = 3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
# Autopurge. purgeinterval = 1
#2888,3888 are election Port
Server.1 = zookeeper: 2888: 38888
Among them, port 2888 is the port for communication between services, while port 3888 is; port for zookeeper to communicate with other applications. zookeeper is the IP address mapped to the local machine in hosts.
Initlimit: This configuration item is used to configure zookeeper to accept the client (the client mentioned here is not the client that the user connects to the zookeeper server, but the follower server connected to the leader in the zookeeper server cluster) the maximum heartbeat interval that can be tolerated during connection initialization. When the length of the heartbeat exceeds 10 (ticktime), the zookeeper server does not receive the response from the client, which indicates that the connection to the client fails. The total length is 5*2000 = 10 seconds.
Synclimit: This configuration item identifies the length of time for sending a message, request, and response between the leader and Follower. The maximum length is 2*2000 = 4 seconds.
Server. A = B: C: D: where A is a number, indicating the number of the server. B is the IP address of the server; c Indicates the port on which the server exchanges information with the leader server in the cluster. D indicates that if the leader server in the cluster fails, a port is required for re-election, select a new leader, which is the port used for communication between servers during the election. For the pseudo cluster configuration method, because B is the same, different zookeeper instance communication port numbers cannot be the same, so you need to assign them different port numbers.
6. Create the directory specified by the datadir parameter ("/datatmp/zookeeper/Data" Here) and create a file under the directory named "myid ".
7. Edit the "myid" file and enter the corresponding number on the machine of the corresponding IP address. For example, on zookeeper, the content of the "myid" file is 1. This time, only one server 1 is installed and configured on the single point of failure (spof. If there are other servers such as 192.168.1.102, add server.2 = 192.168.1.102: 2888: 3888 to the zoo. cfg file. The content of the myid file on the 192.168.1.102 server is 2. At this point, for a multi-server configuration, You need to copy the zookeeper-3.4.3 directory to another server and then modify the myid as described above.
8. Set path in the/etc/profile file
Modify the profile file:
Sudo VI/etc/profile
export ZOOKEEPER_HOME=/home/hadooptest/zookeeper-3.4.3export PATH=$ZOOKEEPER_HOME/bin:$PATHexport PATH
Oh yeah !!! Installation complete!
After installation, start the installation.
1. Start
zookeeper-3.4.6/bin/zkServer.sh start
2. Enter the JPS command to view the process
1573 QuorumPeerMain1654 Jps
Among them, quorumpeermain is the zookeeper process and starts normally.
3. View status: zookeeper-3.4.3/bin/zkserver. Sh status
-JMX enabled by defaultUsing config: /usr/local/zookeeper-3.4.6/bin/../conf/zoo.cfgMode: standalone
4. Start the client script: zookeeper-3.4.3/bin/zkcli. Sh-server zookeeper: 2181
5. Stop the zookeeper process: zookeeper-3.4.3/bin/zkserver. Sh stop
Participation:
Http://zookeeper.apache.org/doc/trunk/zookeeperStarted.html
Install zookeeper in centos