|
@@ -53,7 +53,7 @@ limitations under the License.
|
|
|
* [Read Operations](#sc_readOps)
|
|
|
* [Write Operations](#sc_writeOps)
|
|
|
* [Handling Watches](#sc_handlingWatches)
|
|
|
- * [Miscelleaneous ZooKeeper Operations](#sc_miscOps)
|
|
|
+ * [Miscellaneous ZooKeeper Operations](#sc_miscOps)
|
|
|
* [Program Structure, with Simple Example](#ch_programStructureWithExample)
|
|
|
* [Gotchas: Common Problems and Troubleshooting](#ch_gotchas)
|
|
|
|
|
@@ -65,7 +65,7 @@ This document is a guide for developers wishing to create
|
|
|
distributed applications that take advantage of ZooKeeper's coordination
|
|
|
services. It contains conceptual and practical information.
|
|
|
|
|
|
-The first four sections of this guide present higher level
|
|
|
+The first four sections of this guide present a higher level
|
|
|
discussions of various ZooKeeper concepts. These are necessary both for an
|
|
|
understanding of how ZooKeeper works as well how to work with it. It does
|
|
|
not contain source code, but it does assume a familiarity with the
|
|
@@ -93,7 +93,7 @@ Most of the information in this document is written to be accessible as
|
|
|
stand-alone reference material. However, before starting your first
|
|
|
ZooKeeper application, you should probably at least read the chapters on
|
|
|
the [ZooKeeper Data Model](#ch_zkDataModel) and [ZooKeeper Basic Operations](#ch_guideToZkOperations). Also,
|
|
|
-the [Simple Programmming
|
|
|
+the [Simple Programming
|
|
|
Example](#ch_programStructureWithExample) _[tbd]_ is helpful for understanding the basic
|
|
|
structure of a ZooKeeper client application.
|
|
|
|
|
@@ -101,7 +101,7 @@ structure of a ZooKeeper client application.
|
|
|
|
|
|
## The ZooKeeper Data Model
|
|
|
|
|
|
-ZooKeeper has a hierarchal name space, much like a distributed file
|
|
|
+ZooKeeper has a hierarchal namespace, much like a distributed file
|
|
|
system. The only difference is that each node in the namespace can have
|
|
|
data associated with it as well as children. It is like having a file
|
|
|
system that allows a file to also be a directory. Paths to nodes are
|
|
@@ -145,12 +145,12 @@ information see... )_[tbd...]_
|
|
|
_node_ can refer to a generic host machine, a
|
|
|
server, a member of an ensemble, a client process, etc. In the ZooKeeper
|
|
|
documentation, _znodes_ refer to the data nodes.
|
|
|
-_Servers_ refer to machines that make up the
|
|
|
+_Servers_ refers to machines that make up the
|
|
|
ZooKeeper service; _quorum peers_ refer to the
|
|
|
servers that make up an ensemble; client refers to any host or process
|
|
|
which uses a ZooKeeper service.
|
|
|
|
|
|
-Znodes are the main enitity that a programmer access. They have
|
|
|
+Znodes are the main entity that a programmer access. They have
|
|
|
several characteristics that are worth mentioning here.
|
|
|
|
|
|
<a name="sc_zkDataMode_watches"></a>
|
|
@@ -183,7 +183,7 @@ be much less than that on average. Operating on relatively large data
|
|
|
sizes will cause some operations to take much more time than others and
|
|
|
will affect the latencies of some operations because of the extra time
|
|
|
needed to move more data over the network and onto storage media. If
|
|
|
-large data storage is needed, the usually pattern of dealing with such
|
|
|
+large data storage is needed, the usual pattern of dealing with such
|
|
|
data is to store it on a bulk storage system, such as NFS or HDFS, and
|
|
|
store pointers to the storage locations in ZooKeeper.
|
|
|
|
|
@@ -202,8 +202,8 @@ Retrieves the list of ephemeral nodes created by the session for the
|
|
|
given path. If the path is empty, it will list all the ephemeral nodes
|
|
|
for the session.
|
|
|
**Use Case** - A sample use case might be, if the list of ephemeral
|
|
|
-nodes for the session need to be collected for duplicate data entry check
|
|
|
-and the nodes are created in sequential manner so you do not know the name
|
|
|
+nodes for the session needs to be collected for duplicate data entry check
|
|
|
+and the nodes are created in a sequential manner so you do not know the name
|
|
|
for duplicate check. In that case, getEphemerals() api could be used to
|
|
|
get the list of nodes for the session. This might be a typical use case
|
|
|
for service discovery.
|
|
@@ -987,7 +987,7 @@ the _isValid(String id)_ method. It is up to the plugin to verify
|
|
|
that the id has a correct form. For example, _ip:172.16.0.0/16_
|
|
|
is a valid id, but _ip:host.com_ is not. If the new ACL includes
|
|
|
an "auth" entry, _isAuthenticated_ is used to see if the
|
|
|
-authentication information for this scheme that is assocatied with the connection
|
|
|
+authentication information for this scheme that is associated with the connection
|
|
|
should be added to the ACL. Some schemes
|
|
|
should not be included in auth. For example, the IP address of the client is not
|
|
|
considered as an id that should be added to the ACL if auth is specified.
|
|
@@ -1107,7 +1107,7 @@ ZooKeeper does _not_ in fact make. This is:
|
|
|
to read /a, client B may read the old value of 0, depending on
|
|
|
which server it is connected to. If it
|
|
|
is important that Client A and Client B read the same value,
|
|
|
- Client B should should call the **sync()** method from the ZooKeeper API
|
|
|
+ Client B should call the **sync()** method from the ZooKeeper API
|
|
|
method before it performs its read.
|
|
|
So, ZooKeeper by itself doesn't guarantee that changes occur
|
|
|
synchronously across all servers, but ZooKeeper
|
|
@@ -1135,7 +1135,7 @@ generated classes that are used simply as containers.
|
|
|
|
|
|
The main class used by a ZooKeeper Java client is the **ZooKeeper** class. Its two constructors differ only
|
|
|
by an optional session id and password. ZooKeeper supports session
|
|
|
-recovery accross instances of a process. A Java program may save its
|
|
|
+recovery across instances of a process. A Java program may save its
|
|
|
session id and password to stable storage, restart, and recover the
|
|
|
session that was used by the earlier instance of the program.
|
|
|
|
|
@@ -1164,8 +1164,8 @@ design:
|
|
|
Note that if there is a change to **/a** between the asynchronous read and the
|
|
|
synchronous read, the client library will receive the watch event
|
|
|
saying **/a** changed before the
|
|
|
- response for the synchronous read, but because the completion
|
|
|
- callback is blocking the event queue, the synchronous read will
|
|
|
+ response for the synchronous read, but because of the completion
|
|
|
+ callback blocking the event queue, the synchronous read will
|
|
|
return with the new value of **/a**
|
|
|
before the watch event is processed.
|
|
|
|
|
@@ -1315,7 +1315,7 @@ you have to remember to
|
|
|
1. Include ZooKeeper header: `#include <zookeeper/zookeeper.h>`
|
|
|
1. If you are building a multithreaded client, compile with
|
|
|
`-DTHREADED` compiler flag to enable the multi-threaded version of
|
|
|
- the library, and then link against against the
|
|
|
+ the library, and then link against the
|
|
|
_zookeeper_mt_ library. If you are building a
|
|
|
single-threaded client, do not compile with `-DTHREADED`, and be
|
|
|
sure to link against the_zookeeper_st_library.
|
|
@@ -1487,10 +1487,9 @@ ZooKeeper users fall into:
|
|
|
ZooKeeper must sync transactions to media before it returns a
|
|
|
response. A dedicated transaction log device is key to consistent good
|
|
|
performance. Putting the log on a busy device will adversely effect
|
|
|
- performance. If you only have one storage device,
|
|
|
- increase the snapCount so that snapshot files are generated less often;
|
|
|
- it does not eliminate the problem, but it makes more resources available
|
|
|
- for the transaction log.
|
|
|
+ performance. If you only have one storage device, put trace files on
|
|
|
+ NFS and increase the snapshotCount; it doesn't eliminate the problem,
|
|
|
+ but it can mitigate it.
|
|
|
1. Set your Java max heap size correctly. It is very important to
|
|
|
_avoid swapping._ Going to disk unnecessarily will
|
|
|
almost certainly degrade your performance unacceptably. Remember, in
|
|
@@ -1517,7 +1516,7 @@ information for ZooKeeper developers.
|
|
|
* *[API Reference](https://zookeeper.apache.org/doc/current/api/index.html)* :
|
|
|
The complete reference to the ZooKeeper API
|
|
|
|
|
|
-* *[ZooKeeper Talk at the Hadoup Summit 2008](http://us.dl1.yimg.com/download.yahoo.com/dl/ydn/zookeeper.m4v)* :
|
|
|
+* *[ZooKeeper Talk at the Hadoop Summit 2008](http://us.dl1.yimg.com/download.yahoo.com/dl/ydn/zookeeper.m4v)* :
|
|
|
A video introduction to ZooKeeper, by Benjamin Reed of Yahoo!
|
|
|
Research
|
|
|
|