|
@@ -276,6 +276,11 @@ document.write("Last Published: " + document.lastModified);
|
|
|
<ul class="minitoc">
|
|
|
<li>
|
|
|
<a href="#Java+Binding">Java Binding</a>
|
|
|
+<ul class="minitoc">
|
|
|
+<li>
|
|
|
+<a href="#sc_java_client_configuration">Client Configuration Parameters</a>
|
|
|
+</li>
|
|
|
+</ul>
|
|
|
</li>
|
|
|
<li>
|
|
|
<a href="#C+Binding">C Binding</a>
|
|
@@ -284,7 +289,7 @@ document.write("Last Published: " + document.lastModified);
|
|
|
<a href="#Installation">Installation</a>
|
|
|
</li>
|
|
|
<li>
|
|
|
-<a href="#Using+the+C+Client">Using the C Client</a>
|
|
|
+<a href="#Building+Your+Own+C+Client">Building Your Own C Client</a>
|
|
|
</li>
|
|
|
</ul>
|
|
|
</li>
|
|
@@ -1572,7 +1577,7 @@ document.write("Last Published: " + document.lastModified);
|
|
|
<p>This is a very simple example which is intended to show
|
|
|
how to interact with ZooKeeper ACLs
|
|
|
specifically. See <span class="codefrag filename">.../trunk/src/c/src/cli.c</span>
|
|
|
- for an example of a proper C client implementation</p>
|
|
|
+ for an example of a C client implementation</p>
|
|
|
|
|
|
</div>
|
|
|
</div>
|
|
@@ -1926,6 +1931,126 @@ authProvider.2=com.f.MyAuth2
|
|
|
(SESSION_EXPIRED and AUTH_FAILED), the ZooKeeper object becomes invalid.
|
|
|
On a close, the two threads shut down and any further access on zookeeper
|
|
|
handle is undefined behavior and should be avoided. </p>
|
|
|
+<a name="sc_java_client_configuration"></a>
|
|
|
+<h4>Client Configuration Parameters</h4>
|
|
|
+<p>
|
|
|
+ The following list contains configuration properties for the Java client. You can set any
|
|
|
+ of these properties using Java system properties. For server properties, please check the
|
|
|
+ following reference
|
|
|
+ <a href="zookeeperAdmin.html#sc_configuration">Server configuration section.</a>
|
|
|
+
|
|
|
+</p>
|
|
|
+<dl>
|
|
|
+
|
|
|
+<dt>
|
|
|
+<term>zookeeper.sasl.client</term>
|
|
|
+</dt>
|
|
|
+<dd>
|
|
|
+<p>Set the value to <strong>false</strong> to disable
|
|
|
+ SASL authentication. Default is <strong>true</strong>.</p>
|
|
|
+</dd>
|
|
|
+
|
|
|
+<dt>
|
|
|
+<term>zookeeper.sasl.clientconfig</term>
|
|
|
+</dt>
|
|
|
+<dd>
|
|
|
+<p>Specifies the context key in the JAAS login file. Default is "Client".</p>
|
|
|
+</dd>
|
|
|
+
|
|
|
+<dt>
|
|
|
+<term>zookeeper.sasl.client.username</term>
|
|
|
+</dt>
|
|
|
+<dd>
|
|
|
+<p>Traditionally, a principal is divided into three parts: the primary, the instance, and the realm.
|
|
|
+ The format of a typical Kerberos V5 principal is primary/instance@REALM.
|
|
|
+ zookeeper.sasl.client.username specifies the primary part of the server principal. Default
|
|
|
+ is "zookeeper". Instance part is derived from the server IP. Finally server's principal is
|
|
|
+ username/IP@realm, where username is the value of zookeeper.sasl.client.username, IP is
|
|
|
+ the server IP, and realm is the value of zookeeper.server.realm.</p>
|
|
|
+</dd>
|
|
|
+
|
|
|
+<dt>
|
|
|
+<term>zookeeper.server.realm</term>
|
|
|
+</dt>
|
|
|
+<dd>
|
|
|
+<p>Realm part of the server principal. By default it is the client principal realm.</p>
|
|
|
+</dd>
|
|
|
+
|
|
|
+<dt>
|
|
|
+<term>zookeeper.disableAutoWatchReset</term>
|
|
|
+</dt>
|
|
|
+<dd>
|
|
|
+<p>This switch controls whether automatic watch resetting is enabled. Clients automatically
|
|
|
+ reset watches during session reconnect by default, this option allows the client to turn off
|
|
|
+ this behavior by setting zookeeper.disableAutoWatchReset to <strong>true</strong>.
|
|
|
+ </p>
|
|
|
+</dd>
|
|
|
+
|
|
|
+<dt>
|
|
|
+<term>zookeeper.client.secure</term>
|
|
|
+</dt>
|
|
|
+<dd>
|
|
|
+<p>
|
|
|
+ If you want to connect to the server secure client port, you need to set this property to
|
|
|
+ <strong>true</strong>
|
|
|
+ on the client. This will connect to server using SSL with specified credentials. Note that
|
|
|
+ it requires the Netty client.
|
|
|
+ </p>
|
|
|
+</dd>
|
|
|
+
|
|
|
+<dt>
|
|
|
+<term>zookeeper.clientCnxnSocket</term>
|
|
|
+</dt>
|
|
|
+<dd>
|
|
|
+<p>
|
|
|
+ Specifies which ClientCnxnSocket to be used. Possible values are
|
|
|
+ <strong>org.apache.zookeeper.ClientCnxnSocketNIO</strong>
|
|
|
+ and
|
|
|
+ <strong>org.apache.zookeeper.ClientCnxnSocketNetty</strong>
|
|
|
+ . Default is
|
|
|
+ <strong>org.apache.zookeeper.ClientCnxnSocketNIO</strong>
|
|
|
+ . If you want to connect to server's secure client port, you need to set this property to
|
|
|
+ <strong>org.apache.zookeeper.ClientCnxnSocketNetty</strong>
|
|
|
+ on client.
|
|
|
+ </p>
|
|
|
+</dd>
|
|
|
+
|
|
|
+<dt>
|
|
|
+<term>zookeeper.ssl.keyStore.location and zookeeper.ssl.keyStore.password</term>
|
|
|
+</dt>
|
|
|
+<dd>
|
|
|
+<p>Specifies the file path to a JKS containing the local credentials to be used for SSL connections,
|
|
|
+ and the password to unlock the file.
|
|
|
+ </p>
|
|
|
+</dd>
|
|
|
+
|
|
|
+<dt>
|
|
|
+<term>zookeeper.ssl.trustStore.location and zookeeper.ssl.trustStore.password</term>
|
|
|
+</dt>
|
|
|
+<dd>
|
|
|
+<p>Specifies the file path to a JKS containing the remote credentials to be used for SSL connections,
|
|
|
+ and the password to unlock the file.
|
|
|
+ </p>
|
|
|
+</dd>
|
|
|
+
|
|
|
+<dt>
|
|
|
+<term>jute.maxbuffer</term>
|
|
|
+</dt>
|
|
|
+<dd>
|
|
|
+<p>It specifies the maximum size of the incoming data from the server. The default value is 4194304
|
|
|
+ Bytes , or just 4 MB. This is really a sanity check. The ZooKeeper server is designed to store and send
|
|
|
+ data on the order of kilobytes. If incoming data length is more than this value, an IOException
|
|
|
+ is raised.</p>
|
|
|
+</dd>
|
|
|
+
|
|
|
+<dt>
|
|
|
+<term>zookeeper.kinit</term>
|
|
|
+</dt>
|
|
|
+<dd>
|
|
|
+<p>Specifies path to kinit binary. Default is "/usr/bin/kinit".</p>
|
|
|
+</dd>
|
|
|
+
|
|
|
+</dl>
|
|
|
<a name="C+Binding"></a>
|
|
|
<h3 class="h4">C Binding</h3>
|
|
|
<p>The C binding has a single-threaded and multi-threaded library.
|
|
@@ -2074,32 +2199,9 @@ authProvider.2=com.f.MyAuth2
|
|
|
</li>
|
|
|
|
|
|
</ol>
|
|
|
-<a name="Using+the+C+Client"></a>
|
|
|
-<h4>Using the C Client</h4>
|
|
|
-<p>You can test your client by running a ZooKeeper server (see
|
|
|
- instructions on the project wiki page on how to run it) and connecting
|
|
|
- to it using one of the cli applications that were built as part of the
|
|
|
- installation procedure. cli_mt (multithreaded, built against
|
|
|
- zookeeper_mt library) is shown in this example, but you could also use
|
|
|
- cli_st (singlethreaded, built against zookeeper_st library):</p>
|
|
|
-<p>
|
|
|
-<span class="codefrag command">$ cli_mt zookeeper_host:9876</span>
|
|
|
-</p>
|
|
|
-<p>This is a client application that gives you a shell for
|
|
|
- executing simple ZooKeeper commands. Once successfully started
|
|
|
- and connected to the server it displays a shell prompt. You
|
|
|
- can now enter ZooKeeper commands. For example, to create a
|
|
|
- node:</p>
|
|
|
-<p>
|
|
|
-<span class="codefrag command">> create /my_new_node</span>
|
|
|
-</p>
|
|
|
-<p>To verify that the node's been created:</p>
|
|
|
-<p>
|
|
|
-<span class="codefrag command">> ls /</span>
|
|
|
-</p>
|
|
|
-<p>You should see a list of node who are children of the root node
|
|
|
- "/".</p>
|
|
|
-<p>In order to be able to use the ZooKeeper API in your application
|
|
|
+<a name="Building+Your+Own+C+Client"></a>
|
|
|
+<h4>Building Your Own C Client</h4>
|
|
|
+<p>In order to be able to use the ZooKeeper C API in your application
|
|
|
you have to remember to</p>
|
|
|
<ol>
|
|
|
|
|
@@ -2124,11 +2226,14 @@ authProvider.2=com.f.MyAuth2
|
|
|
</li>
|
|
|
|
|
|
</ol>
|
|
|
-<p>Refer to <a href="#ch_programStructureWithExample">Program Structure, with Simple Example</a>
|
|
|
- for examples of usage in Java and C.
|
|
|
- <em>[tbd]</em>
|
|
|
+<div class="note">
|
|
|
+<div class="label">Note</div>
|
|
|
+<div class="content">
|
|
|
+<p>See <span class="codefrag filename">.../trunk/src/c/src/cli.c</span>
|
|
|
+ for an example of a C client implementation</p>
|
|
|
|
|
|
-</p>
|
|
|
+</div>
|
|
|
+</div>
|
|
|
</div>
|
|
|
|
|
|
|