zookeeperStarted.html 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head>
  4. <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. <meta content="Apache Forrest" name="Generator">
  6. <meta name="Forrest-version" content="0.8">
  7. <meta name="Forrest-skin-name" content="pelt">
  8. <title>ZooKeeper Getting Started Guide</title>
  9. <link type="text/css" href="skin/basic.css" rel="stylesheet">
  10. <link media="screen" type="text/css" href="skin/screen.css" rel="stylesheet">
  11. <link media="print" type="text/css" href="skin/print.css" rel="stylesheet">
  12. <link type="text/css" href="skin/profile.css" rel="stylesheet">
  13. <script src="skin/getBlank.js" language="javascript" type="text/javascript"></script><script src="skin/getMenu.js" language="javascript" type="text/javascript"></script><script src="skin/fontsize.js" language="javascript" type="text/javascript"></script>
  14. <link rel="shortcut icon" href="images/favicon.ico">
  15. </head>
  16. <body onload="init()">
  17. <script type="text/javascript">ndeSetTextSize();</script>
  18. <div id="top">
  19. <!--+
  20. |breadtrail
  21. +-->
  22. <div class="breadtrail">
  23. <a href="http://www.apache.org/">Apache</a> &gt; <a href="http://hadoop.apache.org/">Hadoop</a> &gt; <a href="http://hadoop.apache.org/zookeeper/">ZooKeeper</a><script src="skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script>
  24. </div>
  25. <!--+
  26. |header
  27. +-->
  28. <div class="header">
  29. <!--+
  30. |start group logo
  31. +-->
  32. <div class="grouplogo">
  33. <a href="http://hadoop.apache.org/"><img class="logoImage" alt="Hadoop" src="images/hadoop-logo.jpg" title="Apache Hadoop"></a>
  34. </div>
  35. <!--+
  36. |end group logo
  37. +-->
  38. <!--+
  39. |start Project Logo
  40. +-->
  41. <div class="projectlogo">
  42. <a href="http://hadoop.apache.org/zookeeper/"><img class="logoImage" alt="ZooKeeper" src="images/zookeeper_small.gif" title="ZooKeeper: distributed coordination"></a>
  43. </div>
  44. <!--+
  45. |end Project Logo
  46. +-->
  47. <!--+
  48. |start Search
  49. +-->
  50. <div class="searchbox">
  51. <form action="http://www.google.com/search" method="get" class="roundtopsmall">
  52. <input value="hadoop.apache.org" name="sitesearch" type="hidden"><input onFocus="getBlank (this, 'Search the site with google');" size="25" name="q" id="query" type="text" value="Search the site with google">&nbsp;
  53. <input name="Search" value="Search" type="submit">
  54. </form>
  55. </div>
  56. <!--+
  57. |end search
  58. +-->
  59. <!--+
  60. |start Tabs
  61. +-->
  62. <ul id="tabs">
  63. <li>
  64. <a class="unselected" href="http://hadoop.apache.org/zookeeper/">Project</a>
  65. </li>
  66. <li>
  67. <a class="unselected" href="http://wiki.apache.org/hadoop/ZooKeeper">Wiki</a>
  68. </li>
  69. <li class="current">
  70. <a class="selected" href="index.html">ZooKeeper 3.4 Documentation</a>
  71. </li>
  72. </ul>
  73. <!--+
  74. |end Tabs
  75. +-->
  76. </div>
  77. </div>
  78. <div id="main">
  79. <div id="publishedStrip">
  80. <!--+
  81. |start Subtabs
  82. +-->
  83. <div id="level2tabs"></div>
  84. <!--+
  85. |end Endtabs
  86. +-->
  87. <script type="text/javascript"><!--
  88. document.write("Last Published: " + document.lastModified);
  89. // --></script>
  90. </div>
  91. <!--+
  92. |breadtrail
  93. +-->
  94. <div class="breadtrail">
  95. &nbsp;
  96. </div>
  97. <!--+
  98. |start Menu, mainarea
  99. +-->
  100. <!--+
  101. |start Menu
  102. +-->
  103. <div id="menu">
  104. <div onclick="SwitchMenu('menu_selected_1.1', 'skin/')" id="menu_selected_1.1Title" class="menutitle" style="background-image: url('skin/images/chapter_open.gif');">Overview</div>
  105. <div id="menu_selected_1.1" class="selectedmenuitemgroup" style="display: block;">
  106. <div class="menuitem">
  107. <a href="index.html">Welcome</a>
  108. </div>
  109. <div class="menuitem">
  110. <a href="zookeeperOver.html">Overview</a>
  111. </div>
  112. <div class="menupage">
  113. <div class="menupagetitle">Getting Started</div>
  114. </div>
  115. <div class="menuitem">
  116. <a href="releasenotes.html">Release Notes</a>
  117. </div>
  118. </div>
  119. <div onclick="SwitchMenu('menu_1.2', 'skin/')" id="menu_1.2Title" class="menutitle">Developer</div>
  120. <div id="menu_1.2" class="menuitemgroup">
  121. <div class="menuitem">
  122. <a href="api/index.html">API Docs</a>
  123. </div>
  124. <div class="menuitem">
  125. <a href="zookeeperProgrammers.html">Programmer's Guide</a>
  126. </div>
  127. <div class="menuitem">
  128. <a href="javaExample.html">Java Example</a>
  129. </div>
  130. <div class="menuitem">
  131. <a href="zookeeperTutorial.html">Barrier and Queue Tutorial</a>
  132. </div>
  133. <div class="menuitem">
  134. <a href="recipes.html">Recipes</a>
  135. </div>
  136. </div>
  137. <div onclick="SwitchMenu('menu_1.3', 'skin/')" id="menu_1.3Title" class="menutitle">BookKeeper</div>
  138. <div id="menu_1.3" class="menuitemgroup">
  139. <div class="menuitem">
  140. <a href="bookkeeperStarted.html">Getting started</a>
  141. </div>
  142. <div class="menuitem">
  143. <a href="bookkeeperOverview.html">Overview</a>
  144. </div>
  145. <div class="menuitem">
  146. <a href="bookkeeperConfig.html">Setup guide</a>
  147. </div>
  148. <div class="menuitem">
  149. <a href="bookkeeperProgrammer.html">Programmer's guide</a>
  150. </div>
  151. </div>
  152. <div onclick="SwitchMenu('menu_1.4', 'skin/')" id="menu_1.4Title" class="menutitle">Admin &amp; Ops</div>
  153. <div id="menu_1.4" class="menuitemgroup">
  154. <div class="menuitem">
  155. <a href="zookeeperAdmin.html">Administrator's Guide</a>
  156. </div>
  157. <div class="menuitem">
  158. <a href="zookeeperQuotas.html">Quota Guide</a>
  159. </div>
  160. <div class="menuitem">
  161. <a href="zookeeperJMX.html">JMX</a>
  162. </div>
  163. <div class="menuitem">
  164. <a href="zookeeperObservers.html">Observers Guide</a>
  165. </div>
  166. </div>
  167. <div onclick="SwitchMenu('menu_1.5', 'skin/')" id="menu_1.5Title" class="menutitle">Contributor</div>
  168. <div id="menu_1.5" class="menuitemgroup">
  169. <div class="menuitem">
  170. <a href="zookeeperInternals.html">ZooKeeper Internals</a>
  171. </div>
  172. </div>
  173. <div onclick="SwitchMenu('menu_1.6', 'skin/')" id="menu_1.6Title" class="menutitle">Miscellaneous</div>
  174. <div id="menu_1.6" class="menuitemgroup">
  175. <div class="menuitem">
  176. <a href="http://wiki.apache.org/hadoop/ZooKeeper">Wiki</a>
  177. </div>
  178. <div class="menuitem">
  179. <a href="http://wiki.apache.org/hadoop/ZooKeeper/FAQ">FAQ</a>
  180. </div>
  181. <div class="menuitem">
  182. <a href="http://hadoop.apache.org/zookeeper/mailing_lists.html">Mailing Lists</a>
  183. </div>
  184. </div>
  185. <div id="credit"></div>
  186. <div id="roundbottom">
  187. <img style="display: none" class="corner" height="15" width="15" alt="" src="skin/images/rc-b-l-15-1body-2menu-3menu.png"></div>
  188. <!--+
  189. |alternative credits
  190. +-->
  191. <div id="credit2"></div>
  192. </div>
  193. <!--+
  194. |end Menu
  195. +-->
  196. <!--+
  197. |start content
  198. +-->
  199. <div id="content">
  200. <div title="Portable Document Format" class="pdflink">
  201. <a class="dida" href="zookeeperStarted.pdf"><img alt="PDF -icon" src="skin/images/pdfdoc.gif" class="skin"><br>
  202. PDF</a>
  203. </div>
  204. <h1>ZooKeeper Getting Started Guide</h1>
  205. <div id="minitoc-area">
  206. <ul class="minitoc">
  207. <li>
  208. <a href="#ch_GettingStarted">Getting Started: Coordinating Distributed Applications with
  209. ZooKeeper</a>
  210. <ul class="minitoc">
  211. <li>
  212. <a href="#sc_Prerequisites">Pre-requisites</a>
  213. </li>
  214. <li>
  215. <a href="#sc_Download">Download</a>
  216. </li>
  217. <li>
  218. <a href="#sc_InstallingSingleMode">Standalone Operation</a>
  219. </li>
  220. <li>
  221. <a href="#sc_FileManagement">Managing ZooKeeper Storage</a>
  222. </li>
  223. <li>
  224. <a href="#sc_ConnectingToZooKeeper">Connecting to ZooKeeper</a>
  225. </li>
  226. <li>
  227. <a href="#sc_ProgrammingToZooKeeper">Programming to ZooKeeper</a>
  228. </li>
  229. <li>
  230. <a href="#sc_RunningReplicatedZooKeeper">Running Replicated ZooKeeper</a>
  231. </li>
  232. <li>
  233. <a href="#Other+Optimizations">Other Optimizations</a>
  234. </li>
  235. </ul>
  236. </li>
  237. </ul>
  238. </div>
  239. <a name="N10009"></a><a name="ch_GettingStarted"></a>
  240. <h2 class="h3">Getting Started: Coordinating Distributed Applications with
  241. ZooKeeper</h2>
  242. <div class="section">
  243. <p>This document contains information to get you started quickly with
  244. ZooKeeper. It is aimed primarily at developers hoping to try it out, and
  245. contains simple installation instructions for a single ZooKeeper server, a
  246. few commands to verify that it is running, and a simple programming
  247. example. Finally, as a convenience, there are a few sections regarding
  248. more complicated installations, for example running replicated
  249. deployments, and optimizing the transaction log. However for the complete
  250. instructions for commercial deployments, please refer to the <a href="zookeeperAdmin.html">ZooKeeper
  251. Administrator's Guide</a>.</p>
  252. <a name="N10016"></a><a name="sc_Prerequisites"></a>
  253. <h3 class="h4">Pre-requisites</h3>
  254. <p>See <a href="zookeeperAdmin.html#sc_systemReq">
  255. System Requirements</a> in the Admin guide.</p>
  256. <a name="N10024"></a><a name="sc_Download"></a>
  257. <h3 class="h4">Download</h3>
  258. <p>To get a ZooKeeper distribution, download a recent
  259. <a href="http://hadoop.apache.org/zookeeper/releases.html">
  260. stable</a> release from one of the Apache Download
  261. Mirrors.</p>
  262. <a name="N10032"></a><a name="sc_InstallingSingleMode"></a>
  263. <h3 class="h4">Standalone Operation</h3>
  264. <p>Setting up a ZooKeeper server in standalone mode is
  265. straightforward. The server is contained in a single JAR file,
  266. so installation consists of creating a configuration.</p>
  267. <p>Once you've downloaded a stable ZooKeeper release unpack
  268. it and cd to the root</p>
  269. <p>To start ZooKeeper you need a configuration file. Here is a sample,
  270. create it in <strong>conf/zoo.cfg</strong>:</p>
  271. <pre class="code">
  272. tickTime=2000
  273. dataDir=/var/zookeeper
  274. clientPort=2181
  275. </pre>
  276. <p>This file can be called anything, but for the sake of this
  277. discussion call
  278. it <strong>conf/zoo.cfg</strong>. Change the
  279. value of <strong>dataDir</strong> to specify an
  280. existing (empty to start with) directory. Here are the meanings
  281. for each of the fields:</p>
  282. <dl>
  283. <dt>
  284. <term>
  285. <strong>tickTime</strong>
  286. </term>
  287. </dt>
  288. <dd>
  289. <p>the basic time unit in milliseconds used by ZooKeeper. It is
  290. used to do heartbeats and the minimum session timeout will be
  291. twice the tickTime.</p>
  292. </dd>
  293. </dl>
  294. <dl>
  295. <dt>
  296. <term>
  297. <strong>dataDir</strong>
  298. </term>
  299. </dt>
  300. <dd>
  301. <p>the location to store the in-memory database snapshots and,
  302. unless specified otherwise, the transaction log of updates to the
  303. database.</p>
  304. </dd>
  305. <dt>
  306. <term>
  307. <strong>clientPort</strong>
  308. </term>
  309. </dt>
  310. <dd>
  311. <p>the port to listen for client connections</p>
  312. </dd>
  313. </dl>
  314. <p>Now that you created the configuration file, you can start
  315. ZooKeeper:</p>
  316. <pre class="code">bin/zkServer.sh start</pre>
  317. <p>ZooKeeper logs messages using log4j -- more detail
  318. available in the
  319. <a href="zookeeperProgrammers.html#Logging">Logging</a>
  320. section of the Programmer's Guide. You will see log messages
  321. coming to the console (default) and/or a log file depending on
  322. the log4j configuration.</p>
  323. <p>The steps outlined here run ZooKeeper in standalone mode. There is
  324. no replication, so if ZooKeeper process fails, the service will go down.
  325. This is fine for most development situations, but to run ZooKeeper in
  326. replicated mode, please see <a href="#sc_RunningReplicatedZooKeeper">Running Replicated
  327. ZooKeeper</a>.</p>
  328. <a name="N10083"></a><a name="sc_FileManagement"></a>
  329. <h3 class="h4">Managing ZooKeeper Storage</h3>
  330. <p>For long running production systems ZooKeeper storage must
  331. be managed externally (dataDir and logs). See the section on
  332. <a href="zookeeperAdmin.html#sc_maintenance">maintenance</a> for
  333. more details.</p>
  334. <a name="N10091"></a><a name="sc_ConnectingToZooKeeper"></a>
  335. <h3 class="h4">Connecting to ZooKeeper</h3>
  336. <p>Once ZooKeeper is running, you have several options for connection
  337. to it:</p>
  338. <ul>
  339. <li>
  340. <p>
  341. <strong>Java</strong>: Use</p>
  342. <pre class="code">bin/zkCli.sh -server 127.0.0.1:2181</pre>
  343. <p>This lets you perform simple, file-like operations.</p>
  344. </li>
  345. <li>
  346. <p>
  347. <strong>C</strong>: compile cli_mt
  348. (multi-threaded) or cli_st (single-threaded) by running
  349. <span class="codefrag command">make cli_mt</span> or <span class="codefrag command">make
  350. cli_st</span> in
  351. the <strong>src/c</strong> subdirectory in
  352. the ZooKeeper sources. See the README contained within
  353. <strong>src/c</strong> for full details.</p>
  354. <p>You can run the program
  355. from <strong>src/c</strong> using:</p>
  356. <pre class="code">LD_LIBRARY_PATH=. cli_mt 127.0.0.1:2181</pre>
  357. <p>or</p>
  358. <pre class="code">LD_LIBRARY_PATH=. cli_st 127.0.0.1:2181</pre>
  359. <p>This will give you a simple shell to execute file
  360. system like operations on ZooKeeper.</p>
  361. </li>
  362. </ul>
  363. <p>Once you have connected, you should see something like:
  364. </p>
  365. <pre class="code">
  366. Connecting to localhost:2181
  367. log4j:WARN No appenders could be found for logger (org.apache.zookeeper.ZooKeeper).
  368. log4j:WARN Please initialize the log4j system properly.
  369. Welcome to ZooKeeper!
  370. JLine support is enabled
  371. [zkshell: 0]
  372. </pre>
  373. <p>
  374. From the shell, type <span class="codefrag command">help</span> to get a listing of commands that can be executed from the client, as in:
  375. </p>
  376. <pre class="code">
  377. [zkshell: 0] help
  378. ZooKeeper host:port cmd args
  379. get path [watch]
  380. ls path [watch]
  381. set path data [version]
  382. delquota [-n|-b] path
  383. quit
  384. printwatches on|off
  385. createpath data acl
  386. stat path [watch]
  387. listquota path
  388. history
  389. setAcl path acl
  390. getAcl path
  391. sync path
  392. redo cmdno
  393. addauth scheme auth
  394. delete path [version]
  395. setquota -n|-b val path
  396. </pre>
  397. <p>From here, you can try a few simple commands to get a feel for this simple command line interface. First, start by issuing the list command, as
  398. in <span class="codefrag command">ls</span>, yielding:
  399. </p>
  400. <pre class="code">
  401. [zkshell: 8] ls /
  402. [zookeeper]
  403. </pre>
  404. <p>Next, create a new znode by running <span class="codefrag command">create /zk_test my_data</span>. This creates a new znode and associates the string "my_data" with the node.
  405. You should see:</p>
  406. <pre class="code">
  407. [zkshell: 9] create /zk_test my_data
  408. Created /zk_test
  409. </pre>
  410. <p> Issue another <span class="codefrag command">ls /</span> command to see what the directory looks like:
  411. </p>
  412. <pre class="code">
  413. [zkshell: 11] ls /
  414. [zookeeper, zk_test]
  415. </pre>
  416. <p>
  417. Notice that the zk_test directory has now been created.
  418. </p>
  419. <p>Next, verify that the data was associated with the znode by running the <span class="codefrag command">get</span> command, as in:
  420. </p>
  421. <pre class="code">
  422. [zkshell: 12] get /zk_test
  423. my_data
  424. cZxid = 5
  425. ctime = Fri Jun 05 13:57:06 PDT 2009
  426. mZxid = 5
  427. mtime = Fri Jun 05 13:57:06 PDT 2009
  428. pZxid = 5
  429. cversion = 0
  430. dataVersion = 0
  431. aclVersion = 0
  432. ephemeralOwner = 0
  433. dataLength = 7
  434. numChildren = 0
  435. </pre>
  436. <p>We can change the data associated with zk_test by issuing the <span class="codefrag command">set</span> command, as in:
  437. </p>
  438. <pre class="code">
  439. [zkshell: 14] set /zk_test junk
  440. cZxid = 5
  441. ctime = Fri Jun 05 13:57:06 PDT 2009
  442. mZxid = 6
  443. mtime = Fri Jun 05 14:01:52 PDT 2009
  444. pZxid = 5
  445. cversion = 0
  446. dataVersion = 1
  447. aclVersion = 0
  448. ephemeralOwner = 0
  449. dataLength = 4
  450. numChildren = 0
  451. [zkshell: 15] get /zk_test
  452. junk
  453. cZxid = 5
  454. ctime = Fri Jun 05 13:57:06 PDT 2009
  455. mZxid = 6
  456. mtime = Fri Jun 05 14:01:52 PDT 2009
  457. pZxid = 5
  458. cversion = 0
  459. dataVersion = 1
  460. aclVersion = 0
  461. ephemeralOwner = 0
  462. dataLength = 4
  463. numChildren = 0
  464. </pre>
  465. <p>
  466. (Notice we did a <span class="codefrag command">get</span> after setting the data and it did, indeed, change.</p>
  467. <p>Finally, let's <span class="codefrag command">delete</span> the node by issuing:
  468. </p>
  469. <pre class="code">
  470. [zkshell: 16] delete /zk_test
  471. [zkshell: 17] ls /
  472. [zookeeper]
  473. [zkshell: 18]
  474. </pre>
  475. <p>That's it for now. To explore more, continue with the rest of this document and see the <a href="zookeeperProgrammers.html">Programmer's Guide</a>. </p>
  476. <a name="N10130"></a><a name="sc_ProgrammingToZooKeeper"></a>
  477. <h3 class="h4">Programming to ZooKeeper</h3>
  478. <p>ZooKeeper has a Java bindings and C bindings. They are
  479. functionally equivalent. The C bindings exist in two variants: single
  480. threaded and multi-threaded. These differ only in how the messaging loop
  481. is done. For more information, see the <a href="zookeeperProgrammers.html#ch_programStructureWithExample">Programming
  482. Examples in the ZooKeeper Programmer's Guide</a> for
  483. sample code using of the different APIs.</p>
  484. <a name="N1013E"></a><a name="sc_RunningReplicatedZooKeeper"></a>
  485. <h3 class="h4">Running Replicated ZooKeeper</h3>
  486. <p>Running ZooKeeper in standalone mode is convenient for evaluation,
  487. some development, and testing. But in production, you should run
  488. ZooKeeper in replicated mode. A replicated group of servers in the same
  489. application is called a <em>quorum</em>, and in replicated
  490. mode, all servers in the quorum have copies of the same configuration
  491. file. The file is similar to the one used in standalone mode, but with a
  492. few differences. Here is an example:</p>
  493. <pre class="code">
  494. tickTime=2000
  495. dataDir=/var/zookeeper
  496. clientPort=2181
  497. initLimit=5
  498. syncLimit=2
  499. server.1=zoo1:2888:3888
  500. server.2=zoo2:2888:3888
  501. server.3=zoo3:2888:3888
  502. </pre>
  503. <p>The new entry, <strong>initLimit</strong> is
  504. timeouts ZooKeeper uses to limit the length of time the ZooKeeper
  505. servers in quorum have to connect to a leader. The entry <strong>syncLimit</strong> limits how far out of date a server can
  506. be from a leader.</p>
  507. <p>With both of these timeouts, you specify the unit of time using
  508. <strong>tickTime</strong>. In this example, the timeout
  509. for initLimit is 5 ticks at 2000 milleseconds a tick, or 10
  510. seconds.</p>
  511. <p>The entries of the form <em>server.X</em> list the
  512. servers that make up the ZooKeeper service. When the server starts up,
  513. it knows which server it is by looking for the file
  514. <em>myid</em> in the data directory. That file has the
  515. contains the server number, in ASCII.</p>
  516. <p>Finally, note the two port numbers after each server
  517. name: " 2888" and "3888". Peers use the former port to connect
  518. to other peers. Such a connection is necessary so that peers
  519. can communicate, for example, to agree upon the order of
  520. updates. More specifically, a ZooKeeper server uses this port
  521. to connect followers to the leader. When a new leader arises, a
  522. follower opens a TCP connection to the leader using this
  523. port. Because the default leader election also uses TCP, we
  524. currently require another port for leader election. This is the
  525. second port in the server entry.
  526. </p>
  527. <div class="note">
  528. <div class="label">Note</div>
  529. <div class="content">
  530. <p>If you want to test multiple servers on a single
  531. machine, specify the servername
  532. as <em>localhost</em> with unique quorum &amp;
  533. leader election ports (i.e. 2888:3888, 2889:3889, 2890:3890 in
  534. the example above) for each server.X in that server's config
  535. file. Of course separate <em>dataDir</em>s and
  536. distinct <em>clientPort</em>s are also necessary
  537. (in the above replicated example, running on a
  538. single <em>localhost</em>, you would still have
  539. three config files).</p>
  540. </div>
  541. </div>
  542. <a name="N1017B"></a><a name="Other+Optimizations"></a>
  543. <h3 class="h4">Other Optimizations</h3>
  544. <p>There are a couple of other configuration parameters that can
  545. greatly increase performance:</p>
  546. <ul>
  547. <li>
  548. <p>To get low latencies on updates it is important to
  549. have a dedicated transaction log directory. By default
  550. transaction logs are put in the same directory as the data
  551. snapshots and <em>myid</em> file. The dataLogDir
  552. parameters indicates a different directory to use for the
  553. transaction logs.</p>
  554. </li>
  555. <li>
  556. <p>
  557. <em>[tbd: what is the other config param?]</em>
  558. </p>
  559. </li>
  560. </ul>
  561. </div>
  562. <p align="right">
  563. <font size="-2"></font>
  564. </p>
  565. </div>
  566. <!--+
  567. |end content
  568. +-->
  569. <div class="clearboth">&nbsp;</div>
  570. </div>
  571. <div id="footer">
  572. <!--+
  573. |start bottomstrip
  574. +-->
  575. <div class="lastmodified">
  576. <script type="text/javascript"><!--
  577. document.write("Last Published: " + document.lastModified);
  578. // --></script>
  579. </div>
  580. <div class="copyright">
  581. Copyright &copy;
  582. 2008 <a href="http://www.apache.org/licenses/">The Apache Software Foundation.</a>
  583. </div>
  584. <!--+
  585. |end bottomstrip
  586. +-->
  587. </div>
  588. </body>
  589. </html>