Added: helix/site-content/1.0.3-docs/recipes/lock_manager.html
URL: 
http://svn.apache.org/viewvc/helix/site-content/1.0.3-docs/recipes/lock_manager.html?rev=1900184&view=auto
==============================================================================
--- helix/site-content/1.0.3-docs/recipes/lock_manager.html (added)
+++ helix/site-content/1.0.3-docs/recipes/lock_manager.html Sat Apr 23 04:22:15 
2022
@@ -0,0 +1,366 @@
+<!DOCTYPE html>
+
+
+<!--
+ | Generated by Apache Maven Doxia Site Renderer 1.11.1 from 
src/site/markdown/recipes/lock_manager.md at 2022-04-23
+ | Rendered using Apache Maven Fluido Skin 1.11.0-SNAPSHOT
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"; lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1" />
+    <meta name="generator" content="Apache Maven Doxia Site Renderer 1.11.1" />
+    <title>Apache Helix &#x2013; Distributed Lock Manager</title>
+    <link rel="stylesheet" 
href="../css/apache-maven-fluido-1.11.0-SNAPSHOT.min.css" />
+    <link rel="stylesheet" href="../css/site.css" />
+    <link rel="stylesheet" href="../css/print.css" media="print" />
+    <script src="../js/apache-maven-fluido-1.11.0-SNAPSHOT.min.js"></script>
+<script type="text/javascript">
+
+        var _gaq = _gaq || [];
+        _gaq.push(['_setAccount', 'UA-3211522-12']);
+        _gaq.push(['_trackPageview']);
+
+        (function() {
+        var ga = document.createElement('script'); ga.type = 
'text/javascript'; ga.async = true;
+        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 
'http://www') + '.google-analytics.com/ga.js';
+        var s = document.getElementsByTagName('script')[0]; 
s.parentNode.insertBefore(ga, s);
+        })();
+
+      </script>
+  </head>
+  <body class="topBarEnabled">
+    <header id="topbar" class="navbar navbar-fixed-top ">
+      <div class="navbar-inner">
+        <div class="container-fluid">
+        <a data-target=".nav-collapse" data-toggle="collapse" class="btn 
btn-navbar">
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+        </a>
+            <ul class="nav">
+      <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Get Helix 
<b class="caret"></b></a>
+        <ul class="dropdown-menu">
+            <li><a href="../download.html" title="Download">Download</a></li>
+            <li><a href="../Building.html" title="Building">Building</a></li>
+            <li><a href="../releasenotes/release-1.0.3.html" title="Release 
Notes">Release Notes</a></li>
+        </ul>
+      </li>
+      <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Hands-On <b 
class="caret"></b></a>
+        <ul class="dropdown-menu">
+            <li><a href="../Quickstart.html" title="Quick Start">Quick 
Start</a></li>
+            <li><a href="../Tutorial.html" title="Tutorial">Tutorial</a></li>
+            <li><a href="../../javadocs/1.0.3" 
title="Javadocs">Javadocs</a></li>
+        </ul>
+      </li>
+      <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Recipes <b 
class="caret"></b></a>
+        <ul class="dropdown-menu">
+            <li><a href="../recipes/lock_manager.html" title="Distributed lock 
manager">Distributed lock manager</a></li>
+            <li><a href="../recipes/rabbitmq_consumer_group.html" 
title="Rabbit MQ consumer group">Rabbit MQ consumer group</a></li>
+            <li><a href="../recipes/rsync_replicated_file_store.html" 
title="Rsync replicated file store">Rsync replicated file store</a></li>
+            <li><a href="../recipes/service_discovery.html" title="Service 
discovery">Service discovery</a></li>
+            <li><a href="../recipes/task_dag_execution.html" 
title="Distributed task DAG execution">Distributed task DAG execution</a></li>
+        </ul>
+      </li>
+            </ul>
+            <ul class="nav pull-right">
+              <li class="dropdown">
+                <a href="#" class="dropdown-toggle" 
data-toggle="dropdown">External Links <b class="caret"></b></a>
+                <ul class="dropdown-menu">
+    <li><a href="../index.html" title="Helix 1.0.3">Helix 1.0.3</a></li>
+                </ul>
+              </li>
+            </ul>
+        </div>
+      </div>
+    </header>
+    <div class="container-fluid">
+      <header>
+        <div id="banner">
+          <div class="pull-left"><a href="http://helix.apache.org/"; 
id="bannerLeft"><img src="../../images/helix-logo.jpg"  alt=""/></a></div>
+          <div class="pull-right"><a href="http://www.apache.org/"; 
id="bannerRight"><img src="../../images/feather_small.gif"  alt=""/></a></div>
+          <div class="clear"><hr/></div>
+        </div>
+
+        <div id="breadcrumbs">
+          <ul class="breadcrumb">
+      <li class=""><a href="http://helix.apache.org/"; class="externalLink" 
title="Apache Helix">Apache Helix</a><span class="divider">/</span></li>
+      <li class=""><a href="../../" title="Apache Helix">Apache Helix</a><span 
class="divider">/</span></li>
+      <li class=""><a href=".././" title="Release 1.0.3">Release 
1.0.3</a><span class="divider">/</span></li>
+    <li class="active ">Distributed Lock Manager</li>
+        <li id="publishDate" class="pull-right">Last Published: 2022-04-23</li>
+          </ul>
+        </div>
+      </header>
+      <div class="row-fluid">
+        <header id="leftColumn" class="span2">
+          <nav class="well sidebar-nav">
+  <ul class="nav nav-list">
+   <li class="nav-header">Get Helix</li>
+    <li><a href="../download.html" title="Download"><span 
class="none"></span>Download</a></li>
+    <li><a href="../Building.html" title="Building"><span 
class="none"></span>Building</a></li>
+    <li><a href="../releasenotes/release-1.0.3.html" title="Release 
Notes"><span class="none"></span>Release Notes</a></li>
+   <li class="nav-header">Hands-On</li>
+    <li><a href="../Quickstart.html" title="Quick Start"><span 
class="none"></span>Quick Start</a></li>
+    <li><a href="../Tutorial.html" title="Tutorial"><span 
class="none"></span>Tutorial</a></li>
+    <li><a href="../../javadocs/1.0.3" title="Javadocs"><span 
class="none"></span>Javadocs</a></li>
+   <li class="nav-header">Recipes</li>
+    <li class="active"><a href="#"><span class="none"></span>Distributed lock 
manager</a></li>
+    <li><a href="../recipes/rabbitmq_consumer_group.html" title="Rabbit MQ 
consumer group"><span class="none"></span>Rabbit MQ consumer group</a></li>
+    <li><a href="../recipes/rsync_replicated_file_store.html" title="Rsync 
replicated file store"><span class="none"></span>Rsync replicated file 
store</a></li>
+    <li><a href="../recipes/service_discovery.html" title="Service 
discovery"><span class="none"></span>Service discovery</a></li>
+    <li><a href="../recipes/task_dag_execution.html" title="Distributed task 
DAG execution"><span class="none"></span>Distributed task DAG execution</a></li>
+  </ul>
+          </nav>
+          <div class="well sidebar-nav">
+<form id="search-form" action="https://www.google.com/search"; method="get" >
+  <input value="helix.apache.org/1.0.3-docs" name="sitesearch" type="hidden"/>
+  <input class="search-query" name="q" id="query" type="text" />
+</form>
+<script>asyncJs( 'https://cse.google.com/brand?form=search-form' )</script>
+            <hr />
+            <div id="poweredBy">
+              <div class="clear"></div>
+    <div id="twitter" style="border:none; margin-top: 10px">
+    <a href="https://twitter.com/ApacheHelix"; class="twitter-follow-button" 
data-show-count="false" data-align="left" data-size="medium" 
data-show-screen-name="true" data-lang="en">Follow ApacheHelix</a>
+    <script>!function(d,s,id){var 
js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
+    </div>
+              <div class="clear"></div>
+              <div class="clear"></div>
+<a href="http://maven.apache.org/"; title="Built by Maven" 
class="poweredBy"><img class="builtBy" alt="Built by Maven" 
src="../images/logos/maven-feather.png" /></a>
+            </div>
+          </div>
+        </header>
+        <main id="bodyColumn"  class="span10" >
+<!---
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<section>
+<h2><a name="Distributed_Lock_Manager"></a>Distributed Lock Manager</h2>
+<p>Distributed locks are used to synchronize accesses shared resources. Most 
applications today use ZooKeeper to model distributed locks.</p>
+<p>The simplest way to model a lock using ZooKeeper is (See ZooKeeper leader 
recipe for an exact and more advanced solution)</p>
+<ul>
+
+<li>Each process tries to create an emphemeral node</li>
+<li>If the node is successfully created, the process acquires the lock</li>
+<li>Otherwise, it will watch the ZNode and try to acquire the lock again if 
the current lock holder disappears</li>
+</ul>
+<p>This is good enough if there is only one lock. But in practice, an 
application will need many such locks. Distributing and managing the locks 
among difference process becomes challenging. Extending such a solution to many 
locks will result in:</p>
+<ul>
+
+<li>Uneven distribution of locks among nodes; the node that starts first will 
acquire all the locks. Nodes that start later will be idle.</li>
+<li>When a node fails, how the locks will be distributed among remaining nodes 
is not predicable.</li>
+<li>When new nodes are added the current nodes don't relinquish the locks so 
that new nodes can acquire some locks</li>
+</ul>
+<p>In other words we want a system to satisfy the following requirements.</p>
+<ul>
+
+<li>Distribute locks evenly among all nodes to get better hardware 
utilization</li>
+<li>If a node fails, the locks that were acquired by that node should be 
evenly distributed among other nodes</li>
+<li>If nodes are added, locks must be evenly re-distributed among nodes.</li>
+</ul>
+<p>Helix provides a simple and elegant solution to this problem. Simply 
specify the number of locks and Helix will ensure that above constraints are 
satisfied.</p>
+<p>To quickly see this working run the <code>lock-manager-demo</code> script 
where 12 locks are evenly distributed among three nodes, and when a node fails, 
the locks get re-distributed among remaining two nodes. Note that Helix does 
not re-shuffle the locks completely, instead it simply distributes the locks 
relinquished by dead node among 2 remaining nodes evenly.</p><hr /><section>
+<h3><a name="Short_Version"></a>Short Version</h3>
+<p>This version starts multiple threads within the same process to simulate a 
multi node deployment. Try the long version to get a better idea of how it 
works.</p>
+
+<div class="source"><pre class="prettyprint"><code>git clone 
https://git-wip-us.apache.org/repos/asf/helix.git
+cd helix
+git checkout tags/helix-1.0.3
+mvn clean install package -DskipTests
+cd recipes/distributed-lock-manager/target/distributed-lock-manager-pkg/bin
+chmod +x *
+./lock-manager-demo
+</code></pre></div><section>
+<h4><a name="Output"></a>Output</h4>
+
+<div class="source"><pre class="prettyprint"><code>./lock-manager-demo
+STARTING localhost_12000
+STARTING localhost_12002
+STARTING localhost_12001
+STARTED localhost_12000
+STARTED localhost_12002
+STARTED localhost_12001
+localhost_12001 acquired lock:lock-group_3
+localhost_12000 acquired lock:lock-group_8
+localhost_12001 acquired lock:lock-group_2
+localhost_12001 acquired lock:lock-group_4
+localhost_12002 acquired lock:lock-group_1
+localhost_12002 acquired lock:lock-group_10
+localhost_12000 acquired lock:lock-group_7
+localhost_12001 acquired lock:lock-group_5
+localhost_12002 acquired lock:lock-group_11
+localhost_12000 acquired lock:lock-group_6
+localhost_12002 acquired lock:lock-group_0
+localhost_12000 acquired lock:lock-group_9
+lockName    acquired By
+======================================
+lock-group_0    localhost_12002
+lock-group_1    localhost_12002
+lock-group_10    localhost_12002
+lock-group_11    localhost_12002
+lock-group_2    localhost_12001
+lock-group_3    localhost_12001
+lock-group_4    localhost_12001
+lock-group_5    localhost_12001
+lock-group_6    localhost_12000
+lock-group_7    localhost_12000
+lock-group_8    localhost_12000
+lock-group_9    localhost_12000
+Stopping localhost_12000
+localhost_12000 Interrupted
+localhost_12001 acquired lock:lock-group_9
+localhost_12001 acquired lock:lock-group_8
+localhost_12002 acquired lock:lock-group_6
+localhost_12002 acquired lock:lock-group_7
+lockName    acquired By
+======================================
+lock-group_0    localhost_12002
+lock-group_1    localhost_12002
+lock-group_10    localhost_12002
+lock-group_11    localhost_12002
+lock-group_2    localhost_12001
+lock-group_3    localhost_12001
+lock-group_4    localhost_12001
+lock-group_5    localhost_12001
+lock-group_6    localhost_12002
+lock-group_7    localhost_12002
+lock-group_8    localhost_12001
+lock-group_9    localhost_12001
+
+</code></pre></div><hr /></section></section><section>
+<h3><a name="Long_version"></a>Long version</h3>
+<p>This provides more details on how to setup the cluster and where to plugin 
application code.</p><section>
+<h4><a name="Start_ZooKeeper"></a>Start ZooKeeper</h4>
+
+<div class="source"><pre 
class="prettyprint"><code>./start-standalone-zookeeper 2199
+</code></pre></div></section><section>
+<h4><a name="Create_a_Cluster"></a>Create a Cluster</h4>
+
+<div class="source"><pre class="prettyprint"><code>./helix-admin --zkSvr 
localhost:2199 --addCluster lock-manager-demo
+</code></pre></div></section><section>
+<h4><a name="Create_a_Lock_Group"></a>Create a Lock Group</h4>
+<p>Create a lock group and specify the number of locks in the lock group.</p>
+
+<div class="source"><pre class="prettyprint"><code>./helix-admin --zkSvr 
localhost:2199  --addResource lock-manager-demo lock-group 6 OnlineOffline 
--mode AUTO_REBALANCE
+</code></pre></div></section><section>
+<h4><a name="Start_the_Nodes"></a>Start the Nodes</h4>
+<p>Create a Lock class that handles the callbacks.</p>
+
+<div class="source"><pre class="prettyprint"><code>public class Lock extends 
StateModel {
+  private String lockName;
+
+  public Lock(String lockName) {
+    this.lockName = lockName;
+  }
+
+  public void lock(Message m, NotificationContext context) {
+    System.out.println(&quot; acquired lock:&quot;+ lockName );
+  }
+
+  public void release(Message m, NotificationContext context) {
+    System.out.println(&quot; releasing lock:&quot;+ lockName );
+  }
+
+}
+</code></pre></div>
+<p>and a LockFactory that creates Locks</p>
+
+<div class="source"><pre class="prettyprint"><code>public class LockFactory 
extends StateModelFactory&lt;Lock&gt; {
+    /* Instantiates the lock handler, one per lockName */
+    public Lock create(String lockName) {
+        return new Lock(lockName);
+    }
+}
+</code></pre></div>
+<p>At node start up, simply join the cluster and Helix will invoke the 
appropriate callbacks on the appropriate Lock instance. One can start any 
number of nodes and Helix detects that a new node has joined the cluster and 
re-distributes the locks automatically.</p>
+
+<div class="source"><pre class="prettyprint"><code>public class LockProcess {
+  public static void main(String args) {
+    String zkAddress= &quot;localhost:2199&quot;;
+    String clusterName = &quot;lock-manager-demo&quot;;
+    //Give a unique id to each process, most commonly used format hostname_port
+    String instanceName =&quot;localhost_12000&quot;;
+    ZKHelixAdmin helixAdmin = new ZKHelixAdmin(zkAddress);
+    //configure the instance and provide some metadata
+    InstanceConfig config = new InstanceConfig(instanceName);
+    config.setHostName(&quot;localhost&quot;);
+    config.setPort(&quot;12000&quot;);
+    admin.addInstance(clusterName, config);
+    //join the cluster
+    HelixManager manager;
+    manager = HelixManagerFactory.getHelixManager(clusterName,
+                                                  instanceName,
+                                                  InstanceType.PARTICIPANT,
+                                                  zkAddress);
+    
manager.getStateMachineEngine().registerStateModelFactory(&quot;OnlineOffline&quot;,
 modelFactory);
+    manager.connect();
+    Thread.currentThread.join();
+  }
+}
+</code></pre></div></section><section>
+<h4><a name="Start_the_Controller"></a>Start the Controller</h4>
+<p>The controller can be started either as a separate process or can be 
embedded within each node process</p><section>
+<h5><a name="Separate_Process"></a>Separate Process</h5>
+<p>This is recommended when number of nodes in the cluster &gt; 100. For fault 
tolerance, you can run multiple controllers on different boxes.</p>
+
+<div class="source"><pre class="prettyprint"><code>./run-helix-controller 
--zkSvr localhost:2199 --cluster lock-manager-demo 2&gt;&amp;1 &gt; 
/tmp/controller.log &amp;
+</code></pre></div></section><section>
+<h5><a name="Embedded_Within_the_Node_Process"></a>Embedded Within the Node 
Process</h5>
+<p>This is recommended when the number of nodes in the cluster is less than 
100. To start a controller from each process, simply add the following lines to 
MyClass</p>
+
+<div class="source"><pre class="prettyprint"><code>public class LockProcess {
+  public static void main(String args) {
+    String zkAddress= &quot;localhost:2199&quot;;
+    String clusterName = &quot;lock-manager-demo&quot;;
+    // .
+    // .
+    manager.connect();
+    HelixManager controller;
+    controller = HelixControllerMain.startHelixController(zkAddress,
+                                                          clusterName,
+                                                          
&quot;controller&quot;,
+                                                          
HelixControllerMain.STANDALONE);
+    Thread.currentThread.join();
+  }
+}
+</code></pre></div></section></section></section></section>
+        </main>
+      </div>
+    </div>
+    <hr/>
+    <footer>
+      <div class="container-fluid">
+        <div class="row-fluid">
+<div class="row span16"><div>Apache Helix, Apache, the Apache feather logo, 
and the Apache Helix project logos are trademarks of The Apache Software 
Foundation.
+        All other marks mentioned may be trademarks or registered trademarks 
of their respective owners.</div>
+        <a 
href="https://helix.apache.org/1.0.3-docs/privacy-policy.html";>Privacy 
Policy</a>
+      </div>
+        </div>
+      </div>
+    </footer>
+<script>
+       if(anchors) {
+         anchors.add();
+       }
+</script>
+  </body>
+</html>
\ No newline at end of file

Added: helix/site-content/1.0.3-docs/recipes/rabbitmq_consumer_group.html
URL: 
http://svn.apache.org/viewvc/helix/site-content/1.0.3-docs/recipes/rabbitmq_consumer_group.html?rev=1900184&view=auto
==============================================================================
--- helix/site-content/1.0.3-docs/recipes/rabbitmq_consumer_group.html (added)
+++ helix/site-content/1.0.3-docs/recipes/rabbitmq_consumer_group.html Sat Apr 
23 04:22:15 2022
@@ -0,0 +1,325 @@
+<!DOCTYPE html>
+
+
+<!--
+ | Generated by Apache Maven Doxia Site Renderer 1.11.1 from 
src/site/markdown/recipes/rabbitmq_consumer_group.md at 2022-04-23
+ | Rendered using Apache Maven Fluido Skin 1.11.0-SNAPSHOT
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"; lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1" />
+    <meta name="generator" content="Apache Maven Doxia Site Renderer 1.11.1" />
+    <title>Apache Helix &#x2013; RabbitMQ Consumer Group</title>
+    <link rel="stylesheet" 
href="../css/apache-maven-fluido-1.11.0-SNAPSHOT.min.css" />
+    <link rel="stylesheet" href="../css/site.css" />
+    <link rel="stylesheet" href="../css/print.css" media="print" />
+    <script src="../js/apache-maven-fluido-1.11.0-SNAPSHOT.min.js"></script>
+<script type="text/javascript">
+
+        var _gaq = _gaq || [];
+        _gaq.push(['_setAccount', 'UA-3211522-12']);
+        _gaq.push(['_trackPageview']);
+
+        (function() {
+        var ga = document.createElement('script'); ga.type = 
'text/javascript'; ga.async = true;
+        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 
'http://www') + '.google-analytics.com/ga.js';
+        var s = document.getElementsByTagName('script')[0]; 
s.parentNode.insertBefore(ga, s);
+        })();
+
+      </script>
+  </head>
+  <body class="topBarEnabled">
+    <header id="topbar" class="navbar navbar-fixed-top ">
+      <div class="navbar-inner">
+        <div class="container-fluid">
+        <a data-target=".nav-collapse" data-toggle="collapse" class="btn 
btn-navbar">
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+        </a>
+            <ul class="nav">
+      <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Get Helix 
<b class="caret"></b></a>
+        <ul class="dropdown-menu">
+            <li><a href="../download.html" title="Download">Download</a></li>
+            <li><a href="../Building.html" title="Building">Building</a></li>
+            <li><a href="../releasenotes/release-1.0.3.html" title="Release 
Notes">Release Notes</a></li>
+        </ul>
+      </li>
+      <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Hands-On <b 
class="caret"></b></a>
+        <ul class="dropdown-menu">
+            <li><a href="../Quickstart.html" title="Quick Start">Quick 
Start</a></li>
+            <li><a href="../Tutorial.html" title="Tutorial">Tutorial</a></li>
+            <li><a href="../../javadocs/1.0.3" 
title="Javadocs">Javadocs</a></li>
+        </ul>
+      </li>
+      <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Recipes <b 
class="caret"></b></a>
+        <ul class="dropdown-menu">
+            <li><a href="../recipes/lock_manager.html" title="Distributed lock 
manager">Distributed lock manager</a></li>
+            <li><a href="../recipes/rabbitmq_consumer_group.html" 
title="Rabbit MQ consumer group">Rabbit MQ consumer group</a></li>
+            <li><a href="../recipes/rsync_replicated_file_store.html" 
title="Rsync replicated file store">Rsync replicated file store</a></li>
+            <li><a href="../recipes/service_discovery.html" title="Service 
discovery">Service discovery</a></li>
+            <li><a href="../recipes/task_dag_execution.html" 
title="Distributed task DAG execution">Distributed task DAG execution</a></li>
+        </ul>
+      </li>
+            </ul>
+            <ul class="nav pull-right">
+              <li class="dropdown">
+                <a href="#" class="dropdown-toggle" 
data-toggle="dropdown">External Links <b class="caret"></b></a>
+                <ul class="dropdown-menu">
+    <li><a href="../index.html" title="Helix 1.0.3">Helix 1.0.3</a></li>
+                </ul>
+              </li>
+            </ul>
+        </div>
+      </div>
+    </header>
+    <div class="container-fluid">
+      <header>
+        <div id="banner">
+          <div class="pull-left"><a href="http://helix.apache.org/"; 
id="bannerLeft"><img src="../../images/helix-logo.jpg"  alt=""/></a></div>
+          <div class="pull-right"><a href="http://www.apache.org/"; 
id="bannerRight"><img src="../../images/feather_small.gif"  alt=""/></a></div>
+          <div class="clear"><hr/></div>
+        </div>
+
+        <div id="breadcrumbs">
+          <ul class="breadcrumb">
+      <li class=""><a href="http://helix.apache.org/"; class="externalLink" 
title="Apache Helix">Apache Helix</a><span class="divider">/</span></li>
+      <li class=""><a href="../../" title="Apache Helix">Apache Helix</a><span 
class="divider">/</span></li>
+      <li class=""><a href=".././" title="Release 1.0.3">Release 
1.0.3</a><span class="divider">/</span></li>
+    <li class="active ">RabbitMQ Consumer Group</li>
+        <li id="publishDate" class="pull-right">Last Published: 2022-04-23</li>
+          </ul>
+        </div>
+      </header>
+      <div class="row-fluid">
+        <header id="leftColumn" class="span2">
+          <nav class="well sidebar-nav">
+  <ul class="nav nav-list">
+   <li class="nav-header">Get Helix</li>
+    <li><a href="../download.html" title="Download"><span 
class="none"></span>Download</a></li>
+    <li><a href="../Building.html" title="Building"><span 
class="none"></span>Building</a></li>
+    <li><a href="../releasenotes/release-1.0.3.html" title="Release 
Notes"><span class="none"></span>Release Notes</a></li>
+   <li class="nav-header">Hands-On</li>
+    <li><a href="../Quickstart.html" title="Quick Start"><span 
class="none"></span>Quick Start</a></li>
+    <li><a href="../Tutorial.html" title="Tutorial"><span 
class="none"></span>Tutorial</a></li>
+    <li><a href="../../javadocs/1.0.3" title="Javadocs"><span 
class="none"></span>Javadocs</a></li>
+   <li class="nav-header">Recipes</li>
+    <li><a href="../recipes/lock_manager.html" title="Distributed lock 
manager"><span class="none"></span>Distributed lock manager</a></li>
+    <li class="active"><a href="#"><span class="none"></span>Rabbit MQ 
consumer group</a></li>
+    <li><a href="../recipes/rsync_replicated_file_store.html" title="Rsync 
replicated file store"><span class="none"></span>Rsync replicated file 
store</a></li>
+    <li><a href="../recipes/service_discovery.html" title="Service 
discovery"><span class="none"></span>Service discovery</a></li>
+    <li><a href="../recipes/task_dag_execution.html" title="Distributed task 
DAG execution"><span class="none"></span>Distributed task DAG execution</a></li>
+  </ul>
+          </nav>
+          <div class="well sidebar-nav">
+<form id="search-form" action="https://www.google.com/search"; method="get" >
+  <input value="helix.apache.org/1.0.3-docs" name="sitesearch" type="hidden"/>
+  <input class="search-query" name="q" id="query" type="text" />
+</form>
+<script>asyncJs( 'https://cse.google.com/brand?form=search-form' )</script>
+            <hr />
+            <div id="poweredBy">
+              <div class="clear"></div>
+    <div id="twitter" style="border:none; margin-top: 10px">
+    <a href="https://twitter.com/ApacheHelix"; class="twitter-follow-button" 
data-show-count="false" data-align="left" data-size="medium" 
data-show-screen-name="true" data-lang="en">Follow ApacheHelix</a>
+    <script>!function(d,s,id){var 
js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
+    </div>
+              <div class="clear"></div>
+              <div class="clear"></div>
+<a href="http://maven.apache.org/"; title="Built by Maven" 
class="poweredBy"><img class="builtBy" alt="Built by Maven" 
src="../images/logos/maven-feather.png" /></a>
+            </div>
+          </div>
+        </header>
+        <main id="bodyColumn"  class="span10" >
+<!---
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<section>
+<h2><a name="RabbitMQ_Consumer_Group"></a>RabbitMQ Consumer Group</h2>
+<p><a class="externalLink" href="http://www.rabbitmq.com/";>RabbitMQ</a> is 
well-known open source software the provides robust messaging for 
applications.</p>
+<p>One of the commonly implemented recipes using this software is a work 
queue.  <a class="externalLink" 
href="http://www.rabbitmq.com/tutorials/tutorial-four-java.html";>http://www.rabbitmq.com/tutorials/tutorial-four-java.html</a>
 describes the use case where</p>
+<ul>
+
+<li>A producer sends a message with a routing key</li>
+<li>The message is routed to the queue whose binding key exactly matches the 
routing key of the message</li>
+<li>There are multiple consumers and each consumer is interested in processing 
only a subset of the messages by binding to the interested keys</li>
+</ul>
+<p>The example provided <a class="externalLink" 
href="http://www.rabbitmq.com/tutorials/tutorial-four-java.html";>here</a> 
describes how multiple consumers can be started to process all the messages.</p>
+<p>While this works, in production systems one needs the following:</p>
+<ul>
+
+<li>Ability to handle failures: when a consumer fails, another consumer must 
be started or the other consumers must start processing these messages that 
should have been processed by the failed consumer</li>
+<li>When the existing consumers cannot keep up with the task generation rate, 
new consumers will be added. The tasks must be redistributed among all the 
consumers</li>
+</ul>
+<p>In this recipe, we demonstrate handling of consumer failures and new 
consumer additions using Helix.</p>
+<p>Mapping this usecase to Helix is pretty easy as the binding key/routing key 
is equivalent to a partition.</p>
+<p>Let's take an example. Lets say the queue has 6 partitions, and we have 2 
consumers to process all the queues.
+What we want is all 6 queues to be evenly divided among 2 consumers.
+Eventually when the system scales, we add more consumers to keep up. This will 
make each consumer process tasks from 2 queues.
+Now let's say that a consumer failed, reducing the number of active consumers 
to 2. This means each consumer must process 3 queues.</p>
+<p>We showcase how such a dynamic application can be developed using Helix. 
Even though we use RabbitMQ as the pub/sub system one can extend this solution 
to other pub/sub systems.</p><section>
+<h3><a name="Try_It"></a>Try It</h3>
+
+<div class="source"><pre class="prettyprint"><code>git clone 
https://git-wip-us.apache.org/repos/asf/helix.git
+cd helix
+git checkout tags/helix-1.0.3
+mvn clean install package -DskipTests
+cd recipes/rabbitmq-consumer-group/bin
+chmod +x *
+export HELIX_PKG_ROOT=`pwd`/helix-core/target/helix-core-pkg
+export HELIX_RABBITMQ_ROOT=`pwd`/recipes/rabbitmq-consumer-group/
+chmod +x $HELIX_PKG_ROOT/bin/*
+chmod +x $HELIX_RABBITMQ_ROOT/bin/*
+</code></pre></div><section>
+<h4><a name="Install_RabbitMQ"></a>Install RabbitMQ</h4>
+<p>Setting up RabbitMQ on a local box is straightforward. You can find the 
instructions here
+<a class="externalLink" 
href="http://www.rabbitmq.com/download.html";>http://www.rabbitmq.com/download.html</a></p></section><section>
+<h4><a name="Start_ZK"></a>Start ZK</h4>
+<p>Start ZooKeeper at port 2199</p>
+
+<div class="source"><pre 
class="prettyprint"><code>$HELIX_PKG_ROOT/bin/start-standalone-zookeeper 2199
+</code></pre></div></section><section>
+<h4><a name="Setup_the_Consumer_Group_Cluster"></a>Setup the Consumer Group 
Cluster</h4>
+<p>This will setup the cluster by creating a 
&#x201c;rabbitmq-consumer-group&#x201d; cluster and adds a 
&#x201c;topic&#x201d; with &#x201c;6&#x201d; queues.</p>
+
+<div class="source"><pre 
class="prettyprint"><code>$HELIX_RABBITMQ_ROOT/bin/setup-cluster.sh 
localhost:2199
+</code></pre></div></section><section>
+<h4><a name="Add_Consumers"></a>Add Consumers</h4>
+<p>Start 2 consumers in 2 different terminals. Each consumer is given a unique 
ID.</p>
+
+<div class="source"><pre class="prettyprint"><code>//start-consumer.sh 
zookeeperAddress (e.g. localhost:2181) consumerId , rabbitmqServer (e.g. 
localhost)
+$HELIX_RABBITMQ_ROOT/bin/start-consumer.sh localhost:2199 0 localhost
+$HELIX_RABBITMQ_ROOT/bin/start-consumer.sh localhost:2199 1 localhost
+
+</code></pre></div></section><section>
+<h4><a name="Start_the_Helix_Controller"></a>Start the Helix Controller</h4>
+<p>Now start a Helix controller that starts managing the 
&#x201c;rabbitmq-consumer-group&#x201d; cluster.</p>
+
+<div class="source"><pre 
class="prettyprint"><code>$HELIX_RABBITMQ_ROOT/bin/start-cluster-manager.sh 
localhost:2199
+</code></pre></div></section><section>
+<h4><a name="Send_Messages_to_the_Topic"></a>Send Messages to the Topic</h4>
+<p>Start sending messages to the topic. This script randomly selects a routing 
key (1-6) and sends the message to topic.
+Based on the key, messages gets routed to the appropriate queue.</p>
+
+<div class="source"><pre 
class="prettyprint"><code>$HELIX_RABBITMQ_ROOT/bin/send-message.sh localhost 20
+</code></pre></div>
+<p>After running this, you should see all 20 messages being processed by 2 
consumers.</p></section><section>
+<h4><a name="Add_Another_Consumer"></a>Add Another Consumer</h4>
+<p>Once a new consumer is started, Helix detects it. In order to balance the 
load between 3 consumers, it deallocates 1 partition from the existing 
consumers and allocates it to the new consumer. We see that
+each consumer is now processing only 2 queues.
+Helix makes sure that old nodes are asked to stop consuming before the new 
consumer is asked to start consuming for a given partition. But the transitions 
for each partition can happen in parallel.</p>
+
+<div class="source"><pre 
class="prettyprint"><code>$HELIX_RABBITMQ_ROOT/bin/start-consumer.sh 
localhost:2199 2 localhost
+</code></pre></div>
+<p>Send messages again to the topic</p>
+
+<div class="source"><pre 
class="prettyprint"><code>$HELIX_RABBITMQ_ROOT/bin/send-message.sh localhost 100
+</code></pre></div>
+<p>You should see that messages are now received by all 3 
consumers.</p></section><section>
+<h4><a name="Stop_a_Consumer"></a>Stop a Consumer</h4>
+<p>In any terminal press CTRL^C and notice that Helix detects the consumer 
failure and distributes the 2 partitions that were processed by failed consumer 
to the remaining 2 active consumers.</p></section></section><section>
+<h3><a name="How_does_this_work.3F"></a>How does this work?</h3>
+<p>Find the entire code <a class="externalLink" 
href="https://git-wip-us.apache.org/repos/asf?p=helix.git;a=tree;f=recipes/rabbitmq-consumer-group/src/main/java/org/apache/helix/recipes/rabbitmq";>here</a>.</p><section>
+<h4><a name="Cluster_Setup"></a>Cluster Setup</h4>
+<p>This step creates ZNode on ZooKeeper for the cluster and adds the state 
model. We use online offline state model since there is no need for other 
states. The consumer is either processing a queue or it is not.</p>
+<p>It creates a resource called &#x201c;rabbitmq-consumer-group&#x201d; with 6 
partitions. The execution mode is set to AUTO_REBALANCE. This means that the 
Helix controls the assignment of partition to consumers and automatically 
distributes the partitions evenly among the active consumers. When a consumer 
is added or removed, it ensures that a minimum number of partitions are 
shuffled.</p>
+
+<div class="source"><pre class="prettyprint"><code>zkclient = new 
ZkClient(zkAddr, ZkClient.DEFAULT_SESSION_TIMEOUT,
+    ZkClient.DEFAULT_CONNECTION_TIMEOUT, new ZNRecordSerializer());
+ZKHelixAdmin admin = new ZKHelixAdmin(zkclient);
+
+// add cluster
+admin.addCluster(clusterName, true);
+
+// add state model definition
+StateModelConfigGenerator generator = new StateModelConfigGenerator();
+admin.addStateModelDef(clusterName, &quot;OnlineOffline&quot;,
+    new StateModelDefinition(generator.generateConfigForOnlineOffline()));
+
+// add resource &quot;topic&quot; which has 6 partitions
+String resourceName = &quot;rabbitmq-consumer-group&quot;;
+admin.addResource(clusterName, resourceName, 6, &quot;OnlineOffline&quot;, 
&quot;AUTO_REBALANCE&quot;);
+</code></pre></div></section></section><section>
+<h3><a name="Starting_the_Consumers"></a>Starting the Consumers</h3>
+<p>The only thing consumers need to know is the ZooKeeper address, cluster 
name and consumer ID. It does not need to know anything else.</p>
+
+<div class="source"><pre class="prettyprint"><code>_manager = 
HelixManagerFactory.getZKHelixManager(_clusterName,
+                                                 _consumerId,
+                                                 InstanceType.PARTICIPANT,
+                                                 _zkAddr);
+
+StateMachineEngine stateMach = _manager.getStateMachineEngine();
+ConsumerStateModelFactory modelFactory =
+    new ConsumerStateModelFactory(_consumerId, _mqServer);
+stateMach.registerStateModelFactory(&quot;OnlineOffline&quot;, modelFactory);
+
+_manager.connect();
+</code></pre></div>
+<p>Once the consumer has registered the state model and the controller is 
started, the consumer starts getting callbacks (onBecomeOnlineFromOffline) for 
the partition it needs to host. All it needs to do as part of the callback is 
to start consuming messages from the appropriate queue. Similarly, when the 
controller deallocates a partitions from a consumer, it fires 
onBecomeOfflineFromOnline for the same partition.
+As a part of this transition, the consumer will stop consuming from a that 
queue.</p>
+
+<div class="source"><pre class="prettyprint"><code>@Transition(to = 
&quot;ONLINE&quot;, from = &quot;OFFLINE&quot;)
+public void onBecomeOnlineFromOffline(Message message, NotificationContext 
context) {
+  LOG.debug(_consumerId + &quot; becomes ONLINE from OFFLINE for &quot; + 
_partition);
+  if (_thread == null) {
+    LOG.debug(&quot;Starting ConsumerThread for &quot; + _partition + 
&quot;...&quot;);
+    _thread = new ConsumerThread(_partition, _mqServer, _consumerId);
+    _thread.start();
+    LOG.debug(&quot;Starting ConsumerThread for &quot; + _partition + &quot; 
done&quot;);
+
+  }
+}
+
+@Transition(to = &quot;OFFLINE&quot;, from = &quot;ONLINE&quot;)
+public void onBecomeOfflineFromOnline(Message message, NotificationContext 
context)
+    throws InterruptedException {
+  LOG.debug(_consumerId + &quot; becomes OFFLINE from ONLINE for &quot; + 
_partition);
+  if (_thread != null) {
+    LOG.debug(&quot;Stopping &quot; + _consumerId + &quot; for &quot; + 
_partition + &quot;...&quot;);
+    _thread.interrupt();
+    _thread.join(2000);
+    _thread = null;
+    LOG.debug(&quot;Stopping &quot; +  _consumerId + &quot; for &quot; + 
_partition + &quot; done&quot;);
+  }
+}
+</code></pre></div></section></section>
+        </main>
+      </div>
+    </div>
+    <hr/>
+    <footer>
+      <div class="container-fluid">
+        <div class="row-fluid">
+<div class="row span16"><div>Apache Helix, Apache, the Apache feather logo, 
and the Apache Helix project logos are trademarks of The Apache Software 
Foundation.
+        All other marks mentioned may be trademarks or registered trademarks 
of their respective owners.</div>
+        <a 
href="https://helix.apache.org/1.0.3-docs/privacy-policy.html";>Privacy 
Policy</a>
+      </div>
+        </div>
+      </div>
+    </footer>
+<script>
+       if(anchors) {
+         anchors.add();
+       }
+</script>
+  </body>
+</html>
\ No newline at end of file

Added: helix/site-content/1.0.3-docs/recipes/rsync_replicated_file_store.html
URL: 
http://svn.apache.org/viewvc/helix/site-content/1.0.3-docs/recipes/rsync_replicated_file_store.html?rev=1900184&view=auto
==============================================================================
--- helix/site-content/1.0.3-docs/recipes/rsync_replicated_file_store.html 
(added)
+++ helix/site-content/1.0.3-docs/recipes/rsync_replicated_file_store.html Sat 
Apr 23 04:22:15 2022
@@ -0,0 +1,284 @@
+<!DOCTYPE html>
+
+
+<!--
+ | Generated by Apache Maven Doxia Site Renderer 1.11.1 from 
src/site/markdown/recipes/rsync_replicated_file_store.md at 2022-04-23
+ | Rendered using Apache Maven Fluido Skin 1.11.0-SNAPSHOT
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"; lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1" />
+    <meta name="generator" content="Apache Maven Doxia Site Renderer 1.11.1" />
+    <title>Apache Helix &#x2013; Near-Realtime Rsync Replicated File 
System</title>
+    <link rel="stylesheet" 
href="../css/apache-maven-fluido-1.11.0-SNAPSHOT.min.css" />
+    <link rel="stylesheet" href="../css/site.css" />
+    <link rel="stylesheet" href="../css/print.css" media="print" />
+    <script src="../js/apache-maven-fluido-1.11.0-SNAPSHOT.min.js"></script>
+<script type="text/javascript">
+
+        var _gaq = _gaq || [];
+        _gaq.push(['_setAccount', 'UA-3211522-12']);
+        _gaq.push(['_trackPageview']);
+
+        (function() {
+        var ga = document.createElement('script'); ga.type = 
'text/javascript'; ga.async = true;
+        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 
'http://www') + '.google-analytics.com/ga.js';
+        var s = document.getElementsByTagName('script')[0]; 
s.parentNode.insertBefore(ga, s);
+        })();
+
+      </script>
+  </head>
+  <body class="topBarEnabled">
+    <header id="topbar" class="navbar navbar-fixed-top ">
+      <div class="navbar-inner">
+        <div class="container-fluid">
+        <a data-target=".nav-collapse" data-toggle="collapse" class="btn 
btn-navbar">
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+        </a>
+            <ul class="nav">
+      <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Get Helix 
<b class="caret"></b></a>
+        <ul class="dropdown-menu">
+            <li><a href="../download.html" title="Download">Download</a></li>
+            <li><a href="../Building.html" title="Building">Building</a></li>
+            <li><a href="../releasenotes/release-1.0.3.html" title="Release 
Notes">Release Notes</a></li>
+        </ul>
+      </li>
+      <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Hands-On <b 
class="caret"></b></a>
+        <ul class="dropdown-menu">
+            <li><a href="../Quickstart.html" title="Quick Start">Quick 
Start</a></li>
+            <li><a href="../Tutorial.html" title="Tutorial">Tutorial</a></li>
+            <li><a href="../../javadocs/1.0.3" 
title="Javadocs">Javadocs</a></li>
+        </ul>
+      </li>
+      <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Recipes <b 
class="caret"></b></a>
+        <ul class="dropdown-menu">
+            <li><a href="../recipes/lock_manager.html" title="Distributed lock 
manager">Distributed lock manager</a></li>
+            <li><a href="../recipes/rabbitmq_consumer_group.html" 
title="Rabbit MQ consumer group">Rabbit MQ consumer group</a></li>
+            <li><a href="../recipes/rsync_replicated_file_store.html" 
title="Rsync replicated file store">Rsync replicated file store</a></li>
+            <li><a href="../recipes/service_discovery.html" title="Service 
discovery">Service discovery</a></li>
+            <li><a href="../recipes/task_dag_execution.html" 
title="Distributed task DAG execution">Distributed task DAG execution</a></li>
+        </ul>
+      </li>
+            </ul>
+            <ul class="nav pull-right">
+              <li class="dropdown">
+                <a href="#" class="dropdown-toggle" 
data-toggle="dropdown">External Links <b class="caret"></b></a>
+                <ul class="dropdown-menu">
+    <li><a href="../index.html" title="Helix 1.0.3">Helix 1.0.3</a></li>
+                </ul>
+              </li>
+            </ul>
+        </div>
+      </div>
+    </header>
+    <div class="container-fluid">
+      <header>
+        <div id="banner">
+          <div class="pull-left"><a href="http://helix.apache.org/"; 
id="bannerLeft"><img src="../../images/helix-logo.jpg"  alt=""/></a></div>
+          <div class="pull-right"><a href="http://www.apache.org/"; 
id="bannerRight"><img src="../../images/feather_small.gif"  alt=""/></a></div>
+          <div class="clear"><hr/></div>
+        </div>
+
+        <div id="breadcrumbs">
+          <ul class="breadcrumb">
+      <li class=""><a href="http://helix.apache.org/"; class="externalLink" 
title="Apache Helix">Apache Helix</a><span class="divider">/</span></li>
+      <li class=""><a href="../../" title="Apache Helix">Apache Helix</a><span 
class="divider">/</span></li>
+      <li class=""><a href=".././" title="Release 1.0.3">Release 
1.0.3</a><span class="divider">/</span></li>
+    <li class="active ">Near-Realtime Rsync Replicated File System</li>
+        <li id="publishDate" class="pull-right">Last Published: 2022-04-23</li>
+          </ul>
+        </div>
+      </header>
+      <div class="row-fluid">
+        <header id="leftColumn" class="span2">
+          <nav class="well sidebar-nav">
+  <ul class="nav nav-list">
+   <li class="nav-header">Get Helix</li>
+    <li><a href="../download.html" title="Download"><span 
class="none"></span>Download</a></li>
+    <li><a href="../Building.html" title="Building"><span 
class="none"></span>Building</a></li>
+    <li><a href="../releasenotes/release-1.0.3.html" title="Release 
Notes"><span class="none"></span>Release Notes</a></li>
+   <li class="nav-header">Hands-On</li>
+    <li><a href="../Quickstart.html" title="Quick Start"><span 
class="none"></span>Quick Start</a></li>
+    <li><a href="../Tutorial.html" title="Tutorial"><span 
class="none"></span>Tutorial</a></li>
+    <li><a href="../../javadocs/1.0.3" title="Javadocs"><span 
class="none"></span>Javadocs</a></li>
+   <li class="nav-header">Recipes</li>
+    <li><a href="../recipes/lock_manager.html" title="Distributed lock 
manager"><span class="none"></span>Distributed lock manager</a></li>
+    <li><a href="../recipes/rabbitmq_consumer_group.html" title="Rabbit MQ 
consumer group"><span class="none"></span>Rabbit MQ consumer group</a></li>
+    <li class="active"><a href="#"><span class="none"></span>Rsync replicated 
file store</a></li>
+    <li><a href="../recipes/service_discovery.html" title="Service 
discovery"><span class="none"></span>Service discovery</a></li>
+    <li><a href="../recipes/task_dag_execution.html" title="Distributed task 
DAG execution"><span class="none"></span>Distributed task DAG execution</a></li>
+  </ul>
+          </nav>
+          <div class="well sidebar-nav">
+<form id="search-form" action="https://www.google.com/search"; method="get" >
+  <input value="helix.apache.org/1.0.3-docs" name="sitesearch" type="hidden"/>
+  <input class="search-query" name="q" id="query" type="text" />
+</form>
+<script>asyncJs( 'https://cse.google.com/brand?form=search-form' )</script>
+            <hr />
+            <div id="poweredBy">
+              <div class="clear"></div>
+    <div id="twitter" style="border:none; margin-top: 10px">
+    <a href="https://twitter.com/ApacheHelix"; class="twitter-follow-button" 
data-show-count="false" data-align="left" data-size="medium" 
data-show-screen-name="true" data-lang="en">Follow ApacheHelix</a>
+    <script>!function(d,s,id){var 
js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
+    </div>
+              <div class="clear"></div>
+              <div class="clear"></div>
+<a href="http://maven.apache.org/"; title="Built by Maven" 
class="poweredBy"><img class="builtBy" alt="Built by Maven" 
src="../images/logos/maven-feather.png" /></a>
+            </div>
+          </div>
+        </header>
+        <main id="bodyColumn"  class="span10" >
+<!---
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<section>
+<h2><a name="Near-Realtime_Rsync_Replicated_File_System"></a>Near-Realtime 
Rsync Replicated File System</h2><section>
+<h3><a name="Quick_Demo"></a>Quick Demo</h3>
+<ul>
+
+<li>This demo starts 3 instances with id's as <code>localhost_12001, 
localhost_12002, localhost_12003</code></li>
+<li>Each instance stores its files under 
<code>/tmp/&lt;id&gt;/filestore</code></li>
+<li><code>localhost_12001</code> is designated as the master, and 
<code>localhost_12002</code> and <code>localhost_12003</code> are the 
slaves</li>
+<li>Files written to the master are replicated to the slaves automatically. In 
this demo, a.txt and b.txt are written to 
<code>/tmp/localhost_12001/filestore</code> and they get replicated to other 
folders.</li>
+<li>When the master is stopped, <code>localhost_12002</code> is promoted to 
master.</li>
+<li>The other slave <code>localhost_12003</code> stops replicating from 
<code>localhost_12001</code> and starts replicating from new master 
<code>localhost_12002</code></li>
+<li>Files written to new master <code>localhost_12002</code> are replicated to 
<code>localhost_12003</code></li>
+<li>In the end state of this quick demo, <code>localhost_12002</code> is the 
master and <code>localhost_12003</code> is the slave. Manually create files 
under <code>/tmp/localhost_12002/filestore</code> and see that appear in 
<code>/tmp/localhost_12003/filestore</code></li>
+<li>Ignore the interrupted exceptions on the console :-)</li>
+</ul>
+
+<div class="source"><pre class="prettyprint"><code>git clone 
https://git-wip-us.apache.org/repos/asf/helix.git
+cd helix
+git checkout tags/helix-1.0.3
+cd recipes/rsync-replicated-file-system/
+mvn clean install package -DskipTests
+cd target/rsync-replicated-file-system-pkg/bin
+chmod +x *
+./quickdemo
+
+</code></pre></div></section><section>
+<h3><a name="Overview"></a>Overview</h3>
+<p>There are many applications that require storage for storing large number 
of relatively small data files. Examples include media stores to store small 
videos, images, mail attachments etc. Each of these objects is typically 
kilobytes, often no larger than a few megabytes. An additional distinguishing 
feature of these use cases is that files are typically only added or deleted, 
rarely updated. When there are updates, they do not have any concurrency 
requirements.</p>
+<p>These are much simpler requirements than what general purpose distributed 
file system have to satisfy; these would include concurrent access to files, 
random access for reads and updates, posix compliance, and others. To satisfy 
those requirements, general DFSs are also pretty complex that are expensive to 
build and maintain.</p>
+<p>A different implementation of a distributed file system includes HDFS which 
is inspired by Google's GFS. This is one of the most widely used distributed 
file system that forms the main data storage platform for Hadoop. HDFS is 
primary aimed at processing very large data sets and distributes files across a 
cluster of commodity servers by splitting up files in fixed size chunks. HDFS 
is not particularly well suited for storing a very large number of relatively 
tiny files.</p></section><section>
+<h3><a name="File_Store"></a>File Store</h3>
+<p>It's possible to build a vastly simpler system for the class of 
applications that have simpler requirements as we have pointed out.</p>
+<ul>
+
+<li>Large number of files but each file is relatively small</li>
+<li>Access is limited to create, delete and get entire files</li>
+<li>No updates to files that are already created (or it's feasible to delete 
the old file and create a new one)</li>
+</ul>
+<p>We call this system a Partitioned File Store (PFS) to distinguish it from 
other distributed file systems. This system needs to provide the following 
features:</p>
+<ul>
+
+<li>CRD access to large number of small files</li>
+<li>Scalability: Files should be distributed across a large number of 
commodity servers based on the storage requirement</li>
+<li>Fault-tolerance: Each file should be replicated on multiple servers so 
that individual server failures do not reduce availability</li>
+<li>Elasticity: It should be possible to add capacity to the cluster 
easily</li>
+</ul>
+<p>Apache Helix is a generic cluster management framework that makes it very 
easy to provide scalability, fault-tolerance and elasticity features.
+rsync can be easily used as a replication channel between servers so that each 
file gets replicated on multiple servers.</p></section><section>
+<h3><a name="Design"></a>Design</h3><section>
+<h4><a name="High_Level"></a>High Level</h4>
+<ul>
+
+<li>Partition the file system based on the file name</li>
+<li>At any time a single writer can write, we call this a master</li>
+<li>For redundancy, we need to have additional replicas called slave. Slaves 
can optionally serve reads</li>
+<li>Slave replicates data from the master</li>
+<li>When a master fails, a slave gets promoted to master</li>
+</ul></section><section>
+<h4><a name="Transaction_Log"></a>Transaction Log</h4>
+<p>Every write on the master will result in creation/deletion of one or more 
files. In order to maintain timeline consistency slaves need to apply the 
changes in the same order
+To facilitate this, the master logs each transaction in a file and each 
transaction is associated with an 64 bit ID in which the 32 LSB represents a 
sequence number and MSB represents the generation number
+The sequence number gets incremented on every transaction and the generation 
is incremented when a new master is elected</p></section><section>
+<h4><a name="Replication"></a>Replication</h4>
+<p>Replication is required for slaves to keep up with changes on the master. 
Every time the slave applies a change it checkpoints the last applied 
transaction ID.
+During restarts, this allows the slave to pull changes from the last 
checkpointed ID. Similar to master, the slave logs each transaction to the 
transaction logs but instead of generating new transaction ID, it uses the same 
ID generated by the master.</p></section><section>
+<h4><a name="Failover"></a>Failover</h4>
+<p>When a master fails, a new slave will be promoted to master. If the 
previous master node is reachable, then the new master will flush all the
+changes from previous the master before taking up mastership. The new master 
will record the end transaction ID of the current generation and then start a 
new generation
+with sequence starting from 1. After this the master will begin accepting 
writes.</p>
+<p><img src="../images/PFS-Generic.png" alt="Partitioned File Store" 
/></p></section></section><section>
+<h3><a name="Rsync-based_Solution"></a>Rsync-based Solution</h3>
+<p><img src="../images/RSYNC_BASED_PFS.png" alt="Rsync based File Store" /></p>
+<p>This application demonstrates a file store that uses rsync as the 
replication mechanism. One can envision a similar system where instead of using 
rsync, one
+can implement a custom solution to notify the slave of the changes and also 
provide an api to pull the change files.</p><section>
+<h4><a name="Concepts"></a>Concepts</h4>
+<ul>
+
+<li>file_store_dir: Root directory for the actual data files</li>
+<li>change_log_dir: The transaction logs are generated under this folder</li>
+<li>check_point_dir: The slave stores the check points ( last processed 
transaction) here</li>
+</ul></section><section>
+<h4><a name="Master"></a>Master</h4>
+<ul>
+
+<li>File server: This component supports file uploads and downloads and writes 
the files to <code>file_store_dir</code>. This is not included in this 
application. The idea is that most applications have different ways of 
implementing this component and have some associated business logic. It is not 
hard to come up with such a component if needed.</li>
+<li>File store watcher: This component watches the <code>file_store_dir</code> 
directory on the local file system for any changes and notifies the registered 
listeners of the changes</li>
+<li>Change log generator: This registers as a listener of the file store 
watcher and on each notification logs the changes into a file under 
<code>change_log_dir</code></li>
+</ul></section><section>
+<h4><a name="Slave"></a>Slave</h4>
+<ul>
+
+<li>File server: This component on the slave will only support reads</li>
+<li>Cluster state observer: Slave observes the cluster state and is able to 
know who is the current master</li>
+<li>Replicator: This has two subcomponents
+<ul>
+
+<li>Periodic rsync of change log: This is a background process that 
periodically rsyncs the <code>change_log_dir</code> of the master to its local 
directory</li>
+<li>Change Log Watcher: This watches the <code>change_log_dir</code> for 
changes and notifies the registered listeners of the change</li>
+<li>On demand rsync invoker: This is registered as a listener to change log 
watcher and on every change invokes rsync to sync only the changed file</li>
+</ul>
+</li>
+</ul></section><section>
+<h4><a name="Coordination"></a>Coordination</h4>
+<p>The coordination between nodes is done by Helix. Helix does the partition 
management and assigns the partition to multiple nodes based on the replication 
factor. It elects one the nodes as master and designates others as slaves.
+It provides notifications to each node in the form of state transitions 
(Offline to Slave, Slave to Master). It also provides notifications when there 
is change is cluster state.
+This allows the slave to stop replicating from current master and start 
replicating from new master.</p>
+<p>In this application, we have only one partition but its very easy to extend 
it to support multiple partitions. By partitioning the file store, one can add 
new nodes and Helix will automatically
+re-distribute partitions among the nodes. To summarize, Helix provides 
partition management, fault tolerance and facilitates automated cluster 
expansion.</p></section></section></section>
+        </main>
+      </div>
+    </div>
+    <hr/>
+    <footer>
+      <div class="container-fluid">
+        <div class="row-fluid">
+<div class="row span16"><div>Apache Helix, Apache, the Apache feather logo, 
and the Apache Helix project logos are trademarks of The Apache Software 
Foundation.
+        All other marks mentioned may be trademarks or registered trademarks 
of their respective owners.</div>
+        <a 
href="https://helix.apache.org/1.0.3-docs/privacy-policy.html";>Privacy 
Policy</a>
+      </div>
+        </div>
+      </div>
+    </footer>
+<script>
+       if(anchors) {
+         anchors.add();
+       }
+</script>
+  </body>
+</html>
\ No newline at end of file

Added: helix/site-content/1.0.3-docs/recipes/service_discovery.html
URL: 
http://svn.apache.org/viewvc/helix/site-content/1.0.3-docs/recipes/service_discovery.html?rev=1900184&view=auto
==============================================================================
--- helix/site-content/1.0.3-docs/recipes/service_discovery.html (added)
+++ helix/site-content/1.0.3-docs/recipes/service_discovery.html Sat Apr 23 
04:22:15 2022
@@ -0,0 +1,329 @@
+<!DOCTYPE html>
+
+
+<!--
+ | Generated by Apache Maven Doxia Site Renderer 1.11.1 from 
src/site/markdown/recipes/service_discovery.md at 2022-04-23
+ | Rendered using Apache Maven Fluido Skin 1.11.0-SNAPSHOT
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"; lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1" />
+    <meta name="generator" content="Apache Maven Doxia Site Renderer 1.11.1" />
+    <title>Apache Helix &#x2013; Service Discovery</title>
+    <link rel="stylesheet" 
href="../css/apache-maven-fluido-1.11.0-SNAPSHOT.min.css" />
+    <link rel="stylesheet" href="../css/site.css" />
+    <link rel="stylesheet" href="../css/print.css" media="print" />
+    <script src="../js/apache-maven-fluido-1.11.0-SNAPSHOT.min.js"></script>
+<script type="text/javascript">
+
+        var _gaq = _gaq || [];
+        _gaq.push(['_setAccount', 'UA-3211522-12']);
+        _gaq.push(['_trackPageview']);
+
+        (function() {
+        var ga = document.createElement('script'); ga.type = 
'text/javascript'; ga.async = true;
+        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 
'http://www') + '.google-analytics.com/ga.js';
+        var s = document.getElementsByTagName('script')[0]; 
s.parentNode.insertBefore(ga, s);
+        })();
+
+      </script>
+  </head>
+  <body class="topBarEnabled">
+    <header id="topbar" class="navbar navbar-fixed-top ">
+      <div class="navbar-inner">
+        <div class="container-fluid">
+        <a data-target=".nav-collapse" data-toggle="collapse" class="btn 
btn-navbar">
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+        </a>
+            <ul class="nav">
+      <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Get Helix 
<b class="caret"></b></a>
+        <ul class="dropdown-menu">
+            <li><a href="../download.html" title="Download">Download</a></li>
+            <li><a href="../Building.html" title="Building">Building</a></li>
+            <li><a href="../releasenotes/release-1.0.3.html" title="Release 
Notes">Release Notes</a></li>
+        </ul>
+      </li>
+      <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Hands-On <b 
class="caret"></b></a>
+        <ul class="dropdown-menu">
+            <li><a href="../Quickstart.html" title="Quick Start">Quick 
Start</a></li>
+            <li><a href="../Tutorial.html" title="Tutorial">Tutorial</a></li>
+            <li><a href="../../javadocs/1.0.3" 
title="Javadocs">Javadocs</a></li>
+        </ul>
+      </li>
+      <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Recipes <b 
class="caret"></b></a>
+        <ul class="dropdown-menu">
+            <li><a href="../recipes/lock_manager.html" title="Distributed lock 
manager">Distributed lock manager</a></li>
+            <li><a href="../recipes/rabbitmq_consumer_group.html" 
title="Rabbit MQ consumer group">Rabbit MQ consumer group</a></li>
+            <li><a href="../recipes/rsync_replicated_file_store.html" 
title="Rsync replicated file store">Rsync replicated file store</a></li>
+            <li><a href="../recipes/service_discovery.html" title="Service 
discovery">Service discovery</a></li>
+            <li><a href="../recipes/task_dag_execution.html" 
title="Distributed task DAG execution">Distributed task DAG execution</a></li>
+        </ul>
+      </li>
+            </ul>
+            <ul class="nav pull-right">
+              <li class="dropdown">
+                <a href="#" class="dropdown-toggle" 
data-toggle="dropdown">External Links <b class="caret"></b></a>
+                <ul class="dropdown-menu">
+    <li><a href="../index.html" title="Helix 1.0.3">Helix 1.0.3</a></li>
+                </ul>
+              </li>
+            </ul>
+        </div>
+      </div>
+    </header>
+    <div class="container-fluid">
+      <header>
+        <div id="banner">
+          <div class="pull-left"><a href="http://helix.apache.org/"; 
id="bannerLeft"><img src="../../images/helix-logo.jpg"  alt=""/></a></div>
+          <div class="pull-right"><a href="http://www.apache.org/"; 
id="bannerRight"><img src="../../images/feather_small.gif"  alt=""/></a></div>
+          <div class="clear"><hr/></div>
+        </div>
+
+        <div id="breadcrumbs">
+          <ul class="breadcrumb">
+      <li class=""><a href="http://helix.apache.org/"; class="externalLink" 
title="Apache Helix">Apache Helix</a><span class="divider">/</span></li>
+      <li class=""><a href="../../" title="Apache Helix">Apache Helix</a><span 
class="divider">/</span></li>
+      <li class=""><a href=".././" title="Release 1.0.3">Release 
1.0.3</a><span class="divider">/</span></li>
+    <li class="active ">Service Discovery</li>
+        <li id="publishDate" class="pull-right">Last Published: 2022-04-23</li>
+          </ul>
+        </div>
+      </header>
+      <div class="row-fluid">
+        <header id="leftColumn" class="span2">
+          <nav class="well sidebar-nav">
+  <ul class="nav nav-list">
+   <li class="nav-header">Get Helix</li>
+    <li><a href="../download.html" title="Download"><span 
class="none"></span>Download</a></li>
+    <li><a href="../Building.html" title="Building"><span 
class="none"></span>Building</a></li>
+    <li><a href="../releasenotes/release-1.0.3.html" title="Release 
Notes"><span class="none"></span>Release Notes</a></li>
+   <li class="nav-header">Hands-On</li>
+    <li><a href="../Quickstart.html" title="Quick Start"><span 
class="none"></span>Quick Start</a></li>
+    <li><a href="../Tutorial.html" title="Tutorial"><span 
class="none"></span>Tutorial</a></li>
+    <li><a href="../../javadocs/1.0.3" title="Javadocs"><span 
class="none"></span>Javadocs</a></li>
+   <li class="nav-header">Recipes</li>
+    <li><a href="../recipes/lock_manager.html" title="Distributed lock 
manager"><span class="none"></span>Distributed lock manager</a></li>
+    <li><a href="../recipes/rabbitmq_consumer_group.html" title="Rabbit MQ 
consumer group"><span class="none"></span>Rabbit MQ consumer group</a></li>
+    <li><a href="../recipes/rsync_replicated_file_store.html" title="Rsync 
replicated file store"><span class="none"></span>Rsync replicated file 
store</a></li>
+    <li class="active"><a href="#"><span class="none"></span>Service 
discovery</a></li>
+    <li><a href="../recipes/task_dag_execution.html" title="Distributed task 
DAG execution"><span class="none"></span>Distributed task DAG execution</a></li>
+  </ul>
+          </nav>
+          <div class="well sidebar-nav">
+<form id="search-form" action="https://www.google.com/search"; method="get" >
+  <input value="helix.apache.org/1.0.3-docs" name="sitesearch" type="hidden"/>
+  <input class="search-query" name="q" id="query" type="text" />
+</form>
+<script>asyncJs( 'https://cse.google.com/brand?form=search-form' )</script>
+            <hr />
+            <div id="poweredBy">
+              <div class="clear"></div>
+    <div id="twitter" style="border:none; margin-top: 10px">
+    <a href="https://twitter.com/ApacheHelix"; class="twitter-follow-button" 
data-show-count="false" data-align="left" data-size="medium" 
data-show-screen-name="true" data-lang="en">Follow ApacheHelix</a>
+    <script>!function(d,s,id){var 
js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
+    </div>
+              <div class="clear"></div>
+              <div class="clear"></div>
+<a href="http://maven.apache.org/"; title="Built by Maven" 
class="poweredBy"><img class="builtBy" alt="Built by Maven" 
src="../images/logos/maven-feather.png" /></a>
+            </div>
+          </div>
+        </header>
+        <main id="bodyColumn"  class="span10" >
+<!---
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<section>
+<h2><a name="Service_Discovery"></a>Service Discovery</h2>
+<p>One of the common usage of ZooKeeper is to enable service discovery.
+The basic idea is that when a server starts up it advertises its 
configuration/metadata such as its hostname and port on ZooKeeper.
+This allows clients to dynamically discover the servers that are currently 
active. One can think of this like a service registry to which a server 
registers when it starts and
+is automatically deregistered when it shutdowns or crashes. In many cases it 
serves as an alternative to VIPs.</p>
+<p>The core idea behind this is to use ZooKeeper ephemeral nodes. The 
ephemeral nodes are created when the server registers and all its metadata is 
put into a ZNode.
+When the server shutdowns, ZooKeeper automatically removes this ZNode.</p>
+<p>There are two ways the clients can dynamically discover the active 
servers:</p><section>
+<h3><a name="ZooKeeper_Watch"></a>ZooKeeper Watch</h3>
+<p>Clients can set a child watch under specific path on ZooKeeper.
+When a new service is registered/deregistered, ZooKeeper notifies the client 
via a watch event and the client can read the list of services. Even though 
this looks trivial,
+there are lot of things one needs to keep in mind like ensuring that you first 
set the watch back on ZooKeeper before reading data.</p></section><section>
+<h3><a name="Poll"></a>Poll</h3>
+<p>Another approach is for the client to periodically read the ZooKeeper path 
and get the list of services.</p>
+<p>Both approaches have pros and cons, for example setting a watch might 
trigger herd effect if there are large number of clients. This is problematic, 
especially when servers are starting up.
+But the advantage to setting watches is that clients are immediately notified 
of a change which is not true in case of polling.
+In some cases, having both watches and polls makes sense; watch allows one to 
get notifications as soon as possible while poll provides a safety net if a 
watch event is missed because of code bug or ZooKeeper fails to 
notify.</p></section><section>
+<h3><a name="Other_Developer_Considerations"></a>Other Developer 
Considerations</h3>
+<ul>
+
+<li>What happens when the ZooKeeper session expires? All the watches and 
ephemeral nodes previously added or created by this server are lost. One needs 
to add the watches again, recreate the ephemeral nodes, and so on.</li>
+<li>Due to network issues or Java GC pauses session expiry might happen again 
and again; this phenomenon is known as flapping. It's important for the server 
to detect this and deregister itself.</li>
+</ul></section><section>
+<h3><a name="Other_Operational_Considerations"></a>Other Operational 
Considerations</h3>
+<ul>
+
+<li>What if the node is behaving badly? One might kill the server, but it will 
lose the ability to debug. It would be nice to have the ability to mark a 
server as disabled and clients know that a node is disabled and will not 
contact that node.</li>
+</ul></section><section>
+<h3><a name="Configuration_Ownership"></a>Configuration Ownership</h3>
+<p>This is an important aspect that is often ignored in the initial stages of 
your development. Typically, the service discovery pattern means that servers 
start up with some configuration which it simply puts into ZooKeeper. While 
this works well in the beginning, configuration management becomes very 
difficult since the servers themselves are statically configured. Any change in 
server configuration implies restarting the server. Ideally, it will be nice to 
have the ability to change configuration dynamically without having to restart 
a server.</p>
+<p>Ideally you want a hybrid solution, a node starts with minimal 
configuration and gets the rest of configuration from 
ZooKeeper.</p></section><section>
+<h3><a name="Using_Helix_for_Service_Discovery"></a>Using Helix for Service 
Discovery</h3>
+<p>Even though Helix has a higher-level abstraction in terms of state 
machines, constraints and objectives, service discovery is one of things has 
been a prevalent use case from the start.
+The controller uses the exact mechanism we described above to discover when 
new servers join the cluster. We create these ZNodes under 
/CLUSTERNAME/LIVEINSTANCES.
+Since at any time there is only one controller, we use a ZK watch to track the 
liveness of a server.</p>
+<p>This recipe simply demonstrates how one can re-use that part for 
implementing service discovery. This demonstrates multiple modes of service 
discovery:</p>
+<ul>
+
+<li>POLL: The client reads from zookeeper at regular intervals 30 seconds. Use 
this if you have 100's of clients</li>
+<li>WATCH: The client sets up watcher and gets notified of the changes. Use 
this if you have 10's of clients</li>
+<li>NONE: This does neither of the above, but reads directly from zookeeper 
when ever needed</li>
+</ul>
+<p>Helix provides these additional features compared to other implementations 
available elsewhere:</p>
+<ul>
+
+<li>It has the concept of disabling a node which means that a badly behaving 
node can be disabled using the Helix admin API</li>
+<li>It automatically detects if a node connects/disconnects from zookeeper 
repeatedly and disables the node</li>
+<li>Configuration management
+<ul>
+
+<li>Allows one to set configuration via the admin API at various granulaties 
like cluster, instance, resource, partition</li>
+<li>Configurations can be dynamically changed</li>
+<li>The server is notified when configurations change</li>
+</ul>
+</li>
+</ul></section><section>
+<h3><a name="Checkout_and_Build"></a>Checkout and Build</h3>
+
+<div class="source"><pre class="prettyprint"><code>git clone 
https://git-wip-us.apache.org/repos/asf/helix.git
+cd helix
+git checkout tags/helix-1.0.3
+mvn clean install package -DskipTests
+cd recipes/service-discovery/target/service-discovery-pkg/bin
+chmod +x *
+</code></pre></div></section><section>
+<h3><a name="Start_ZooKeeper"></a>Start ZooKeeper</h3>
+
+<div class="source"><pre 
class="prettyprint"><code>./start-standalone-zookeeper 2199
+</code></pre></div></section><section>
+<h3><a name="Run_the_Demo"></a>Run the Demo</h3>
+
+<div class="source"><pre class="prettyprint"><code>./service-discovery-demo.sh
+</code></pre></div></section><section>
+<h3><a name="Output"></a>Output</h3>
+
+<div class="source"><pre class="prettyprint"><code>START:Service discovery 
demo mode:WATCH
+       Registering service
+               host.x.y.z_12000
+               host.x.y.z_12001
+               host.x.y.z_12002
+               host.x.y.z_12003
+               host.x.y.z_12004
+       SERVICES AVAILABLE
+               SERVICENAME     HOST                    PORT
+               myServiceName   host.x.y.z              12000
+               myServiceName   host.x.y.z              12001
+               myServiceName   host.x.y.z              12002
+               myServiceName   host.x.y.z              12003
+               myServiceName   host.x.y.z              12004
+       Deregistering service:
+               host.x.y.z_12002
+       SERVICES AVAILABLE
+               SERVICENAME     HOST                    PORT
+               myServiceName   host.x.y.z              12000
+               myServiceName   host.x.y.z              12001
+               myServiceName   host.x.y.z              12003
+               myServiceName   host.x.y.z              12004
+       Registering service:host.x.y.z_12002
+END:Service discovery demo mode:WATCH
+=============================================
+START:Service discovery demo mode:POLL
+       Registering service
+               host.x.y.z_12000
+               host.x.y.z_12001
+               host.x.y.z_12002
+               host.x.y.z_12003
+               host.x.y.z_12004
+       SERVICES AVAILABLE
+               SERVICENAME     HOST                    PORT
+               myServiceName   host.x.y.z              12000
+               myServiceName   host.x.y.z              12001
+               myServiceName   host.x.y.z              12002
+               myServiceName   host.x.y.z              12003
+               myServiceName   host.x.y.z              12004
+       Deregistering service:
+               host.x.y.z_12002
+       Sleeping for poll interval:30000
+       SERVICES AVAILABLE
+               SERVICENAME     HOST                    PORT
+               myServiceName   host.x.y.z              12000
+               myServiceName   host.x.y.z              12001
+               myServiceName   host.x.y.z              12003
+               myServiceName   host.x.y.z              12004
+       Registering service:host.x.y.z_12002
+END:Service discovery demo mode:POLL
+=============================================
+START:Service discovery demo mode:NONE
+       Registering service
+               host.x.y.z_12000
+               host.x.y.z_12001
+               host.x.y.z_12002
+               host.x.y.z_12003
+               host.x.y.z_12004
+       SERVICES AVAILABLE
+               SERVICENAME     HOST                    PORT
+               myServiceName   host.x.y.z              12000
+               myServiceName   host.x.y.z              12001
+               myServiceName   host.x.y.z              12002
+               myServiceName   host.x.y.z              12003
+               myServiceName   host.x.y.z              12004
+       Deregistering service:
+               host.x.y.z_12000
+       SERVICES AVAILABLE
+               SERVICENAME     HOST                    PORT
+               myServiceName   host.x.y.z              12001
+               myServiceName   host.x.y.z              12002
+               myServiceName   host.x.y.z              12003
+               myServiceName   host.x.y.z              12004
+       Registering service:host.x.y.z_12000
+END:Service discovery demo mode:NONE
+=============================================
+</code></pre></div></section></section>
+        </main>
+      </div>
+    </div>
+    <hr/>
+    <footer>
+      <div class="container-fluid">
+        <div class="row-fluid">
+<div class="row span16"><div>Apache Helix, Apache, the Apache feather logo, 
and the Apache Helix project logos are trademarks of The Apache Software 
Foundation.
+        All other marks mentioned may be trademarks or registered trademarks 
of their respective owners.</div>
+        <a 
href="https://helix.apache.org/1.0.3-docs/privacy-policy.html";>Privacy 
Policy</a>
+      </div>
+        </div>
+      </div>
+    </footer>
+<script>
+       if(anchors) {
+         anchors.add();
+       }
+</script>
+  </body>
+</html>
\ No newline at end of file


Reply via email to