When trying out ZooKeeper for the first time, it’s simplest to run it in standalone mode with a single ZooKeeper server. You can do this on a development machine, for example.ZooKeeper requires Java 6 to run, so make sure you have it installed first. You don’t need Cygwin to run ZooKeeper on Windows, since there are Windows versions of the ZooKeeper scripts. (Windows is supported only as a development platform, not as a production platform.)
Download a stable release of ZooKeeper from the Apache ZooKeeper releases page at http://hadoop.apache.org/zookeeper/releases.html, and unpack the tarball in a suitable location:
ZooKeeper provides a few binaries to run and interact with the service, and it’s convenient to put the directory containing the binaries on your command-line path:
Before running the ZooKeeper service, we need to set up a configuration file. The configuration file is conventionally called zoo.cfg and placed in the conf subdirectory (although you can also place it in /etc/zookeeper, or in the directory defined by the ZOOCFGDIR environment variable, if set). Here’s an example:
This is a standard Java properties file, and the three properties defined in this example are the minimum required for running ZooKeeper in standalone mode. Briefly, tickTime is the basic time unit in ZooKeeper (specified in milliseconds), dataDir is the local filesystem location where ZooKeeper stores persistent data, and clientPort is the port the ZooKeeper listens on for client connections (2181 is a common choice). Youshould change dataDir to an appropriate setting for your system.With a suitable configuration defined, we are now ready to start a local ZooKeeper server:
To check whether ZooKeeper is running, send the ruok command (“Are you OK?”) to the client port using nc (telnet works, too):
That’s ZooKeeper saying, “I’m OK.” There are other commands, known as the “fourletter words,” for interacting with ZooKeeper. Most are queries: dump lists sessions and ephemeral znodes, envi lists server properties, reqs lists outstanding requests, and stat lists service statistics and connected clients. However, you can also update Zoo-Keeper’s state: srst resets the service statistics, and kill shuts down ZooKeeper ifissued from the host running the ZooKeeper server.
For more extensive ZooKeeper monitoring (including more four-letter words), have a look at its JMX support, which is covered in the ZooKeeper documentation .
Hadoop Related Interview Questions
|Informatica Interview Questions||Teradata Interview Questions|
|Hadoop Interview Questions||Java Interview Questions|
|Hadoop MapReduce Interview Questions||Apache Pig Interview Questions|
|Machine learning Interview Questions||NoSQL Interview Questions|
|HBase Interview Questions||MongoDB Interview Questions|
|Data Science R Interview Questions|
The Hadoop Distributed Filesystem
Developing A Mapreduce Application
How Mapreduce Works
Mapreduce Types And Formats
Setting Up A Hadoop Cluster
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.