Added: helix/site-content/1.3.2-docs/tutorial_user_def_rebalancer.html URL: http://svn.apache.org/viewvc/helix/site-content/1.3.2-docs/tutorial_user_def_rebalancer.html?rev=1926553&view=auto ============================================================================== --- helix/site-content/1.3.2-docs/tutorial_user_def_rebalancer.html (added) +++ helix/site-content/1.3.2-docs/tutorial_user_def_rebalancer.html Wed Jun 18 18:28:44 2025 @@ -0,0 +1,400 @@ + +<!DOCTYPE html> + + + + + + +<!-- + Generated by Apache Maven Doxia at 2025-06-18 Rendered using Reflow Maven Skin 2.0.0 (https://olamy.github.io/reflow-maven-skin) +--> +<html xml:lang="en" lang="en"> + + <head> + <meta charset="UTF-8" /> + <title>Apache Helix – Tutorial - User-Defined Rebalancing</title> + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + <meta name="description" content="" /> + <meta http-equiv="content-language" content="en" /> + + <link href="./css/bootstrap.min.css" rel="stylesheet" /> + <link href="./css/bootstrap-responsive.min.css" rel="stylesheet" /> + <link href="./css/docs.css" rel="stylesheet" /> + <link href="./css/reflow-skin.css" rel="stylesheet" /> + + + <link href="./css/lightbox.css" rel="stylesheet" /> + + <link href="./css/site.css" rel="stylesheet" /> + <link href="./css/print.css" rel="stylesheet" media="print" /> + + <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements --> + <!--[if lt IE 9]> + <script src="./js/html5.js"></script> + <![endif]--> + + + + + + +<!-- Matomo --> +<script> + var _paq = window._paq = window._paq || []; + _paq.push(['disableCookies']); + _paq.push(['trackPageView']); + _paq.push(['enableLinkTracking']); + + (function() { + var u="https://analytics.apache.org"; + _paq.push(['setTrackerUrl', u+'/matomo.php']); + _paq.push(['setSiteId', '15']); + var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; + g.async=true; g.src=u+'/matomo.js'; s.parentNode.insertBefore(g,s); + })(); +</script> +<!-- End Matomo Code --> + </head> + + <body class="page-tutorial_user_def_rebalancer project-132-docs" data-spy="scroll" data-offset="60" data-target="#toc-scroll-target"> + + + <div class="navbar navbar-fixed-top"> + <div class="navbar-inner"> + <div class="container"> + <a class="btn btn-navbar" data-toggle="collapse" data-target="#top-nav-collapse"> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </a> + <a class="brand" href="http://helix.apache.org">Apache Helix</a> + <div class="nav-collapse collapse" id="top-nav-collapse"> + <ul class="nav pull-right"> + <li ><a href="index.html" title="Helix 1.3.2">Helix 1.3.2</a></li> + <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.3.2.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.3.2" 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> + </div><!--/.nav-collapse --> + </div> + </div> + </div> + + <div class="container"> + + <!-- Masthead + ================================================== --> + + <header> + <div class="jumbotron subhead"> + <div class="row" id="banner"> + <div class="span12"> + <div class="pull-left"> + <a href="http://helix.apache.org/" id="bannerLeft"><img src="../images/helix-logo.jpg" alt='"''"' /></a> + <p class="lead">A cluster management framework for partitioned and replicated distributed resources</p> + </div> + <div class="pull-right"> + <a href="http://www.apache.org/" id="bannerRight"><img src="../images/feather_small.gif" alt='"''"' /></a> + </div> + </div> + </div> + </div> + <div> + <ul class="breadcrumb"> + <li><a href="../" title="Apache Helix">Apache Helix</a></li> + <li class="divider">/</li> + <li><a href="./" title="Release 1.3.2">Release 1.3.2</a></li> + <li class="divider">/</li> + <li>Tutorial - User-Defined Rebalancing</li> + <li class="publishDate version-date pull-right">Last Published: 2025-06-18</li> + </ul> + </div> + </header> + + <div class="main-body"> + <div class="row"> + <div class="span12"> + <div class="body-content"> +<!-- +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> + <div class="page-header"> + <h2 id="Helix_Tutorial:_User-Defined_Rebalancing"><a href="./Tutorial.html">Helix Tutorial</a>: User-Defined Rebalancing</h2> + </div> + <p>Even though Helix can compute both the location and the state of replicas internally using a default fully-automatic rebalancer, specific applications may require rebalancing strategies that optimize for different requirements. Thus, Helix allows applications to plug in arbitrary rebalancer algorithms that implement a provided interface. One of the main design goals of Helix is to provide maximum flexibility to any distributed application. Thus, it allows applications to fully implement the rebalancer, which is the core constraint solver in the system, if the application developer so chooses.</p> + <p>Whenever the state of the cluster changes, as is the case when participants join or leave the cluster, Helix automatically calls the rebalancer to compute a new mapping of all the replicas in the resource. When using a pluggable rebalancer, the only required step is to register it with Helix. Subsequently, no additional bootstrapping steps are necessary. Helix uses reflection to look up and load the class dynamically at runtime. As a result, it is also technically possible to change the rebalancing strategy used at any time.</p> + <p>The Rebalancer interface is as follows:</p> + <div class="source"> + <pre><code>void init(HelixManager manager); + +IdealState computeNewIdealState(String resourceName, IdealState currentIdealState, + final CurrentStateOutput currentStateOutput, final ClusterDataCache clusterData); +</code></pre> + </div> + <p>The first parameter is the resource to rebalance, the second is pre-existing ideal mappings, the third is a snapshot of the actual placements and state assignments, and the fourth is a full cache of all of the cluster data available to Helix. Internally, Helix implements the same interface for its own rebalancing routines, so a user-defined rebalancer will be cognizant of the same information about the cluster as an internal implementation. Helix strives to provide applications the ability to implement algorithms that may require a large portion of the entire state of the cluster to make the best placement and state assignment decisions possible.</p> + <p>An IdealState is a full representation of the location of each replica of each partition of a given resource. This is a simple representation of the placement that the algorithm believes is the best possible. If the placement meets all defined constraints, this is what will become the actual state of the distributed system.</p> + <section> + <h3 id="Specifying_a_Rebalancer">Specifying a Rebalancer</h3> + <p>For implementations that set up the cluster through existing code, the following HelixAdmin calls will update the Rebalancer class:</p> + <div class="source"> + <pre><code>IdealState idealState = helixAdmin.getResourceIdealState(clusterName, resourceName); +idealState.setRebalanceMode(RebalanceMode.USER_DEFINED); +idealState.setRebalancerClassName(className); +helixAdmin.setResourceIdealState(clusterName, resourceName, idealState); +</code></pre> + </div> + <p>There are two key fields to set to specify that a pluggable rebalancer should be used. First, the rebalance mode should be set to USER_DEFINED, and second the rebalancer class name should be set to a class that implements Rebalancer and is within the scope of the project. The class name is a fully-qualified class name consisting of its package and its name. Without specification of the USER_DEFINED mode, the user-defined rebalancer class will not be used even if specified. Furthermore, Helix will not attempt to rebalance the resources through its standard routines if its mode is USER_DEFINED, regardless of whether or not a rebalancer class is registered.</p> + </section> + <section> + <h3 id="Example">Example</h3> + <p>In the next release (0.7.0), we will provide a full recipe of a user-defined rebalancer in action.</p> + <p>Consider the case where partitions are locks in a lock manager and 6 locks are to be distributed evenly to a set of participants, and only one participant can hold each lock. We can define a rebalancing algorithm that simply takes the modulus of the lock number and the number of participants to evenly distribute the locks across participants. Helix allows capping the number of partitions a participant can accept, but since locks are lightweight, we do not need to define a restriction in this case. The following is a succinct implementation of this algorithm.</p> + <div class="source"> + <pre><code>@Override +IdealState computeNewIdealState(String resourceName, IdealState currentIdealState, + final CurrentStateOutput currentStateOutput, final ClusterDataCache clusterData) { + // Get the list of live participants in the cluster + List<String> liveParticipants = new ArrayList<String>(clusterData.getLiveInstances().keySet()); + + // Count the number of participants allowed to lock each lock (in this example, this is 1) + int lockHolders = Integer.parseInt(currentIdealState.getReplicas()); + + // Fairly assign the lock state to the participants using a simple mod-based sequential + // assignment. For instance, if each lock can be held by 3 participants, lock 0 would be held + // by participants (0, 1, 2), lock 1 would be held by (1, 2, 3), and so on, wrapping around the + // number of participants as necessary. + int i = 0; + for (String partition : currentIdealState.getPartitionSet()) { + List<String> preferenceList = new ArrayList<String>(); + for (int j = i; j < i + lockHolders; j++) { + int participantIndex = j % liveParticipants.size(); + String participant = liveParticipants.get(participantIndex); + // enforce that a participant can only have one instance of a given lock + if (!preferenceList.contains(participant)) { + preferenceList.add(participant); + } + } + currentIdealState.setPreferenceList(partition, preferenceList); + i++; + } + return assignment; +} +</code></pre> + </div> + <p>Here are the IdealState preference lists emitted by the user-defined rebalancer for a 3-participant system whenever there is a change to the set of participants.</p> + <ul> + <li>Participant_A joins</li> + </ul> + <div class="source"> + <pre><code>{ + "lock_0": ["Participant_A"], + "lock_1": ["Participant_A"], + "lock_2": ["Participant_A"], + "lock_3": ["Participant_A"], + "lock_4": ["Participant_A"], + "lock_5": ["Participant_A"], +} +</code></pre> + </div> + <p>A preference list is a mapping for each resource of partition to the participants serving each replica. The state model is a simple LOCKED/RELEASED model, so participant A holds all lock partitions in the LOCKED state.</p> + <ul> + <li>Participant_B joins</li> + </ul> + <div class="source"> + <pre><code>{ + "lock_0": ["Participant_A"], + "lock_1": ["Participant_B"], + "lock_2": ["Participant_A"], + "lock_3": ["Participant_B"], + "lock_4": ["Participant_A"], + "lock_5": ["Participant_B"], +} +</code></pre> + </div> + <p>Now that there are two participants, the simple mod-based function assigns every other lock to the second participant. On any system change, the rebalancer is invoked so that the application can define how to redistribute its resources.</p> + <ul> + <li>Participant_C joins (steady state)</li> + </ul> + <div class="source"> + <pre><code>{ + "lock_0": ["Participant_A"], + "lock_1": ["Participant_B"], + "lock_2": ["Participant_C"], + "lock_3": ["Participant_A"], + "lock_4": ["Participant_B"], + "lock_5": ["Participant_C"], +} +</code></pre> + </div> + <p>This is the steady state of the system. Notice that four of the six locks now have a different owner. That is because of the naïve modulus-based assignmemt approach used by the user-defined rebalancer. However, the interface is flexible enough to allow you to employ consistent hashing or any other scheme if minimal movement is a system requirement.</p> + <ul> + <li>Participant_B fails</li> + </ul> + <div class="source"> + <pre><code>{ + "lock_0": ["Participant_A"], + "lock_1": ["Participant_C"], + "lock_2": ["Participant_A"], + "lock_3": ["Participant_C"], + "lock_4": ["Participant_A"], + "lock_5": ["Participant_C"], +} +</code></pre> + </div> + <p>On any node failure, as in the case of node addition, the rebalancer is invoked automatically so that it can generate a new mapping as a response to the change. Helix ensures that the Rebalancer has the opportunity to reassign locks as required by the application.</p> + <ul> + <li>Participant_B (or the replacement for the original Participant_B) rejoins</li> + </ul> + <div class="source"> + <pre><code>{ + "lock_0": ["Participant_A"], + "lock_1": ["Participant_B"], + "lock_2": ["Participant_C"], + "lock_3": ["Participant_A"], + "lock_4": ["Participant_B"], + "lock_5": ["Participant_C"], +} +</code></pre> + </div> + <p>The rebalancer was invoked once again and the resulting IdealState preference lists reflect the steady state.</p> + </section> + <section> + <h3 id="Caveats">Caveats</h3> + <ul> + <li>The rebalancer class must be available at runtime, or else Helix will not attempt to rebalance at all</li> + <li>The Helix controller will only take into account the preference lists in the new IdealState for this release. In 0.7.0, Helix rebalancers will be able to compute the full resource assignment, including the states.</li> + <li>Helix does not currently persist the new IdealState computed by the user-defined rebalancer. However, the Helix property store is available for saving any computed state. In 0.7.0, Helix will persist the result of running the rebalancer.</li> + </ul> + </section> +</section> + </div> + </div> + </div> + </div> + + </div><!-- /container --> + + <!-- Footer + ================================================== --> + <footer class="well"> + <div class="container"> + <div class="row"> + <div class="span3 bottom-nav"> + <ul class="nav nav-list"> + <li class="nav-header">Get Helix</li> + <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.3.2.html" title="Release Notes">Release Notes</a> + </li> + </ul> + </div> + <div class="span3 bottom-nav"> + <ul class="nav nav-list"> + <li class="nav-header">Hands-On</li> + <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.3.2" title="Javadocs">Javadocs</a> + </li> + </ul> + </div> + <div class="span3 bottom-nav"> + <ul class="nav nav-list"> + <li class="nav-header">Recipes</li> + <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> + </div> + </div> + </div> + </footer> + + <div class="container subfooter"> + <div class="row"> + <div class="span12"> + <p class="pull-right"><a href="#">Back to top</a></p> + <p class="copyright">Copyright ©2025 <a href="http://www.apache.org">Apache Software Foundation</a>. All Rights Reserved.</p> + <p><a href="https://github.com/olamy/reflow-maven-skin" title="Reflow Maven skin">Reflow Maven skin</a> maintained by <a href="https://twitter.com/olamy" target="_blank" title="Olivier Lamy">Olivier Lamy</a>.</p> + <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.3.2-docs/privacy-policy.html">Privacy Policy</a> + </div> + </div> + </div> + </div> + + <!-- Le javascript + ================================================== --> + <!-- Placed at the end of the document so the pages load faster --> + <script src="./js/jquery.min.js"></script> + + <script src="./js/bootstrap.min.js"></script> + <script src="./js/lightbox.min.js"></script> + <script src="./js/reflow-scroll.js"></script> + + <script src="./js/reflow-skin.js"></script> + + </body> +</html> \ No newline at end of file
Added: helix/site-content/1.3.2-docs/tutorial_yaml.html URL: http://svn.apache.org/viewvc/helix/site-content/1.3.2-docs/tutorial_yaml.html?rev=1926553&view=auto ============================================================================== --- helix/site-content/1.3.2-docs/tutorial_yaml.html (added) +++ helix/site-content/1.3.2-docs/tutorial_yaml.html Wed Jun 18 18:28:44 2025 @@ -0,0 +1,329 @@ + +<!DOCTYPE html> + + + + + + +<!-- + Generated by Apache Maven Doxia at 2025-06-18 Rendered using Reflow Maven Skin 2.0.0 (https://olamy.github.io/reflow-maven-skin) +--> +<html xml:lang="en" lang="en"> + + <head> + <meta charset="UTF-8" /> + <title>Apache Helix – Tutorial - YAML Cluster Setup</title> + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + <meta name="description" content="" /> + <meta http-equiv="content-language" content="en" /> + + <link href="./css/bootstrap.min.css" rel="stylesheet" /> + <link href="./css/bootstrap-responsive.min.css" rel="stylesheet" /> + <link href="./css/docs.css" rel="stylesheet" /> + <link href="./css/reflow-skin.css" rel="stylesheet" /> + + + <link href="./css/lightbox.css" rel="stylesheet" /> + + <link href="./css/site.css" rel="stylesheet" /> + <link href="./css/print.css" rel="stylesheet" media="print" /> + + <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements --> + <!--[if lt IE 9]> + <script src="./js/html5.js"></script> + <![endif]--> + + + + + + +<!-- Matomo --> +<script> + var _paq = window._paq = window._paq || []; + _paq.push(['disableCookies']); + _paq.push(['trackPageView']); + _paq.push(['enableLinkTracking']); + + (function() { + var u="https://analytics.apache.org"; + _paq.push(['setTrackerUrl', u+'/matomo.php']); + _paq.push(['setSiteId', '15']); + var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; + g.async=true; g.src=u+'/matomo.js'; s.parentNode.insertBefore(g,s); + })(); +</script> +<!-- End Matomo Code --> + </head> + + <body class="page-tutorial_yaml project-132-docs" data-spy="scroll" data-offset="60" data-target="#toc-scroll-target"> + + + <div class="navbar navbar-fixed-top"> + <div class="navbar-inner"> + <div class="container"> + <a class="btn btn-navbar" data-toggle="collapse" data-target="#top-nav-collapse"> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </a> + <a class="brand" href="http://helix.apache.org">Apache Helix</a> + <div class="nav-collapse collapse" id="top-nav-collapse"> + <ul class="nav pull-right"> + <li ><a href="index.html" title="Helix 1.3.2">Helix 1.3.2</a></li> + <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.3.2.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.3.2" 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> + </div><!--/.nav-collapse --> + </div> + </div> + </div> + + <div class="container"> + + <!-- Masthead + ================================================== --> + + <header> + <div class="jumbotron subhead"> + <div class="row" id="banner"> + <div class="span12"> + <div class="pull-left"> + <a href="http://helix.apache.org/" id="bannerLeft"><img src="../images/helix-logo.jpg" alt='"''"' /></a> + <p class="lead">A cluster management framework for partitioned and replicated distributed resources</p> + </div> + <div class="pull-right"> + <a href="http://www.apache.org/" id="bannerRight"><img src="../images/feather_small.gif" alt='"''"' /></a> + </div> + </div> + </div> + </div> + <div> + <ul class="breadcrumb"> + <li><a href="../" title="Apache Helix">Apache Helix</a></li> + <li class="divider">/</li> + <li><a href="./" title="Release 1.3.2">Release 1.3.2</a></li> + <li class="divider">/</li> + <li>Tutorial - YAML Cluster Setup</li> + <li class="publishDate version-date pull-right">Last Published: 2025-06-18</li> + </ul> + </div> + </header> + + <div class="main-body"> + <div class="row"> + <div class="span12"> + <div class="body-content"> +<!-- +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> + <div class="page-header"> + <h2 id="Helix_Tutorial:_YAML_Cluster_Setup"><a href="./Tutorial.html">Helix Tutorial</a>: YAML Cluster Setup</h2> + </div> + <p>As an alternative to using Helix Admin to set up the cluster, its resources, constraints, and the state model, Helix supports bootstrapping a cluster configuration based on a YAML file. Below is an annotated example of such a file for a simple distributed lock manager where a lock can only be LOCKED or RELEASED, and each lock only allows a single participant to hold it in the LOCKED state.</p> + <div class="source"> + <pre><code>clusterName: lock-manager-custom-rebalancer # unique name for the cluster (required) +resources: + - name: lock-group # unique resource name (required) + rebalancer: # required + mode: USER_DEFINED # required - USER_DEFINED means we will provide our own rebalancer + class: org.apache.helix.userdefinedrebalancer.LockManagerRebalancer # required for USER_DEFINED + partitions: + count: 12 # number of partitions for the resource (default is 1) + replicas: 1 # number of replicas per partition (default is 1) + stateModel: + name: lock-unlock # model name (required) + states: [LOCKED, RELEASED, DROPPED] # the list of possible states (required if model not built-in) + transitions: # the list of possible transitions (required if model not built-in) + - name: Unlock + from: LOCKED + to: RELEASED + - name: Lock + from: RELEASED + to: LOCKED + - name: DropLock + from: LOCKED + to: DROPPED + - name: DropUnlock + from: RELEASED + to: DROPPED + - name: Undrop + from: DROPPED + to: RELEASED + initialState: RELEASED # (required if model not built-in) + constraints: + state: + counts: # maximum number of replicas of a partition that can be in each state (required if model not built-in) + - name: LOCKED + count: "1" + - name: RELEASED + count: "-1" + - name: DROPPED + count: "-1" + priorityList: [LOCKED, RELEASED, DROPPED] # states in order of priority (all priorities equal if not specified) + transition: # transitions priority to enforce order that transitions occur + priorityList: [Unlock, Lock, Undrop, DropUnlock, DropLock] # all priorities equal if not specified +participants: # list of nodes that can serve replicas (optional if dynamic joining is active, required otherwise) + - name: localhost_12001 + host: localhost + port: 12001 + - name: localhost_12002 + host: localhost + port: 12002 + - name: localhost_12003 + host: localhost + port: 12003 +</code></pre> + </div> + <p>Using a file like the one above, the cluster can be set up either with the command line:</p> + <div class="source"> + <pre><code>helix/helix-core/target/helix-core/pkg/bin/YAMLClusterSetup.sh localhost:2199 lock-manager-config.yaml +</code></pre> + </div> + <p>or with code:</p> + <div class="source"> + <pre><code>YAMLClusterSetup setup = new YAMLClusterSetup(zkAddress); +InputStream input = + Thread.currentThread().getContextClassLoader() + .getResourceAsStream("lock-manager-config.yaml"); +YAMLClusterSetup.YAMLClusterConfig config = setup.setupCluster(input); +</code></pre> + </div> + <p>Some notes:</p> + <ul> + <li> <p>A rebalancer class is only required for the USER_DEFINED mode. It is ignored otherwise.</p> </li> + <li> <p>Built-in state models, like OnlineOffline, LeaderStandby, and MasterSlave, or state models that have already been added only require a name for stateModel. If partition and/or replica counts are not provided, a value of 1 is assumed.</p> </li> + </ul> +</section> + </div> + </div> + </div> + </div> + + </div><!-- /container --> + + <!-- Footer + ================================================== --> + <footer class="well"> + <div class="container"> + <div class="row"> + <div class="span3 bottom-nav"> + <ul class="nav nav-list"> + <li class="nav-header">Get Helix</li> + <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.3.2.html" title="Release Notes">Release Notes</a> + </li> + </ul> + </div> + <div class="span3 bottom-nav"> + <ul class="nav nav-list"> + <li class="nav-header">Hands-On</li> + <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.3.2" title="Javadocs">Javadocs</a> + </li> + </ul> + </div> + <div class="span3 bottom-nav"> + <ul class="nav nav-list"> + <li class="nav-header">Recipes</li> + <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> + </div> + </div> + </div> + </footer> + + <div class="container subfooter"> + <div class="row"> + <div class="span12"> + <p class="pull-right"><a href="#">Back to top</a></p> + <p class="copyright">Copyright ©2025 <a href="http://www.apache.org">Apache Software Foundation</a>. All Rights Reserved.</p> + <p><a href="https://github.com/olamy/reflow-maven-skin" title="Reflow Maven skin">Reflow Maven skin</a> maintained by <a href="https://twitter.com/olamy" target="_blank" title="Olivier Lamy">Olivier Lamy</a>.</p> + <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.3.2-docs/privacy-policy.html">Privacy Policy</a> + </div> + </div> + </div> + </div> + + <!-- Le javascript + ================================================== --> + <!-- Placed at the end of the document so the pages load faster --> + <script src="./js/jquery.min.js"></script> + + <script src="./js/bootstrap.min.js"></script> + <script src="./js/lightbox.min.js"></script> + <script src="./js/reflow-scroll.js"></script> + + <script src="./js/reflow-skin.js"></script> + + </body> +</html> \ No newline at end of file Added: helix/site-content/1.4.1-docs/.htaccess URL: http://svn.apache.org/viewvc/helix/site-content/1.4.1-docs/.htaccess?rev=1926553&view=auto ============================================================================== --- helix/site-content/1.4.1-docs/.htaccess (added) +++ helix/site-content/1.4.1-docs/.htaccess Wed Jun 18 18:28:44 2025 @@ -0,0 +1,20 @@ +# +# 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. +# + +Redirect /download.html /download.cgi Added: helix/site-content/1.4.1-docs/Building.html URL: http://svn.apache.org/viewvc/helix/site-content/1.4.1-docs/Building.html?rev=1926553&view=auto ============================================================================== --- helix/site-content/1.4.1-docs/Building.html (added) +++ helix/site-content/1.4.1-docs/Building.html Wed Jun 18 18:28:44 2025 @@ -0,0 +1,277 @@ + +<!DOCTYPE html> + + + + + + +<!-- + Generated by Apache Maven Doxia at 2024-11-18 Rendered using Reflow Maven Skin 2.0.0 (https://olamy.github.io/reflow-maven-skin) +--> +<html xml:lang="en" lang="en"> + + <head> + <meta charset="UTF-8" /> + <title>Apache Helix – Build Instructions</title> + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + <meta name="description" content="" /> + <meta http-equiv="content-language" content="en" /> + + <link href="./css/bootstrap.min.css" rel="stylesheet" /> + <link href="./css/bootstrap-responsive.min.css" rel="stylesheet" /> + <link href="./css/docs.css" rel="stylesheet" /> + <link href="./css/reflow-skin.css" rel="stylesheet" /> + + + <link href="./css/lightbox.css" rel="stylesheet" /> + + <link href="./css/site.css" rel="stylesheet" /> + <link href="./css/print.css" rel="stylesheet" media="print" /> + + <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements --> + <!--[if lt IE 9]> + <script src="./js/html5.js"></script> + <![endif]--> + + + + + + +<!-- Matomo --> +<script> + var _paq = window._paq = window._paq || []; + _paq.push(['disableCookies']); + _paq.push(['trackPageView']); + _paq.push(['enableLinkTracking']); + + (function() { + var u="https://analytics.apache.org"; + _paq.push(['setTrackerUrl', u+'/matomo.php']); + _paq.push(['setSiteId', '15']); + var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; + g.async=true; g.src=u+'/matomo.js'; s.parentNode.insertBefore(g,s); + })(); +</script> +<!-- End Matomo Code --> + </head> + + <body class="page-building project-141-docs" data-spy="scroll" data-offset="60" data-target="#toc-scroll-target"> + + + <div class="navbar navbar-fixed-top"> + <div class="navbar-inner"> + <div class="container"> + <a class="btn btn-navbar" data-toggle="collapse" data-target="#top-nav-collapse"> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </a> + <a class="brand" href="http://helix.apache.org">Apache Helix</a> + <div class="nav-collapse collapse" id="top-nav-collapse"> + <ul class="nav pull-right"> + <li ><a href="index.html" title="Helix 1.4.1">Helix 1.4.1</a></li> + <li class="dropdown active"> + <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 class="active"><a href="" title="Building">Building</a></li> + <li ><a href="releasenotes/release-1.4.1.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.4.1" 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> + </div><!--/.nav-collapse --> + </div> + </div> + </div> + + <div class="container"> + + <!-- Masthead + ================================================== --> + + <header> + <div class="jumbotron subhead"> + <div class="row" id="banner"> + <div class="span12"> + <div class="pull-left"> + <a href="http://helix.apache.org/" id="bannerLeft"><img src="../images/helix-logo.jpg" alt='"''"' /></a> + <p class="lead">A cluster management framework for partitioned and replicated distributed resources</p> + </div> + <div class="pull-right"> + <a href="http://www.apache.org/" id="bannerRight"><img src="../images/feather_small.gif" alt='"''"' /></a> + </div> + </div> + </div> + </div> + <div> + <ul class="breadcrumb"> + <li><a href="../" title="Apache Helix">Apache Helix</a></li> + <li class="divider">/</li> + <li><a href="./" title="Release 1.4.1">Release 1.4.1</a></li> + <li class="divider">/</li> + <li>Build Instructions</li> + <li class="publishDate version-date pull-right">Last Published: 2024-11-18</li> + </ul> + </div> + </header> + + <div class="main-body"> + <div class="row"> + <div class="span12"> + <div class="body-content"> +<!-- +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> + <div class="page-header"> + <h2 id="Build_Instructions">Build Instructions</h2> + </div> + <section> + <h3 id="From_Source">From Source</h3> + <p>Requirements: JDK 1.8+, Maven 3.5.0+</p> + <div class="source"> + <pre><code>git clone https://git-wip-us.apache.org/repos/asf/helix.git +cd helix +git checkout tags/helix-1.4.1 +mvn install package -DskipTests +</code></pre> + </div> + </section> + <section> + <h3 id="Maven_Dependency">Maven Dependency</h3> + <div class="source"> + <pre><code><dependency> + <groupId>org.apache.helix</groupId> + <artifactId>helix-core</artifactId> + <version>1.4.1</version> +</dependency> +</code></pre> + </div> + </section> +</section> + </div> + </div> + </div> + </div> + + </div><!-- /container --> + + <!-- Footer + ================================================== --> + <footer class="well"> + <div class="container"> + <div class="row"> + <div class="span3 bottom-nav"> + <ul class="nav nav-list"> + <li class="nav-header">Get Helix</li> + <li > + <a href="download.html" title="Download">Download</a> + </li> + <li class="active"> + <a href="#" title="Building">Building</a> + </li> + <li > + <a href="releasenotes/release-1.4.1.html" title="Release Notes">Release Notes</a> + </li> + </ul> + </div> + <div class="span3 bottom-nav"> + <ul class="nav nav-list"> + <li class="nav-header">Hands-On</li> + <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.4.1" title="Javadocs">Javadocs</a> + </li> + </ul> + </div> + <div class="span3 bottom-nav"> + <ul class="nav nav-list"> + <li class="nav-header">Recipes</li> + <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> + </div> + </div> + </div> + </footer> + + <div class="container subfooter"> + <div class="row"> + <div class="span12"> + <p class="pull-right"><a href="#">Back to top</a></p> + <p class="copyright">Copyright ©2024 <a href="http://www.apache.org">Apache Software Foundation</a>. All Rights Reserved.</p> + <p><a href="https://github.com/olamy/reflow-maven-skin" title="Reflow Maven skin">Reflow Maven skin</a> maintained by <a href="https://twitter.com/olamy" target="_blank" title="Olivier Lamy">Olivier Lamy</a>.</p> + <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.4.1-docs/privacy-policy.html">Privacy Policy</a> + </div> + </div> + </div> + </div> + + <!-- Le javascript + ================================================== --> + <!-- Placed at the end of the document so the pages load faster --> + <script src="./js/jquery.min.js"></script> + + <script src="./js/bootstrap.min.js"></script> + <script src="./js/lightbox.min.js"></script> + <script src="./js/reflow-scroll.js"></script> + + <script src="./js/reflow-skin.js"></script> + + </body> +</html> \ No newline at end of file Added: helix/site-content/1.4.1-docs/Features.html URL: http://svn.apache.org/viewvc/helix/site-content/1.4.1-docs/Features.html?rev=1926553&view=auto ============================================================================== --- helix/site-content/1.4.1-docs/Features.html (added) +++ helix/site-content/1.4.1-docs/Features.html Wed Jun 18 18:28:44 2025 @@ -0,0 +1,485 @@ + +<!DOCTYPE html> + + + + + + +<!-- + Generated by Apache Maven Doxia at 2024-11-18 Rendered using Reflow Maven Skin 2.0.0 (https://olamy.github.io/reflow-maven-skin) +--> +<html xml:lang="en" lang="en"> + + <head> + <meta charset="UTF-8" /> + <title>Apache Helix – Features</title> + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + <meta name="description" content="" /> + <meta http-equiv="content-language" content="en" /> + + <link href="./css/bootstrap.min.css" rel="stylesheet" /> + <link href="./css/bootstrap-responsive.min.css" rel="stylesheet" /> + <link href="./css/docs.css" rel="stylesheet" /> + <link href="./css/reflow-skin.css" rel="stylesheet" /> + + + <link href="./css/lightbox.css" rel="stylesheet" /> + + <link href="./css/site.css" rel="stylesheet" /> + <link href="./css/print.css" rel="stylesheet" media="print" /> + + <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements --> + <!--[if lt IE 9]> + <script src="./js/html5.js"></script> + <![endif]--> + + + + + + +<!-- Matomo --> +<script> + var _paq = window._paq = window._paq || []; + _paq.push(['disableCookies']); + _paq.push(['trackPageView']); + _paq.push(['enableLinkTracking']); + + (function() { + var u="https://analytics.apache.org"; + _paq.push(['setTrackerUrl', u+'/matomo.php']); + _paq.push(['setSiteId', '15']); + var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; + g.async=true; g.src=u+'/matomo.js'; s.parentNode.insertBefore(g,s); + })(); +</script> +<!-- End Matomo Code --> + </head> + + <body class="page-features project-141-docs" data-spy="scroll" data-offset="60" data-target="#toc-scroll-target"> + + + <div class="navbar navbar-fixed-top"> + <div class="navbar-inner"> + <div class="container"> + <a class="btn btn-navbar" data-toggle="collapse" data-target="#top-nav-collapse"> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </a> + <a class="brand" href="http://helix.apache.org">Apache Helix</a> + <div class="nav-collapse collapse" id="top-nav-collapse"> + <ul class="nav pull-right"> + <li ><a href="index.html" title="Helix 1.4.1">Helix 1.4.1</a></li> + <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.4.1.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.4.1" 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> + </div><!--/.nav-collapse --> + </div> + </div> + </div> + + <div class="container"> + + <!-- Masthead + ================================================== --> + + <header> + <div class="jumbotron subhead"> + <div class="row" id="banner"> + <div class="span12"> + <div class="pull-left"> + <a href="http://helix.apache.org/" id="bannerLeft"><img src="../images/helix-logo.jpg" alt='"''"' /></a> + <p class="lead">A cluster management framework for partitioned and replicated distributed resources</p> + </div> + <div class="pull-right"> + <a href="http://www.apache.org/" id="bannerRight"><img src="../images/feather_small.gif" alt='"''"' /></a> + </div> + </div> + </div> + </div> + <div> + <ul class="breadcrumb"> + <li><a href="../" title="Apache Helix">Apache Helix</a></li> + <li class="divider">/</li> + <li><a href="./" title="Release 1.4.1">Release 1.4.1</a></li> + <li class="divider">/</li> + <li>Features</li> + <li class="publishDate version-date pull-right">Last Published: 2024-11-18</li> + </ul> + </div> + </header> + + <div class="main-body"> + <div class="row"> + <div class="span12"> + <div class="body-content"> +<!-- +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> + <div class="page-header"> + <h2 id="Features">Features</h2> + </div> + <section> + <h3 id="CONFIGURING_IDEALSTATE">CONFIGURING IDEALSTATE</h3> + <p>Read concepts page for definition of Idealstate.</p> + <p>The placement of partitions in a DDS is very critical for reliability and scalability of the system. For example, when a node fails, it is important that the partitions hosted on that node are reallocated evenly among the remaining nodes. Consistent hashing is one such algorithm that can guarantee this. Helix by default comes with a variant of consistent hashing based of the RUSH algorithm.</p> + <p>This means given a number of partitions, replicas and number of nodes Helix does the automatic assignment of partition to nodes such that</p> + <ul> + <li>Each node has the same number of partitions and replicas of the same partition do not stay on the same node.</li> + <li>When a node fails, the partitions will be equally distributed among the remaining nodes</li> + <li>When new nodes are added, the number of partitions moved will be minimized along with satisfying the above two criteria.</li> + </ul> + <p>Helix provides multiple ways to control the placement and state of a replica.</p> + <div class="source"> + <pre><code> + |AUTO REBALANCE| AUTO | CUSTOM | + ----------------------------------------- + LOCATION | HELIX | APP | APP | + ----------------------------------------- + STATE | HELIX | HELIX | APP | + ----------------------------------------- +</code></pre> + </div> + <section> + <h4 id="HELIX_EXECUTION_MODE">HELIX EXECUTION MODE</h4> + <p>Idealstate is defined as the state of the DDS when all nodes are up and running and healthy. Helix uses this as the target state of the system and computes the appropriate transitions needed in the system to bring it to a stable state.</p> + <p>Helix supports 3 different execution modes which allows application to explicitly control the placement and state of the replica.</p> + <section> + <h5 id="AUTO_REBALANCE">AUTO_REBALANCE</h5> + <p>When the idealstate mode is set to AUTO_REBALANCE, Helix controls both the location of the replica along with the state. This option is useful for applications where creation of a replica is not expensive. Example</p> + <div class="source"> + <pre><code>{ + "id" : "MyResource", + "simpleFields" : { + "IDEAL_STATE_MODE" : "AUTO_REBALANCE", + "NUM_PARTITIONS" : "3", + "REPLICAS" : "2", + "STATE_MODEL_DEF_REF" : "LeaderStandby", + } + "listFields" : { + "MyResource_0" : [], + "MyResource_1" : [], + "MyResource_2" : [] + }, + "mapFields" : { + } +} +</code></pre> + </div> + <p>If there are 3 nodes in the cluster, then Helix will internally compute the ideal state as</p> + <div class="source"> + <pre><code>{ + "id" : "MyResource", + "simpleFields" : { + "NUM_PARTITIONS" : "3", + "REPLICAS" : "2", + "STATE_MODEL_DEF_REF" : "LeaderStandby", + }, + "mapFields" : { + "MyResource_0" : { + "N1" : "LEADER", + "N2" : "STANDBY", + }, + "MyResource_1" : { + "N2" : "LEADER", + "N3" : "STANDBY", + }, + "MyResource_2" : { + "N3" : "LEADER", + "N1" : "STANDBY", + } + } +} +</code></pre> + </div> + <p>Another typical example is evenly distributing a group of tasks among the currently alive processes. For example, if there are 60 tasks and 4 nodes, Helix assigns 15 tasks to each node. When one node fails Helix redistributes its 15 tasks to the remaining 3 nodes. Similarly, if a node is added, Helix re-allocates 3 tasks from each of the 4 nodes to the 5th node.</p> + </section> + </section> + <section> + <h4 id="AUTO">AUTO</h4> + <p>When the idealstate mode is set to AUTO, Helix only controls STATE of the replicas where as the location of the partition is controlled by application. Example: The below idealstate indicates thats âMyResource_0â must be only on node1 and node2. But gives the control of assigning the STATE to Helix.</p> + <div class="source"> + <pre><code>{ + "id" : "MyResource", + "simpleFields" : { + "IDEAL_STATE_MODE" : "AUTO", + "NUM_PARTITIONS" : "3", + "REPLICAS" : "2", + "STATE_MODEL_DEF_REF" : "LeaderStandby", + } + "listFields" : { + "MyResource_0" : [node1, node2], + "MyResource_1" : [node2, node3], + "MyResource_2" : [node3, node1] + }, + "mapFields" : { + } +} +</code></pre> + </div> + <p>In this mode when node1 fails, unlike in AUTO-REBALANCE mode the partition is not moved from node1 to others nodes in the cluster. Instead, Helix will decide to change the state of MyResource_0 in N2 based on the system constraints. For example, if a system constraint specified that there should be 1 Master and if the Master failed, then node2 will be made the new leader.</p> + </section> + <section> + <h4 id="CUSTOM">CUSTOM</h4> + <p>Helix offers a third mode called CUSTOM, in which application can completely control the placement and state of each replica. Applications will have to implement an interface that Helix will invoke when the cluster state changes. Within this callback, the application can recompute the idealstate. Helix will then issue appropriate transitions such that Idealstate and Currentstate converges.</p> + <div class="source"> + <pre><code>{ + "id" : "MyResource", + "simpleFields" : { + "IDEAL_STATE_MODE" : "CUSTOM", + "NUM_PARTITIONS" : "3", + "REPLICAS" : "2", + "STATE_MODEL_DEF_REF" : "LeaderStandby", + }, + "mapFields" : { + "MyResource_0" : { + "N1" : "LEADER", + "N2" : "STANDBY", + }, + "MyResource_1" : { + "N2" : "LEADER", + "N3" : "STANDBY", + }, + "MyResource_2" : { + "N3" : "LEADER", + "N1" : "STANDBY", + } + } +} +</code></pre> + </div> + <p>For example, the current state of the system might be âMyResource_0â -> {N1:LEADER,N2:STANDBY} and the application changes the ideal state to âMyResource_0â -> {N1:STANDBY,N2:LEADER}. Helix will not blindly issue LEADERâ>STANDBY to N1 and STANDBYâ>LEADER to N2 in parallel since it might result in a transient state where both N1 and N2 are leaders. Helix will first issue LEADERâ>STANDBY to N1 and after its completed it will issue STANDBYâ>LEADER to N2.</p> + </section> + </section> + <section> + <h3 id="State_Machine_Configuration">State Machine Configuration</h3> + <p>Helix comes with 3 default state models that are most commonly used. Its possible to have multiple state models in a cluster. Every resource that is added should have a reference to the state model.</p> + <ul> + <li>MASTER-SLAVE: Has 3 states OFFLINE,SLAVE,MASTER. Max masters is 1. Slaves will be based on the replication factor. Replication factor can be specified while adding the resource</li> + <li>ONLINE-OFFLINE: Has 2 states OFFLINE and ONLINE. Very simple state model and most applications start off with this state model.</li> + <li>LEADER-STANDBY:1 Leader and many stand bys. In general the standby's are idle.</li> + </ul> + <p>Apart from providing the state machine configuration, one can specify the constraints of states and transitions.</p> + <p>For example one can say Master:1. Max number of replicas in Master state at any time is 1. OFFLINE-STANDBY:5 Max number of Offline-Slave transitions that can happen concurrently in the system</p> + <p>STATE PRIORITY Helix uses greedy approach to satisfy the state constraints. For example if the state machine configuration says it needs 1 leader and 2 standbys but only 1 node is active, Helix must promote it to leader. This behavior is achieved by providing the state priority list as LEADER,STANDBY.</p> + <p>STATE TRANSITION PRIORITY Helix tries to fire as many transitions as possible in parallel to reach the stable state without violating constraints. By default Helix simply sorts the transitions alphabetically and fires as many as it can without violating the constraints. One can control this by overriding the priority order.</p> + </section> + <section> + <h3 id="Config_management">Config management</h3> + <p>Helix allows applications to store application specific properties. The configuration can have different scopes.</p> + <ul> + <li>Cluster</li> + <li>Node specific</li> + <li>Resource specific</li> + <li>Partition specific</li> + </ul> + <p>Helix also provides notifications when any configs are changed. This allows applications to support dynamic configuration changes.</p> + <p>See HelixManager.getConfigAccessor for more info</p> + </section> + <section> + <h3 id="Intra_cluster_messaging_api">Intra cluster messaging api</h3> + <p>This is an interesting feature which is quite useful in practice. Often times, nodes in DDS requires a mechanism to interact with each other. One such requirement is a process of bootstrapping a replica.</p> + <p>Consider a search system use case where the index replica starts up and it does not have an index. One of the commonly used solutions is to get the index from a common location or to copy the index from another replica. Helix provides a messaging api, that can be used to talk to other nodes in the system. The value added that Helix provides here is, message recipient can be specified in terms of resource, partition, state and Helix ensures that the message is delivered to all of the required recipients. In this particular use case, the instance can specify the recipient criteria as all replicas of P1. Since Helix is aware of the global state of the system, it can send the message to appropriate nodes. Once the nodes respond Helix provides the bootstrapping replica with all the responses.</p> + <p>This is a very generic api and can also be used to schedule various periodic tasks in the cluster like data backups etc. System Admins can also perform adhoc tasks like on demand backup or execute a system command(like rm -rf ;-)) across all nodes.</p> + <div class="source"> + <pre><code> ClusterMessagingService messagingService = manager.getMessagingService(); + //CONSTRUCT THE MESSAGE + Message requestBackupUriRequest = new Message( + MessageType.USER_DEFINE_MSG, UUID.randomUUID().toString()); + requestBackupUriRequest + .setMsgSubType(BootstrapProcess.REQUEST_BOOTSTRAP_URL); + requestBackupUriRequest.setMsgState(MessageState.NEW); + //SET THE RECIPIENT CRITERIA, All nodes that satisfy the criteria will receive the message + Criteria recipientCriteria = new Criteria(); + recipientCriteria.setInstanceName("%"); + recipientCriteria.setRecipientInstanceType(InstanceType.PARTICIPANT); + recipientCriteria.setResource("MyDB"); + recipientCriteria.setPartition(""); + //Should be processed only the process that is active at the time of sending the message. + //This means if the recipient is restarted after message is sent, it will not be processed. + recipientCriteria.setSessionSpecific(true); + // wait for 30 seconds + int timeout = 30000; + //The handler that will be invoked when any recipient responds to the message. + BootstrapReplyHandler responseHandler = new BootstrapReplyHandler(); + //This will return only after all recipients respond or after timeout. + int sentMessageCount = messagingService.sendAndWait(recipientCriteria, + requestBackupUriRequest, responseHandler, timeout); +</code></pre> + </div> + <p>See HelixManager.getMessagingService for more info.</p> + </section> + <section> + <h3 id="Application_specific_property_storage">Application specific property storage</h3> + <p>There are several usecases where applications needs support for distributed data structures. Helix uses Zookeeper to store the application data and hence provides notifications when the data changes. One value add Helix provides is the ability to specify cache the data and also write through cache. This is more efficient than reading from ZK every time.</p> + <p>See HelixManager.getHelixPropertyStore</p> + </section> + <section> + <h3 id="Throttling">Throttling</h3> + <p>Since all state changes in the system are triggered through transitions, Helix can control the number of transitions that can happen in parallel. Some of the transitions may be light weight but some might involve moving data around which is quite expensive. Helix allows applications to set threshold on transitions. The threshold can be set at the multiple scopes.</p> + <ul> + <li>MessageType e.g STATE_TRANSITION</li> + <li>TransitionType e.g STANDBY-LEADER</li> + <li>Resource e.g database</li> + <li>Node i.e per node max transitions in parallel.</li> + </ul> + <p>See HelixManager.getHelixAdmin.addMessageConstraint()</p> + </section> + <section> + <h3 id="Health_monitoring_and_alerting">Health monitoring and alerting</h3> + <p>This in currently in development mode, not yet productionized.</p> + <p>Helix provides ability for each node in the system to report health metrics on a periodic basis. Helix supports multiple ways to aggregate these metrics like simple SUM, AVG, EXPONENTIAL DECAY, WINDOW. Helix will only persist the aggregated value. Applications can define threshold on the aggregate values according to the SLA's and when the SLA is violated Helix will fire an alert. Currently Helix only fires an alert but eventually we plan to use this metrics to either mark the node dead or load balance the partitions. This feature will be valuable in for distributed systems that support multi-tenancy and have huge variation in work load patterns. Another place this can be used is to detect skewed partitions and rebalance the cluster.</p> + <p>This feature is not yet stable and do not recommend to be used in production.</p> + </section> + <section> + <h3 id="Controller_deployment_modes">Controller deployment modes</h3> + <p>Read Architecture wiki for more details on the Role of a controller. In simple words, it basically controls the participants in the cluster by issuing transitions.</p> + <p>Helix provides multiple options to deploy the controller.</p> + <section> + <h4 id="STANDALONE">STANDALONE</h4> + <p>Controller can be started as a separate process to manage a cluster. This is the recommended approach. How ever since one controller can be a single point of failure, multiple controller processes are required for reliability. Even if multiple controllers are running only one will be actively managing the cluster at any time and is decided by a leader election process. If the leader fails, another leader will resume managing the cluster.</p> + <p>Even though we recommend this method of deployment, it has the drawback of having to manage an additional service for each cluster. See Controller As a Service option.</p> + </section> + <section> + <h4 id="EMBEDDED">EMBEDDED</h4> + <p>If setting up a separate controller process is not viable, then it is possible to embed the controller as a library in each of the participant.</p> + </section> + <section> + <h4 id="CONTROLLER_AS_A_SERVICE">CONTROLLER AS A SERVICE</h4> + <p>One of the cool feature we added in helix was use a set of controllers to manage a large number of clusters. For example if you have X clusters to be managed, instead of deploying X*3(3 controllers for fault tolerance) controllers for each cluster, one can deploy only 3 controllers. Each controller can manage X/3 clusters. If any controller fails the remaining two will manage X/2 clusters. At LinkedIn, we always deploy controllers in this mode.</p> + </section> + </section> +</section> + </div> + </div> + </div> + </div> + + </div><!-- /container --> + + <!-- Footer + ================================================== --> + <footer class="well"> + <div class="container"> + <div class="row"> + <div class="span3 bottom-nav"> + <ul class="nav nav-list"> + <li class="nav-header">Get Helix</li> + <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.4.1.html" title="Release Notes">Release Notes</a> + </li> + </ul> + </div> + <div class="span3 bottom-nav"> + <ul class="nav nav-list"> + <li class="nav-header">Hands-On</li> + <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.4.1" title="Javadocs">Javadocs</a> + </li> + </ul> + </div> + <div class="span3 bottom-nav"> + <ul class="nav nav-list"> + <li class="nav-header">Recipes</li> + <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> + </div> + </div> + </div> + </footer> + + <div class="container subfooter"> + <div class="row"> + <div class="span12"> + <p class="pull-right"><a href="#">Back to top</a></p> + <p class="copyright">Copyright ©2024 <a href="http://www.apache.org">Apache Software Foundation</a>. All Rights Reserved.</p> + <p><a href="https://github.com/olamy/reflow-maven-skin" title="Reflow Maven skin">Reflow Maven skin</a> maintained by <a href="https://twitter.com/olamy" target="_blank" title="Olivier Lamy">Olivier Lamy</a>.</p> + <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.4.1-docs/privacy-policy.html">Privacy Policy</a> + </div> + </div> + </div> + </div> + + <!-- Le javascript + ================================================== --> + <!-- Placed at the end of the document so the pages load faster --> + <script src="./js/jquery.min.js"></script> + + <script src="./js/bootstrap.min.js"></script> + <script src="./js/lightbox.min.js"></script> + <script src="./js/reflow-scroll.js"></script> + + <script src="./js/reflow-skin.js"></script> + + </body> +</html> \ No newline at end of file Added: helix/site-content/1.4.1-docs/JobExample.json URL: http://svn.apache.org/viewvc/helix/site-content/1.4.1-docs/JobExample.json?rev=1926553&view=auto ============================================================================== --- helix/site-content/1.4.1-docs/JobExample.json (added) +++ helix/site-content/1.4.1-docs/JobExample.json Wed Jun 18 18:28:44 2025 @@ -0,0 +1,19 @@ +{ + "id" : "TestJob", + "simpleFields": { + "JobID":"Job2", + "WorkflowID":"Workflow1" + }, + "mapFields":{ + "Task1" : { + "TASK_ID":"Task1", + "TASK_COMMAND":"Backup", + "TASK_TARGET_PARTITION":"p1" + }, + "Task2" : { + "TASK_ID":"Task2", + "TASK_COMMAND":"ReIndex", + } + }, + "listFields":{} +}