helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1877963 [23/27] - in /helix/site-content: ./ 0.6.1-incubating-docs/ 0.6.1-incubating-docs/recipes/ 0.6.1-incubating-docs/releasenotes/ 0.6.2-incubating-docs/ 0.6.2-incubating-docs/recipes/ 0.6.2-incubating-docs/releasenotes/ 0.6.3-docs/ 0....
Date Wed, 20 May 2020 21:05:02 GMT
Added: helix/site-content/0.9.5-docs/tutorial_rest_service.html
URL: http://svn.apache.org/viewvc/helix/site-content/0.9.5-docs/tutorial_rest_service.html?rev=1877963&view=auto
==============================================================================
--- helix/site-content/0.9.5-docs/tutorial_rest_service.html (added)
+++ helix/site-content/0.9.5-docs/tutorial_rest_service.html Wed May 20 21:04:51 2020
@@ -0,0 +1,1231 @@
+
+<!DOCTYPE html>
+<!--
+ Generated by Apache Maven Doxia at 2020-05-11
+ Rendered using Maven Reflow Skin 1.0.0 (http://andriusvelykis.github.com/reflow-maven-skin)
+-->
+<html  xml:lang="en" lang="en">
+
+	<head>
+		<meta charset="UTF-8" />
+		<title>Apache Helix -   Tutorial - REST Service 2.0</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="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+		<![endif]-->
+		
+<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="page-tutorial_rest_service project-095-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=".nav-collapse">
+						<span class="icon-bar"></span>
+						<span class="icon-bar"></span>
+						<span class="icon-bar"></span>
+					</a>
+					<a class="brand" href="..">Apache Helix</a>
+					<div class="nav-collapse">
+						<ul class="nav pull-right">
+							<li><a href="index.html" title="Helix 0.9.5">Helix 0.9.5 </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-0.9.5.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/0.9.5" 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 class="jumbotron subhead">
+		<div class="row" id="banner">
+			<div class="span12">
+				<div class="pull-left">
+					<a href="../" 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>
+			<ul class="breadcrumb">
+				<li><a href="../" title="Apache Helix">Apache Helix </a></li>
+				<li class="divider">/</li>
+				<li><a href="./" title="Release 0.9.5">Release 0.9.5 </a></li>
+				<li class="divider">/</li>
+				<li>  Tutorial - REST Service 2.0</li>
+				<li class="publishDate version-date pull-right">Last Published: 2020-05-11</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. --> 
+<p></p> 
+<div class="section"> 
+ <div class="page-header">
+  <h2 id="Helix_Tutorial:_REST_Service_2.0"><a href="./Tutorial.html">Helix Tutorial</a>: REST Service 2.0</h2>
+ </div> 
+ <p>New Helix REST service supported features:</p> 
+ <ul> 
+  <li>Expose all admin operations via restful API. 
+   <ul> 
+    <li>All of Helix admin operations, include these defined in HelixAdmin.java and ConfigAccessor.java, etc, are exposed via rest API.</li> 
+   </ul></li> 
+  <li>Support all task framework API via restful.Current task framework operations are supported from rest API too.</li> 
+  <li>More standard Restful API 
+   <ul> 
+    <li>Use the standard HTTP methods if possible, GET, POST, PUT, DELETE, instead of customized command as it today.</li> 
+    <li>Customized command will be used if there is no corresponding HTTP methods, for example, rebalance a resource, disable an instance, etc.</li> 
+   </ul></li> 
+  <li>Make Helix restful service an separately deployable service.</li> 
+  <li>Enable Access/Audit log for all write access.</li> 
+ </ul> 
+ <div class="section"> 
+  <h3 id="Installation">Installation</h3> 
+  <p>The command line tool comes with helix-core package:</p> 
+  <p>Get the command line tool:</p> 
+  <div class="source"> 
+   <pre>git clone https://git-wip-us.apache.org/repos/asf/helix.git
+cd helix
+git checkout tags/helix-0.9.5
+./build
+cd helix-rest/target/helix-rest-pkg/bin
+chmod +x *.sh
+</pre> 
+  </div> 
+  <p>Get help:</p> 
+  <div class="source"> 
+   <pre>./run-rest-admin.sh --help
+</pre> 
+  </div> 
+  <p>Start the REST server</p> 
+  <div class="source"> 
+   <pre>./run-rest-admin.sh --port 1234 --zkSvr localhost:2121
+</pre> 
+  </div> 
+ </div> 
+ <div class="section"> 
+  <h3 id="Helix_REST_2.0_Endpoint">Helix REST 2.0 Endpoint</h3> 
+  <p>Helix REST 2.0 endpoint will start with /admin/v2 prefix, and the rest will mostly follow the current URL convention. This allows us to support v2.0 endpoint at the same time with the current Helix web interface. Some sample v2.0 endpoints would look like the following:</p> 
+  <div class="source"> 
+   <pre>curl -X GET http://localhost:12345/admin/v2/clusters
+curl -X POST http://localhost:12345/admin/v2/clusters/myCluster
+curl -X POST http://localhost:12345/admin/v2/clusters/myCluster?command=activate&amp;supercluster=controler_cluster
+curl http://localhost:12345/admin/v2/clusters/myCluster/resources/myResource/IdealState
+</pre> 
+  </div> 
+ </div> 
+ <div class="section"> 
+  <h3 id="REST_Endpoints_and_Supported_Operations">REST Endpoints and Supported Operations</h3> 
+  <div class="section"> 
+   <h4 id="Operations_on_Helix_Cluster">Operations on Helix Cluster</h4> 
+   <ul> 
+    <li> <p><b>“/clusters”</b></p> 
+     <ul> 
+      <li>Represents all helix managed clusters connected to given zookeeper</li> 
+      <li><b>GET</b> – List all Helix managed clusters. Example: curl <a class="externalLink" href="http://localhost:1234/admin/v2/clusters">http://localhost:1234/admin/v2/clusters</a></li> 
+     </ul> 
+     <div class="source"> 
+      <pre>$curl http://localhost:1234/admin/v2/clusters
+{
+  &quot;clusters&quot; : [ &quot;cluster1&quot;, &quot;cluster2&quot;, &quot;cluster3&quot;]
+}
+</pre> 
+     </div></li> 
+   </ul> 
+   <ul> 
+    <li> <p><b>“/clusters/{clusterName}”</b></p> 
+     <ul> 
+      <li>Represents a helix cluster with name {clusterName}</li> 
+      <li><b>GET</b> – return the cluster info. Example: curl <a class="externalLink" href="http://localhost:1234/admin/v2/clusters/myCluster">http://localhost:1234/admin/v2/clusters/myCluster</a></li> 
+     </ul> 
+     <div class="source"> 
+      <pre>```
+$curl http://localhost:1234/admin/v2/clusters/myCluster
+{
+  &quot;id&quot; : &quot;myCluster&quot;,
+  &quot;paused&quot; : true,
+  &quot;disabled&quot; : true,
+  &quot;controller&quot; : &quot;helix.apache.org:1234&quot;,
+  &quot;instances&quot; : [ &quot;aaa.helix.apache.org:1234&quot;, &quot;bbb.helix.apache.org:1234&quot; ],
+  &quot;liveInstances&quot; : [&quot;aaa.helix.apache.org:1234&quot;],
+  &quot;resources&quot; : [ &quot;resource1&quot;, &quot;resource2&quot;, &quot;resource3&quot; ],
+  &quot;stateModelDefs&quot; : [ &quot;MasterSlave&quot;, &quot;LeaderStandby&quot;, &quot;OnlineOffline&quot; ]
+}
+```
+</pre> 
+     </div> 
+     <ul> 
+      <li><b>PUT</b> – create a new cluster with {clusterName}, it returns 200 if the cluster already exists. Example: curl -X PUT <a class="externalLink" href="http://localhost:1234/admin/v2/clusters/myCluster">http://localhost:1234/admin/v2/clusters/myCluster</a></li> 
+      <li><b>DELETE</b> – delete this cluster. Example: curl -X DELETE <a class="externalLink" href="http://localhost:1234/admin/v2/clusters/myCluster">http://localhost:1234/admin/v2/clusters/myCluster</a></li> 
+      <li><b>activate</b> – Link this cluster to a Helix super (controller) cluster, i.e, add the cluster as a resource to the super cluster. Example: curl -X POST <a class="externalLink" href="http://localhost:1234/admin/v2/clusters/myCluster?command=activate&amp;superCluster=myCluster">http://localhost:1234/admin/v2/clusters/myCluster?command=activate&amp;superCluster=myCluster</a></li> 
+      <li><b>expand</b> – In the case that a set of new node is added in the cluster, use this command to balance the resources on the existing instances to new added instances. Example: curl -X POST <a class="externalLink" href="http://localhost:1234/admin/v2/clusters/myCluster?command=expand">http://localhost:1234/admin/v2/clusters/myCluster?command=expand</a></li> 
+      <li><b>enable</b> – enable/resume the cluster. Example: curl -X POST <a class="externalLink" href="http://localhost:1234/admin/v2/clusters/myCluster?command=enable">http://localhost:1234/admin/v2/clusters/myCluster?command=enable</a></li> 
+      <li><b>disable</b> – disable/pause the cluster. Example: curl -X POST <a class="externalLink" href="http://localhost:1234/admin/v2/clusters/myCluster?command=disable">http://localhost:1234/admin/v2/clusters/myCluster?command=disable</a></li> 
+     </ul></li> 
+    <li> <p><b>“/clusters/{clusterName}/configs”</b></p> 
+     <ul> 
+      <li>Represents cluster level configs for cluster with {clusterName}</li> 
+      <li><b>GET</b>: get all configs.</li> 
+     </ul> 
+     <div class="source"> 
+      <pre>$curl http://localhost:1234/admin/v2/clusters/myCluster/configs
+{
+  &quot;id&quot; : &quot;myCluster&quot;,
+  &quot;simpleFields&quot; : {
+    &quot;PERSIST_BEST_POSSIBLE_ASSIGNMENT&quot; : &quot;true&quot;
+  },
+  &quot;listFields&quot; : {
+  },
+  &quot;mapFields&quot; : {
+  }
+}
+</pre> 
+     </div> 
+     <ul> 
+      <li><b>POST</b>: update or delete one/some config entries.<br />update – Update the entries included in the input.</li> 
+     </ul> 
+     <div class="source"> 
+      <pre>$curl -X POST -H &quot;Content-Type: application/json&quot; http://localhost:1234/admin/v2/clusters/myCluster/configs?command=update -d '
+{
+ &quot;id&quot; : &quot;myCluster&quot;,
+  &quot;simpleFields&quot; : {
+    &quot;PERSIST_BEST_POSSIBLE_ASSIGNMENT&quot; : &quot;true&quot;
+  },
+  &quot;listFields&quot; : {
+    &quot;disabledPartition&quot; : [&quot;p1&quot;, &quot;p2&quot;, &quot;p3&quot;]
+  },
+  &quot;mapFields&quot; : {
+  }
+}'
+</pre> 
+     </div> <p>delete – Remove the entries included in the input from current config.</p> 
+     <div class="source"> 
+      <pre>$curl -X POST -H &quot;Content-Type: application/json&quot; http://localhost:1234/admin/v2/clusters/myCluster/configs?command=update -d '
+{
+  &quot;id&quot; : &quot;myCluster&quot;,
+  &quot;simpleFields&quot; : {
+  },
+  &quot;listFields&quot; : {
+    &quot;disabledPartition&quot; : [&quot;p1&quot;, &quot;p3&quot;]
+  },
+  &quot;mapFields&quot; : {
+  }
+}'
+</pre> 
+     </div></li> 
+    <li> <p><b>“/clusters/{clusterName}/controller”</b></p> 
+     <ul> 
+      <li>Represents the controller for cluster {clusterName}.</li> 
+      <li><b>GET</b> – return controller information</li> 
+     </ul> 
+     <div class="source"> 
+      <pre>$curl http://localhost:1234/admin/v2/clusters/myCluster/controller
+{
+  &quot;id&quot; : &quot;myCluster&quot;,
+  &quot;controller&quot; : &quot;test.helix.apache.org:1234&quot;,
+  &quot;HELIX_VERSION&quot;:&quot;0.9.5&quot;,
+  &quot;LIVE_INSTANCE&quot;:&quot;16261@test.helix.apache.org:1234&quot;,
+  &quot;SESSION_ID&quot;:&quot;35ab496aba54c99&quot;
+}
+</pre> 
+     </div></li> 
+    <li> <p><b>“/clusters/{clusterName}/controller/errors”</b></p> 
+     <ul> 
+      <li>Represents error information for the controller of cluster {clusterName}. This is new endpoint in v2.0.</li> 
+      <li><b>GET</b> – get all error information.</li> 
+      <li><b>DELETE</b> – clean up all error logs.</li> 
+     </ul></li> 
+   </ul> 
+   <ul> 
+    <li> <p><b>“/clusters/{clusterName}/controller/history”</b></p> 
+     <ul> 
+      <li>Represents the change history of leader controller of cluster {clusterName}. This is new endpoint in v2.0.</li> 
+      <li><b>GET</b> – get the leader controller history.</li> 
+     </ul> 
+     <div class="source"> 
+      <pre>$curl http://localhost:1234/admin/v2/clusters/myCluster/controller/history
+{
+  &quot;id&quot; : &quot;myCluster&quot;,
+  &quot;history&quot; [
+      &quot;{DATE=2017-03-21-16:57:14, CONTROLLER=test1.helix.apache.org:1234, TIME=1490115434248}&quot;,
+      &quot;{DATE=2017-03-27-22:35:16, CONTROLLER=test3.helix.apache.org:1234, TIME=1490654116484}&quot;,
+      &quot;{DATE=2017-03-27-22:35:24, CONTROLLER=test2.helix.apache.org:1234, TIME=1490654124926}&quot;
+  ]
+}
+</pre> 
+     </div></li> 
+    <li> <p><b>/clusters/{clusterName}/controller/messages&quot;</b></p> 
+     <ul> 
+      <li>Represents all uncompleted messages currently received by the controller of cluster {clusterName}. This is new endpoint in v2.0.</li> 
+      <li><b>GET</b> – list all uncompleted messages received by the controller.</li> 
+     </ul> 
+     <div class="source"> 
+      <pre>$curl http://localhost:1234/admin/v2/clusters/myCluster/controller/messages
+{
+  &quot;id&quot; : &quot;myCluster&quot;,
+  &quot;count&quot; : 5,
+  &quot;messages&quot; [
+      &quot;0b8df4f2-776c-4325-96e7-8fad07bd9048&quot;,
+      &quot;13a8c0af-b77e-4f5c-81a9-24fedb62cf58&quot;
+  ]
+}
+</pre> 
+     </div></li> 
+    <li> <p><b>“/clusters/{clusterName}/controller/messages/{messageId}”</b></p> 
+     <ul> 
+      <li>Represents the messages currently received by the controller of cluster {clusterName} with id {messageId}. This is new endpoint in v2.0.</li> 
+      <li><b>GET</b> - get the message with {messageId} received by the controller.</li> 
+      <li><b>DELETE</b> - delete the message with {messageId}</li> 
+     </ul></li> 
+   </ul> 
+   <ul> 
+    <li> <p><b>“/clusters/{clusterName}/statemodeldefs/”</b></p> 
+     <ul> 
+      <li>Represents all the state model definitions defined in cluster {clusterName}. This is new endpoint in v2.0.</li> 
+      <li><b>GET</b> - get all the state model definition in the cluster.</li> 
+     </ul> 
+     <div class="source"> 
+      <pre>$curl -X POST -H &quot;Content-Type: application/json&quot; http://localhost:1234/admin/v2/clusters/myCluster/statemodeldefs
+{
+  &quot;id&quot; : &quot;myCluster&quot;,
+  &quot;stateModelDefs&quot; : [ &quot;MasterSlave&quot;, &quot;LeaderStandby&quot;, &quot;OnlineOffline&quot; ]
+}
+</pre> 
+     </div></li> 
+    <li> <p><b>“/clusters/{clusterName}/statemodeldefs/{statemodeldef}”</b></p> 
+     <ul> 
+      <li>Represents the state model definition {statemodeldef} defined in cluster {clusterName}. This is new endpoint in v2.0.</li> 
+      <li><b>GET</b> - get the state model definition</li> 
+     </ul> 
+     <div class="source"> 
+      <pre>$curl -X POST -H &quot;Content-Type: application/json&quot; http://localhost:1234/admin/v2/clusters/myCluster/statemodeldefs/MasterSlave
+{
+  &quot;id&quot; : &quot;MasterSlave&quot;,
+  &quot;simpleFields&quot; : {
+    &quot;INITIAL_STATE&quot; : &quot;OFFLINE&quot;
+  },
+  &quot;mapFields&quot; : {
+    &quot;DROPPED.meta&quot; : {
+      &quot;count&quot; : &quot;-1&quot;
+    },
+    &quot;ERROR.meta&quot; : {
+      &quot;count&quot; : &quot;-1&quot;
+    },
+    &quot;ERROR.next&quot; : {
+      &quot;DROPPED&quot; : &quot;DROPPED&quot;,
+      &quot;OFFLINE&quot; : &quot;OFFLINE&quot;
+    },
+    &quot;MASTER.meta&quot; : {
+      &quot;count&quot; : &quot;1&quot;
+    },
+    &quot;MASTER.next&quot; : {
+      &quot;SLAVE&quot; : &quot;SLAVE&quot;,
+      &quot;DROPPED&quot; : &quot;SLAVE&quot;,
+      &quot;OFFLINE&quot; : &quot;SLAVE&quot;
+    },
+    &quot;OFFLINE.meta&quot; : {
+      &quot;count&quot; : &quot;-1&quot;
+    },
+    &quot;OFFLINE.next&quot; : {
+      &quot;SLAVE&quot; : &quot;SLAVE&quot;,
+      &quot;MASTER&quot; : &quot;SLAVE&quot;,
+      &quot;DROPPED&quot; : &quot;DROPPED&quot;
+    },
+    &quot;SLAVE.meta&quot; : {
+      &quot;count&quot; : &quot;R&quot;
+    },
+    &quot;SLAVE.next&quot; : {
+      &quot;MASTER&quot; : &quot;MASTER&quot;,
+      &quot;DROPPED&quot; : &quot;OFFLINE&quot;,
+      &quot;OFFLINE&quot; : &quot;OFFLINE&quot;
+    }
+  },
+  &quot;listFields&quot; : {
+    &quot;STATE_PRIORITY_LIST&quot; : [ &quot;MASTER&quot;, &quot;SLAVE&quot;, &quot;OFFLINE&quot;, &quot;DROPPED&quot;, &quot;ERROR&quot; ],
+    &quot;STATE_TRANSITION_PRIORITYLIST&quot; : [ &quot;MASTER-SLAVE&quot;, &quot;SLAVE-MASTER&quot;, &quot;OFFLINE-SLAVE&quot;, &quot;SLAVE-OFFLINE&quot;, &quot;OFFLINE-DROPPED&quot; ]
+  }
+}
+</pre> 
+     </div> 
+     <ul> 
+      <li><b>POST</b> - add a new state model definition with {statemodeldef}</li> 
+      <li><b>DELETE</b> - delete the state model definition</li> 
+     </ul></li> 
+   </ul> 
+  </div> 
+  <div class="section"> 
+   <h4 id="Helix_Resource_and_its_sub-resources">Helix “Resource” and its sub-resources</h4> 
+   <ul> 
+    <li> <p><b>“/clusters/{clusterName}/resources”</b></p> 
+     <ul> 
+      <li>Represents all resources in a cluster.</li> 
+      <li><b>GET</b> - list all resources with their IdealStates and ExternViews.</li> 
+     </ul> 
+     <div class="source"> 
+      <pre>$curl http://localhost:1234/admin/v2/clusters/myCluster/resources
+{
+  &quot;id&quot; : &quot;myCluster&quot;,
+  &quot;idealstates&quot; : [ &quot;idealstate1&quot;, &quot;idealstate2&quot;, &quot;idealstate3&quot; ],
+  &quot;externalviews&quot; : [ &quot;idealstate1&quot;, &quot;idealstate3&quot; ]
+}
+</pre> 
+     </div></li> 
+    <li> <p><b>“/clusters/{clusterName}/resources/{resourceName}”</b></p> 
+     <ul> 
+      <li>Represents a resource in cluster {clusterName} with name {resourceName}</li> 
+      <li><b>GET</b> - get resource info</li> 
+     </ul> 
+     <div class="source"> 
+      <pre>$curl http://localhost:1234/admin/v2/clusters/myCluster/resources/resource1
+{
+  &quot;id&quot; : &quot;resource1&quot;,
+  &quot;resourceConfig&quot; : {},
+  &quot;idealState&quot; : {},
+  &quot;externalView&quot; : {}
+}
+</pre> 
+     </div> 
+     <ul> 
+      <li><b>PUT</b> - add a resource with {resourceName}</li> 
+     </ul> 
+     <div class="source"> 
+      <pre>$curl -X PUT -H &quot;Content-Type: application/json&quot; http://localhost:1234/admin/v2/clusters/myCluster/resources/myResource -d '
+{
+  &quot;id&quot;:&quot;myResource&quot;,
+  &quot;simpleFields&quot;:{
+    &quot;STATE_MODEL_FACTORY_NAME&quot;:&quot;DEFAULT&quot;
+    ,&quot;EXTERNAL_VIEW_DISABLED&quot;:&quot;true&quot;
+    ,&quot;NUM_PARTITIONS&quot;:&quot;1&quot;
+    ,&quot;REBALANCE_MODE&quot;:&quot;TASK&quot;
+    ,&quot;REPLICAS&quot;:&quot;1&quot;
+    ,&quot;IDEAL_STATE_MODE&quot;:&quot;AUTO&quot;
+    ,&quot;STATE_MODEL_DEF_REF&quot;:&quot;Task&quot;
+    ,&quot;REBALANCER_CLASS_NAME&quot;:&quot;org.apache.helix.task.WorkflowRebalancer&quot;
+  }
+}'
+</pre> 
+     </div> 
+     <ul> 
+      <li><b>DELETE</b> - delete a resource. Example: curl -X DELETE <a class="externalLink" href="http://localhost:1234/admin/v2/clusters/myCluster/resources/myResource">http://localhost:1234/admin/v2/clusters/myCluster/resources/myResource</a></li> 
+      <li><b>enable</b> enable the resource. Example: curl -X POST <a class="externalLink" href="http://localhost:1234/admin/v2/clusters/myCluster/resources/myResource?command=enable">http://localhost:1234/admin/v2/clusters/myCluster/resources/myResource?command=enable</a></li> 
+      <li><b>disable</b> - disable the resource. Example: curl -X POST <a class="externalLink" href="http://localhost:1234/admin/v2/clusters/myCluster/resources/myResource?command=disable">http://localhost:1234/admin/v2/clusters/myCluster/resources/myResource?command=disable</a></li> 
+      <li><b>rebalance</b> - rebalance the resource. Example: curl -X POST <a class="externalLink" href="http://localhost:1234/admin/v2/clusters/myCluster/resources/myResource?command=rebalance">http://localhost:1234/admin/v2/clusters/myCluster/resources/myResource?command=rebalance</a></li> 
+     </ul></li> 
+    <li> <p><b>“/clusters/{clusterName}/resources/{resourceName}/idealState”</b></p> 
+     <ul> 
+      <li>Represents the ideal state of a resource with name {resourceName} in cluster {clusterName}. This is new endpoint in v2.0.</li> 
+      <li><b>GET</b> - get idealstate.</li> 
+     </ul> 
+     <div class="source"> 
+      <pre>$curl http://localhost:1234/admin/v2/clusters/myCluster/resources/myResource/idealState
+{
+  &quot;id&quot;:&quot;myResource&quot;
+  ,&quot;simpleFields&quot;:{
+    &quot;IDEAL_STATE_MODE&quot;:&quot;AUTO&quot;
+    ,&quot;NUM_PARTITIONS&quot;:&quot;2&quot;
+    ,&quot;REBALANCE_MODE&quot;:&quot;SEMI_AUTO&quot;
+    ,&quot;REPLICAS&quot;:&quot;2&quot;
+    ,&quot;STATE_MODEL_DEF_REF&quot;:&quot;MasterSlave&quot;
+  }
+  ,&quot;listFields&quot;:{
+    &quot;myResource_0&quot;:[&quot;host1&quot;, &quot;host2&quot;]
+    ,&quot;myResource_1&quot;:[&quot;host2&quot;, &quot;host1&quot;]
+  }
+  ,&quot;mapFields&quot;:{
+    &quot;myResource_0&quot;:{
+      &quot;host1&quot;:&quot;MASTER&quot;
+      ,&quot;host2&quot;:&quot;SLAVE&quot;
+    }
+    ,&quot;myResource_1&quot;:{
+      &quot;host1&quot;:&quot;SLAVE&quot;
+      ,&quot;host2&quot;:&quot;MASTER&quot;
+    }
+  }
+}
+</pre> 
+     </div></li> 
+    <li> <p><b>“/clusters/{clusterName}/resources/{resourceName}/externalView”</b></p> 
+     <ul> 
+      <li>Represents the external view of a resource with name {resourceName} in cluster {clusterName}</li> 
+      <li><b>GET</b> - get the externview</li> 
+     </ul> 
+     <div class="source"> 
+      <pre>$curl http://localhost:1234/admin/v2/clusters/myCluster/resources/myResource/externalView
+{
+  &quot;id&quot;:&quot;myResource&quot;
+  ,&quot;simpleFields&quot;:{
+    &quot;IDEAL_STATE_MODE&quot;:&quot;AUTO&quot;
+    ,&quot;NUM_PARTITIONS&quot;:&quot;2&quot;
+    ,&quot;REBALANCE_MODE&quot;:&quot;SEMI_AUTO&quot;
+    ,&quot;REPLICAS&quot;:&quot;2&quot;
+    ,&quot;STATE_MODEL_DEF_REF&quot;:&quot;MasterSlave&quot;
+  }
+  ,&quot;listFields&quot;:{
+    &quot;myResource_0&quot;:[&quot;host1&quot;, &quot;host2&quot;]
+    ,&quot;myResource_1&quot;:[&quot;host2&quot;, &quot;host1&quot;]
+  }
+  ,&quot;mapFields&quot;:{
+    &quot;myResource_0&quot;:{
+      &quot;host1&quot;:&quot;MASTER&quot;
+      ,&quot;host2&quot;:&quot;OFFLINE&quot;
+    }
+    ,&quot;myResource_1&quot;:{
+      &quot;host1&quot;:&quot;SLAVE&quot;
+      ,&quot;host2&quot;:&quot;MASTER&quot;
+    }
+  }
+}
+</pre> 
+     </div></li> 
+    <li> <p><b>“/clusters/{clusterName}/resources/{resourceName}/configs”</b></p> 
+     <ul> 
+      <li>Represents resource level of configs for resource with name {resourceName} in cluster {clusterName}. This is new endpoint in v2.0.</li> 
+      <li><b>GET</b> - get resource configs.</li> 
+     </ul> 
+     <div class="source"> 
+      <pre>$curl http://localhost:1234/admin/v2/clusters/myCluster/resources/myResource/configs
+{
+  &quot;id&quot;:&quot;myDB&quot;
+  &quot;UserDefinedProperty&quot; : &quot;property&quot;
+}
+</pre> 
+     </div></li> 
+   </ul> 
+  </div> 
+  <div class="section"> 
+   <h4 id="Helix_Instance_and_its_sub-resources">Helix Instance and its sub-resources</h4> 
+   <ul> 
+    <li> <p><b>“/clusters/{clusterName}/instances”</b></p> 
+     <ul> 
+      <li>Represents all instances in a cluster {clusterName}</li> 
+      <li><b>GET</b> - list all instances in this cluster.</li> 
+     </ul> 
+     <div class="source"> 
+      <pre>$curl http://localhost:1234/admin/v2/clusters/myCluster/instances
+{
+  &quot;id&quot; : &quot;myCluster&quot;,
+  &quot;instances&quot; : [ &quot;host1&quot;, &quot;host2&quot;, &quot;host3&quot;, &quot;host4&quot;],
+  &quot;online&quot; : [&quot;host1&quot;, &quot;host4&quot;],
+  &quot;disabled&quot; : [&quot;host2&quot;]
+}
+</pre> 
+     </div> 
+     <ul> 
+      <li><b>POST</b> - enable/disable instances.</li> 
+     </ul> 
+     <div class="source"> 
+      <pre>$curl -X POST -H &quot;Content-Type: application/json&quot; http://localhost:1234/admin/v2/clusters/myCluster/instances/command=enable -d
+{
+  &quot;instances&quot; : [ &quot;host1&quot;, &quot;host3&quot; ]
+}
+$curl -X POST -H &quot;Content-Type: application/json&quot; http://localhost:1234/admin/v2/clusters/myCluster/instances/command=disable -d
+{
+  &quot;instances&quot; : [ &quot;host2&quot;, &quot;host4&quot; ]
+}
+</pre> 
+     </div></li> 
+    <li> <p><b>“/clusters/{clusterName}/instances/{instanceName}”</b></p> 
+     <ul> 
+      <li>Represents a instance in cluster {clusterName} with name {instanceName}</li> 
+      <li><b>GET</b> - get instance information.</li> 
+     </ul> 
+     <div class="source"> 
+      <pre>$curl http://localhost:1234/admin/v2/clusters/myCluster/instances/host_1234
+{
+  &quot;id&quot; : &quot;host_1234&quot;,
+  &quot;configs&quot; : {
+    &quot;HELIX_ENABLED&quot; : &quot;true&quot;,
+    &quot;HELIX_HOST&quot; : &quot;host&quot;,
+    &quot;HELIX_PORT&quot; : &quot;1234&quot;,
+    &quot;HELIX_DISABLED_PARTITION&quot; : [ ]
+  }
+  &quot;liveInstance&quot; : {
+    &quot;HELIX_VERSION&quot;:&quot;0.6.6.3&quot;,
+    &quot;LIVE_INSTANCE&quot;:&quot;4526@host&quot;,
+    &quot;SESSION_ID&quot;:&quot;359619c2d7efc14&quot;
+  }
+}
+</pre> 
+     </div> 
+     <ul> 
+      <li><b>PUT</b> - add a new instance with {instanceName}</li> 
+     </ul> 
+     <div class="source"> 
+      <pre>$curl -X PUT -H &quot;Content-Type: application/json&quot; http://localhost:1234/admin/v2/clusters/myCluster/instances/host_1234 -d '
+{
+  &quot;id&quot; : &quot;host_1234&quot;,
+  &quot;simpleFields&quot; : {
+    &quot;HELIX_ENABLED&quot; : &quot;true&quot;,
+    &quot;HELIX_HOST&quot; : &quot;host&quot;,
+    &quot;HELIX_PORT&quot; : &quot;1234&quot;,
+  }
+}'
+</pre> 
+     </div> <p>There’s one important restriction for this operation: the {instanceName} should match exactly HELIX_HOST + “_” + HELIX_PORT. For example, if host is localhost, and port is 1234, the instance name should be localhost_1234. Otherwise, the response won’t contain any error but the configurations are not able to be filled in.</p> 
+     <ul> 
+      <li><b>DELETE</b> - delete the instance. Example: curl -X DELETE <a class="externalLink" href="http://localhost:1234/admin/v2/clusters/myCluster/instances/host_1234">http://localhost:1234/admin/v2/clusters/myCluster/instances/host_1234</a></li> 
+      <li><b>enable</b> - enable the instance. Example: curl -X POST <a class="externalLink" href="http://localhost:1234/admin/v2/clusters/myCluster/instances/host_1234?command=enable">http://localhost:1234/admin/v2/clusters/myCluster/instances/host_1234?command=enable</a></li> 
+      <li><b>disable</b> - disable the instance. Example: curl -X POST <a class="externalLink" href="http://localhost:1234/admin/v2/clusters/myCluster/instances/host_1234?command=disable">http://localhost:1234/admin/v2/clusters/myCluster/instances/host_1234?command=disable</a></li> 
+     </ul> 
+     <ul> 
+      <li><b>addInstanceTag</b> - add tags to this instance.</li> 
+     </ul> 
+     <div class="source"> 
+      <pre>$curl -X POST -H &quot;Content-Type: application/json&quot; http://localhost:1234/admin/v2/clusters/myCluster/instances/host_1234?command=addInstanceTag -d '
+{
+  &quot;id&quot; : &quot;host_1234&quot;,
+  &quot;instanceTags&quot; : [ &quot;tag_1&quot;, &quot;tag_2, &quot;tag_3&quot; ]
+}'
+</pre> 
+     </div> 
+     <ul> 
+      <li><b>removeInstanceTag</b> - remove a tag from this instance.</li> 
+     </ul> 
+     <div class="source"> 
+      <pre>$curl -X POST -H &quot;Content-Type: application/json&quot; http://localhost:1234/admin/v2/clusters/myCluster/instances/host_1234?command=removeInstanceTag -d '
+{
+  &quot;id&quot; : &quot;host_1234&quot;,
+  &quot;instanceTags&quot; : [ &quot;tag_1&quot;, &quot;tag_2, &quot;tag_3&quot; ]
+}'
+</pre> 
+     </div></li> 
+    <li> <p><b>“/clusters/{clusterName}/instances/{instanceName}/resources”</b></p> 
+     <ul> 
+      <li>Represents all resources and their partitions locating on the instance in cluster {clusterName} with name {instanceName}. This is new endpoint in v2.0.</li> 
+      <li><b>GET</b> - return all resources that have partitions in the instance.</li> 
+     </ul> 
+     <div class="source"> 
+      <pre>$curl http://localhost:1234/admin/v2/clusters/myCluster/instances/host_1234/resources
+{
+  &quot;id&quot; : &quot;host_1234&quot;,
+  &quot;resources&quot; [ &quot;myResource1&quot;, &quot;myResource2&quot;, &quot;myResource3&quot;]
+}
+</pre> 
+     </div></li> 
+    <li> <p><b>“/clusters/{clusterName}/instances/{instanceName}/resources/{resource}”</b></p> 
+     <ul> 
+      <li>Represents all partitions of the {resource} locating on the instance in cluster {clusterName} with name {instanceName}. This is new endpoint in v2.0.</li> 
+      <li><b>GET</b> - return all partitions of the resource in the instance.</li> 
+     </ul> 
+     <div class="source"> 
+      <pre>$curl http://localhost:1234/admin/v2/clusters/myCluster/instances/localhost_1234/resources/myResource1
+{
+  &quot;id&quot;:&quot;myResource1&quot;
+  ,&quot;simpleFields&quot;:{
+    &quot;STATE_MODEL_DEF&quot;:&quot;MasterSlave&quot;
+    ,&quot;STATE_MODEL_FACTORY_NAME&quot;:&quot;DEFAULT&quot;
+    ,&quot;BUCKET_SIZE&quot;:&quot;0&quot;
+    ,&quot;SESSION_ID&quot;:&quot;359619c2d7f109b&quot;
+  }
+  ,&quot;listFields&quot;:{
+  }
+  ,&quot;mapFields&quot;:{
+    &quot;myResource1_2&quot;:{
+      &quot;CURRENT_STATE&quot;:&quot;SLAVE&quot;
+      ,&quot;INFO&quot;:&quot;&quot;
+    }
+    ,&quot;myResource1_3&quot;:{
+      &quot;CURRENT_STATE&quot;:&quot;MASTER&quot;
+      ,&quot;INFO&quot;:&quot;&quot;
+    }
+    ,&quot;myResource1_0&quot;:{
+      &quot;CURRENT_STATE&quot;:&quot;MASTER&quot;
+      ,&quot;INFO&quot;:&quot;&quot;
+    }
+    ,&quot;myResource1_1&quot;:{
+      &quot;CURRENT_STATE&quot;:&quot;SLAVE&quot;
+      ,&quot;INFO&quot;:&quot;&quot;
+    }
+  }
+}
+</pre> 
+     </div></li> 
+    <li> <p><b>“/clusters/{clusterName}/instances/{instanceName}/configs”</b></p> 
+     <ul> 
+      <li>Represents instance configs in cluster {clusterName} with name {instanceName}. This is new endpoint in v2.0.</li> 
+      <li><b>GET</b> - return configs for the instance.</li> 
+     </ul> 
+     <div class="source"> 
+      <pre>$curl http://localhost:1234/admin/v2/clusters/myCluster/instances/host_1234/configs 
+{
+  &quot;id&quot;:&quot;host_1234&quot;
+  &quot;configs&quot; : {
+    &quot;HELIX_ENABLED&quot; : &quot;true&quot;,
+    &quot;HELIX_HOST&quot; : &quot;host&quot;
+    &quot;HELIX_PORT&quot; : &quot;1234&quot;,
+    &quot;HELIX_DISABLED_PARTITION&quot; : [ ]
+}
+</pre> 
+     </div> 
+     <ul> 
+      <li><b>PUT</b> - PLEASE NOTE THAT THIS PUT IS FULLY OVERRIDE THE INSTANCE CONFIG</li> 
+     </ul> 
+     <div class="source"> 
+      <pre>$curl -X PUT -H &quot;Content-Type: application/json&quot; http://localhost:1234/admin/v2/clusters/myCluster/instances/host_1234/configs
+{
+  &quot;id&quot;:&quot;host_1234&quot;
+  &quot;configs&quot; : {
+    &quot;HELIX_ENABLED&quot; : &quot;true&quot;,
+    &quot;HELIX_HOST&quot; : &quot;host&quot;
+    &quot;HELIX_PORT&quot; : &quot;1234&quot;,
+    &quot;HELIX_DISABLED_PARTITION&quot; : [ ]
+}
+</pre> 
+     </div></li> 
+    <li> <p><b>“/clusters/{clusterName}/instances/{instanceName}/errors”</b></p> 
+     <ul> 
+      <li>List all the mapping of sessionId to partitions of resources. This is new endpoint in v2.0.</li> 
+      <li><b>GET</b> - get mapping</li> 
+     </ul> 
+     <div class="source"> 
+      <pre>$curl http://localhost:1234/admin/v2/clusters/myCluster/instances/host_1234/errors
+{
+   &quot;id&quot;:&quot;host_1234&quot;
+   &quot;errors&quot;:{
+        &quot;35sfgewngwese&quot;:{
+            &quot;resource1&quot;:[&quot;p1&quot;,&quot;p2&quot;,&quot;p5&quot;],
+            &quot;resource2&quot;:[&quot;p2&quot;,&quot;p7&quot;]
+         }
+    }
+}
+</pre> 
+     </div> 
+     <ul> 
+      <li><b>DELETE</b> - clean up all error information from Helix.</li> 
+     </ul></li> 
+    <li> <p><b>“/clusters/{clusterName}/instances/{instanceName}/errors/{sessionId}/{resourceName}/{partitionName}”</b></p> 
+     <ul> 
+      <li>Represents error information for the partition {partitionName} of the resource {resourceName} under session {sessionId} in instance with {instanceName} in cluster {clusterName}. This is new endpoint in v2.0.</li> 
+      <li><b>GET</b> - get all error information.</li> 
+     </ul> 
+     <div class="source"> 
+      <pre>$curl http://localhost:1234/admin/v2/clusters/myCluster/instances/host_1234/errors/35sfgewngwese/resource1/p1
+{
+  &quot;id&quot;:&quot;35sfgewngwese_resource1&quot;
+  ,&quot;simpleFields&quot;:{
+  }
+  ,&quot;listFields&quot;:{
+  }
+  ,&quot;mapFields&quot;:{
+    &quot;HELIX_ERROR     20170521-070822.000561 STATE_TRANSITION b819a34d-41b5-4b42-b497-1577501eeecb&quot;:{
+      &quot;AdditionalInfo&quot;:&quot;Exception while executing a state transition task ...&quot;
+      ,&quot;MSG_ID&quot;:&quot;4af79e51-5f83-4892-a271-cfadacb0906f&quot;
+      ,&quot;Message state&quot;:&quot;READ&quot;
+    }
+  }
+}
+</pre> 
+     </div></li> 
+    <li> <p><b>“/clusters/{clusterName}/instances/{instanceName}/history”</b></p> 
+     <ul> 
+      <li>Represents instance session change history for the instance with {instanceName} in cluster {clusterName}. This is new endpoint in v2.0.</li> 
+      <li><b>GET</b> - get the instance change history.</li> 
+     </ul> 
+     <div class="source"> 
+      <pre>$curl http://localhost:1234/admin/v2/clusters/myCluster/instances/host_1234/history
+{
+  &quot;id&quot;: &quot;host_1234&quot;,
+  &quot;LAST_OFFLINE_TIME&quot;: &quot;183948792&quot;,
+  &quot;HISTORY&quot;: [
+    &quot;{DATE=2017-03-02T19:25:18:915, SESSION=459014c82ef3f5b, TIME=1488482718915}&quot;,
+    &quot;{DATE=2017-03-10T22:24:53:246, SESSION=15982390e5d5c91, TIME=1489184693246}&quot;,
+    &quot;{DATE=2017-03-11T02:03:52:776, SESSION=15982390e5d5d85, TIME=1489197832776}&quot;,
+    &quot;{DATE=2017-03-13T18:15:00:778, SESSION=15982390e5d678d, TIME=1489428900778}&quot;,
+    &quot;{DATE=2017-03-21T02:47:57:281, SESSION=459014c82effa82, TIME=1490064477281}&quot;,
+    &quot;{DATE=2017-03-27T14:51:06:802, SESSION=459014c82f01a07, TIME=1490626266802}&quot;,
+    &quot;{DATE=2017-03-30T00:05:08:321, SESSION=5590151804e2c78, TIME=1490832308321}&quot;,
+    &quot;{DATE=2017-03-30T01:17:34:339, SESSION=2591d53b0421864, TIME=1490836654339}&quot;,
+    &quot;{DATE=2017-03-30T17:31:09:880, SESSION=2591d53b0421b2a, TIME=1490895069880}&quot;,
+    &quot;{DATE=2017-03-30T18:05:38:220, SESSION=359619c2d7f109b, TIME=1490.9.538220}&quot;
+  ]
+}
+</pre> 
+     </div></li> 
+    <li> <p><b>“/clusters/{clusterName}/instances/{instanceName}/messages”</b></p> 
+     <ul> 
+      <li>Represents all uncompleted messages currently received by the instance. This is new endpoint in v2.0.</li> 
+      <li><b>GET</b> - list all uncompleted messages received by the controller.</li> 
+     </ul> 
+     <div class="source"> 
+      <pre>$curl http://localhost:1234/admin/v2/clusters/myCluster/instances/host_1234/messages
+{
+  &quot;id&quot;: &quot;host_1234&quot;,
+  &quot;new_messages&quot;: [&quot;0b8df4f2-776c-4325-96e7-8fad07bd9048&quot;, &quot;13a8c0af-b77e-4f5c-81a9-24fedb62cf58&quot;],
+  &quot;read_messages&quot;: [&quot;19887b07-e9b8-4fa6-8369-64146226c454&quot;]
+  &quot;total_message_count&quot; : 100,
+  &quot;read_message_count&quot; : 50
+}
+</pre> 
+     </div></li> 
+    <li> <p><b>&quot;/clusters/{clusterName}/instances/{instanceName}/messages/{messageId}</b></p> 
+     <ul> 
+      <li>Represents the messages currently received by by the instance with message given message id. This is new endpoint in v2.0.</li> 
+      <li><b>GET</b> - get the message content with {messageId} received by the instance.</li> 
+     </ul> 
+     <div class="source"> 
+      <pre>$curl http://localhost:1234/admin/v2/clusters/myCluster/instances/localhost_1234/messages/0b8df4f2-776c-4325-96e7-8fad07bd9048
+{
+  &quot;id&quot;: &quot;0b8df4f2-776c-4325-96e7-8fad07bd9048&quot;,
+  &quot;CREATE_TIMESTAMP&quot;:&quot;1489997469400&quot;,
+  &quot;ClusterEventName&quot;:&quot;messageChange&quot;,
+  &quot;FROM_STATE&quot;:&quot;OFFLINE&quot;,
+  &quot;MSG_ID&quot;:&quot;0b8df4f2-776c-4325-96e7-8fad07bd9048&quot;,
+  &quot;MSG_STATE&quot;:&quot;new&quot;,
+  &quot;MSG_TYPE&quot;:&quot;STATE_TRANSITION&quot;,
+  &quot;PARTITION_NAME&quot;:&quot;Resource1_243&quot;,
+  &quot;RESOURCE_NAME&quot;:&quot;Resource1&quot;,
+  &quot;SRC_NAME&quot;:&quot;controller_1234&quot;,
+  &quot;SRC_SESSION_ID&quot;:&quot;15982390e5d5a76&quot;,
+  &quot;STATE_MODEL_DEF&quot;:&quot;LeaderStandby&quot;,
+  &quot;STATE_MODEL_FACTORY_NAME&quot;:&quot;myFactory&quot;,
+  &quot;TGT_NAME&quot;:&quot;host_1234&quot;,
+  &quot;TGT_SESSION_ID&quot;:&quot;459014c82efed9b&quot;,
+  &quot;TO_STATE&quot;:&quot;DROPPED&quot;
+}
+</pre> 
+     </div> 
+     <ul> 
+      <li><b>DELETE</b> - delete the message with {messageId}. Example: $curl -X DELETE <a class="externalLink" href="http://localhost:1234/admin/v2/clusters/myCluster/instances/host_1234/messages/0b8df4f2-776c-4325-96e7-8fad07bd9048">http://localhost:1234/admin/v2/clusters/myCluster/instances/host_1234/messages/0b8df4f2-776c-4325-96e7-8fad07bd9048</a></li> 
+     </ul></li> 
+    <li> <p><b>“/clusters/{clusterName}/instances/{instanceName}/healthreports”</b></p> 
+     <ul> 
+      <li>Represents all health reports in the instance in cluster {clusterName} with name {instanceName}. This is new endpoint in v2.0.</li> 
+      <li><b>GET</b> - return the name of health reports collected from the instance.</li> 
+     </ul> 
+     <div class="source"> 
+      <pre>$curl http://localhost:1234/admin/v2/clusters/myCluster/instances/host_1234/healthreports
+{
+  &quot;id&quot; : &quot;host_1234&quot;,
+  &quot;healthreports&quot; [ &quot;report1&quot;, &quot;report2&quot;, &quot;report3&quot; ]
+}
+</pre> 
+     </div></li> 
+    <li> <p><b>“/clusters/{clusterName}/instances/{instanceName}/healthreports/{reportName}”</b></p> 
+     <ul> 
+      <li>Represents the health report with {reportName} in the instance in cluster {clusterName} with name {instanceName}. This is new endpoint in v2.0.</li> 
+      <li><b>GET</b> - return the content of health report collected from the instance.</li> 
+     </ul> 
+     <div class="source"> 
+      <pre>$curl http://localhost:1234/admin/v2/clusters/myCluster/instances/host_1234/healthreports/ClusterStateStats
+{
+  &quot;id&quot;:&quot;ClusterStateStats&quot;
+  ,&quot;simpleFields&quot;:{
+    &quot;CREATE_TIMESTAMP&quot;:&quot;1466753504476&quot;
+    ,&quot;TimeStamp&quot;:&quot;1466753504476&quot;
+  }
+  ,&quot;listFields&quot;:{
+  }
+  ,&quot;mapFields&quot;:{
+    &quot;UserDefinedData&quot;:{
+      &quot;Data1&quot;:&quot;0&quot;
+      ,&quot;Data2&quot;:&quot;0.0&quot;
+    }
+  }
+}
+</pre> 
+     </div></li> 
+   </ul> 
+  </div> 
+  <div class="section"> 
+   <h4 id="Helix_Workflow_and_its_sub-resources">Helix Workflow and its sub-resources</h4> 
+   <ul> 
+    <li> <p><b>“/clusters/{clusterName}/workflows”</b></p> 
+     <ul> 
+      <li>Represents all workflows in cluster {clusterName}</li> 
+      <li><b>GET</b> - list all workflows in this cluster. Example : curl <a class="externalLink" href="http://localhost:1234/admin/v2/clusters/TestCluster/workflows">http://localhost:1234/admin/v2/clusters/TestCluster/workflows</a></li> 
+     </ul> 
+     <div class="source"> 
+      <pre>{
+  &quot;Workflows&quot; : [ &quot;Workflow1&quot;, &quot;Workflow2&quot; ]
+}
+</pre> 
+     </div></li> 
+    <li> <p><b>“/clusters/{clusterName}/workflows/{workflowName}”</b></p> 
+     <ul> 
+      <li>Represents workflow with name {workflowName} in cluster {clusterName}</li> 
+      <li><b>GET</b> - return workflow information. Example : curl <a class="externalLink" href="http://localhost:1234/admin/v2/clusters/TestCluster/workflows/Workflow1">http://localhost:1234/admin/v2/clusters/TestCluster/workflows/Workflow1</a></li> 
+     </ul> 
+     <div class="source"> 
+      <pre>{
+   &quot;id&quot; : &quot;Workflow1&quot;,
+   &quot;WorkflowConfig&quot; : {
+       &quot;Expiry&quot; : &quot;43200000&quot;,
+       &quot;FailureThreshold&quot; : &quot;0&quot;,
+       &quot;IsJobQueue&quot; : &quot;true&quot;,
+       &quot;LAST_PURGE_TIME&quot; : &quot;1490820801831&quot;,
+       &quot;LAST_SCHEDULED_WORKFLOW&quot; : &quot;Workflow1_20170329T000000&quot;,
+       &quot;ParallelJobs&quot; : &quot;1&quot;,
+       &quot;RecurrenceInterval&quot; : &quot;1&quot;,
+       &quot;RecurrenceUnit&quot; : &quot;DAYS&quot;,
+       &quot;START_TIME&quot; : &quot;1482176880535&quot;,
+       &quot;STATE&quot; : &quot;STOPPED&quot;,
+       &quot;StartTime&quot; : &quot;12-19-2016 00:00:00&quot;,
+       &quot;TargetState&quot; : &quot;START&quot;,
+       &quot;Terminable&quot; : &quot;false&quot;,
+       &quot;capacity&quot; : &quot;500&quot;
+    },
+   &quot;WorkflowContext&quot; : {
+       &quot;JOB_STATES&quot;: {
+         &quot;Job1&quot;: &quot;COMPLETED&quot;,
+         &quot;Job2&quot;: &quot;COMPLETED&quot;
+       },
+       &quot;StartTime&quot;: {
+         &quot;Job1&quot;: &quot;1490741582339&quot;,
+         &quot;Job2&quot;: &quot;1490741580204&quot;
+       },
+       &quot;FINISH_TIME&quot;: &quot;1490741659135&quot;,
+       &quot;START_TIME&quot;: &quot;1490741580196&quot;,
+       &quot;STATE&quot;: &quot;COMPLETED&quot;
+   },
+   &quot;Jobs&quot; : [&quot;Job1&quot;,&quot;Job2&quot;,&quot;Job3&quot;],
+   &quot;ParentJobs&quot; : {
+        &quot;Job1&quot;:[&quot;Job2&quot;, &quot;Job3&quot;],
+        &quot;Job2&quot;:[&quot;Job3&quot;]
+   }
+}
+</pre> 
+     </div> 
+     <ul> 
+      <li><b>PUT</b> - create a workflow with {workflowName}. Example : curl -X PUT -H “Content-Type: application/json” -d <a href="./WorkflowExample.json">WorkflowExample.json</a> <a class="externalLink" href="http://localhost:1234/admin/v2/clusters/TestCluster/workflows/Workflow1">http://localhost:1234/admin/v2/clusters/TestCluster/workflows/Workflow1</a></li> 
+      <li><b>DELETE</b> - delete the workflow. Example : curl -X DELETE <a class="externalLink" href="http://localhost:1234/admin/v2/clusters/TestCluster/workflows/Workflow1">http://localhost:1234/admin/v2/clusters/TestCluster/workflows/Workflow1</a></li> 
+      <li><b>start</b> - start the workflow. Example : curl -X POST -H “Content-Type: application/json” <a class="externalLink" href="http://localhost:1234/admin/v2/clusters/TestCluster/workflows/Workflow1?command=start">http://localhost:1234/admin/v2/clusters/TestCluster/workflows/Workflow1?command=start</a></li> 
+      <li><b>stop</b> - pause the workflow. Example : curl -X POST -H “Content-Type: application/json” <a class="externalLink" href="http://localhost:1234/admin/v2/clusters/TestCluster/workflows/Workflow1?command=stop">http://localhost:1234/admin/v2/clusters/TestCluster/workflows/Workflow1?command=stop</a></li> 
+      <li><b>resume</b> - resume the workflow. Example : curl -X POST -H “Content-Type: application/json” <a class="externalLink" href="http://localhost:1234/admin/v2/clusters/TestCluster/workflows/Workflow1?command=resume">http://localhost:1234/admin/v2/clusters/TestCluster/workflows/Workflow1?command=resume</a></li> 
+      <li><b>cleanup</b> - cleanup all expired jobs in the workflow, this operation is only allowed if the workflow is a JobQueue. Example : curl -X POST -H “Content-Type: application/json” <a class="externalLink" href="http://localhost:1234/admin/v2/clusters/TestCluster/workflows/Workflow1?command=clean">http://localhost:1234/admin/v2/clusters/TestCluster/workflows/Workflow1?command=clean</a></li> 
+     </ul></li> 
+    <li> <p><b>“/clusters/{clusterName}/workflows/{workflowName}/configs”</b></p> 
+     <ul> 
+      <li>Represents workflow config with name {workflowName} in cluster {clusterName}. This is new endpoint in v2.0.</li> 
+      <li><b>GET</b> - return workflow configs. Example : curl <a class="externalLink" href="http://localhost:1234/admin/v2/clusters/TestCluster/workflows/Workflow1/configs">http://localhost:1234/admin/v2/clusters/TestCluster/workflows/Workflow1/configs</a></li> 
+     </ul> 
+     <div class="source"> 
+      <pre>{
+    &quot;id&quot;: &quot;Workflow1&quot;,
+    &quot;Expiry&quot; : &quot;43200000&quot;,
+    &quot;FailureThreshold&quot; : &quot;0&quot;,
+    &quot;IsJobQueue&quot; : &quot;true&quot;,
+    &quot;START_TIME&quot; : &quot;1482176880535&quot;,
+    &quot;StartTime&quot; : &quot;12-19-2016 00:00:00&quot;,
+    &quot;TargetState&quot; : &quot;START&quot;,
+    &quot;Terminable&quot; : &quot;false&quot;,
+    &quot;capacity&quot; : &quot;500&quot;
+}
+</pre> 
+     </div></li> 
+    <li> <p><b>“/clusters/{clusterName}/workflows/{workflowName}/context”</b></p> 
+     <ul> 
+      <li>Represents workflow runtime information with name {workflowName} in cluster {clusterName}. This is new endpoint in v2.0.</li> 
+      <li><b>GET</b> - return workflow runtime information. Example : curl <a class="externalLink" href="http://localhost:1234/admin/v2/clusters/TestCluster/workflows/Workflow1/context">http://localhost:1234/admin/v2/clusters/TestCluster/workflows/Workflow1/context</a></li> 
+     </ul> 
+     <div class="source"> 
+      <pre>{
+    &quot;id&quot;: &quot;WorkflowContext&quot;,
+    &quot;JOB_STATES&quot;: {
+         &quot;Job1&quot;: &quot;COMPLETED&quot;,
+         &quot;Job2&quot;: &quot;COMPLETED&quot;
+     },
+     &quot;StartTime&quot;: {
+         &quot;Job1&quot;: &quot;1490741582339&quot;,
+         &quot;Job2&quot;: &quot;1490741580204&quot;
+     },
+     &quot;FINISH_TIME&quot;: &quot;1490741659135&quot;,
+     &quot;START_TIME&quot;: &quot;1490741580196&quot;,
+     &quot;STATE&quot;: &quot;COMPLETED&quot;
+}
+</pre> 
+     </div></li> 
+   </ul> 
+  </div> 
+  <div class="section"> 
+   <h4 id="Helix_Job_and_its_sub-resources">Helix Job and its sub-resources</h4> 
+   <ul> 
+    <li> <p><b>“/clusters/{clusterName}/workflows/{workflowName}/jobs”</b></p> 
+     <ul> 
+      <li>Represents all jobs in workflow {workflowName} in cluster {clusterName}</li> 
+      <li><b>GET</b> return all job names in this workflow. Example : curl <a class="externalLink" href="http://localhost:1234/admin/v2/clusters/TestCluster/workflows/Workflow1/jobs">http://localhost:1234/admin/v2/clusters/TestCluster/workflows/Workflow1/jobs</a></li> 
+     </ul> 
+     <div class="source"> 
+      <pre>{
+    &quot;id&quot;:&quot;Jobs&quot;
+    &quot;Jobs&quot;:[&quot;Job1&quot;,&quot;Job2&quot;,&quot;Job3&quot;]
+}
+</pre> 
+     </div></li> 
+    <li> <p><b>“/clusters/{clusterName}/workflows/{workflowName}/jobs/{jobName}”</b></p> 
+     <ul> 
+      <li>Represents job with {jobName} within {workflowName} in cluster {clusterName}</li> 
+      <li><b>GET</b> return job information. Example : curl <a class="externalLink" href="http://localhost:1234/admin/v2/clusters/TestCluster/workflows/Workflow1/jobs/Job1">http://localhost:1234/admin/v2/clusters/TestCluster/workflows/Workflow1/jobs/Job1</a></li> 
+     </ul> 
+     <div class="source"> 
+      <pre>{
+    &quot;id&quot;:&quot;Job1&quot;
+    &quot;JobConfig&quot;:{
+        &quot;WorkflowID&quot;:&quot;Workflow1&quot;,
+        &quot;IgnoreDependentJobFailure&quot;:&quot;false&quot;,
+        &quot;MaxForcedReassignmentsPerTask&quot;:&quot;3&quot;
+    },
+    &quot;JobContext&quot;:{
+	&quot;START_TIME&quot;:&quot;1491005863291&quot;,
+        &quot;FINISH_TIME&quot;:&quot;149101.0.0612&quot;,
+        &quot;Tasks&quot;:[
+             {
+                 &quot;id&quot;:&quot;0&quot;,
+                 &quot;ASSIGNED_PARTICIPANT&quot;:&quot;P1&quot;,
+                 &quot;FINISH_TIME&quot;:&quot;1491005898905&quot;
+                 &quot;INFO&quot;:&quot;&quot;
+                 &quot;NUM_ATTEMPTS&quot;:&quot;1&quot;
+                 &quot;START_TIME&quot;:&quot;1491005863307&quot;
+                 &quot;STATE&quot;:&quot;COMPLETED&quot;
+                 &quot;TARGET&quot;:&quot;DB_0&quot;
+             },
+             {
+                 &quot;id&quot;:&quot;1&quot;,
+                 &quot;ASSIGNED_PARTICIPANT&quot;:&quot;P5&quot;,
+                 &quot;FINISH_TIME&quot;:&quot;1491005895443&quot;
+                 &quot;INFO&quot;:&quot;&quot;
+                 &quot;NUM_ATTEMPTS&quot;:&quot;1&quot;
+                 &quot;START_TIME&quot;:&quot;1491005863307&quot;
+                 &quot;STATE&quot;:&quot;COMPLETED&quot;
+                 &quot;TARGET&quot;:&quot;DB_1&quot;
+             }
+         ]
+     }
+}
+</pre> 
+     </div> 
+     <ul> 
+      <li><b>PUT</b> - insert a job with {jobName} into the workflow, this operation is only allowed if the workflow is a JobQueue.<br /> Example : curl -X PUT -H “Content-Type: application/json” -d <a href="./JobExample.json">JobExample.json</a> <a class="externalLink" href="http://localhost:1234/admin/v2/clusters/TestCluster/workflows/Workflow1/jobs/Job1">http://localhost:1234/admin/v2/clusters/TestCluster/workflows/Workflow1/jobs/Job1</a></li> 
+      <li><b>DELETE</b> - delete the job from the workflow, this operation is only allowed if the workflow is a JobQueue.<br /> Example : curl -X DELETE <a class="externalLink" href="http://localhost:1234/admin/v2/clusters/TestCluster/workflows/Workflow1/jobs/Job1">http://localhost:1234/admin/v2/clusters/TestCluster/workflows/Workflow1/jobs/Job1</a></li> 
+     </ul></li> 
+    <li> <p><b>“/clusters/{clusterName}/workflows/{workflowName}/jobs/{jobName}/configs”</b></p> 
+     <ul> 
+      <li>Represents job config for {jobName} within workflow {workflowName} in cluster {clusterName}. This is new endpoint in v2.0.</li> 
+      <li><b>GET</b> - return job config. Example : curl <a class="externalLink" href="http://localhost:1234/admin/v2/clusters/TestCluster/workflows/Workflow1/jobs/Job1/configs">http://localhost:1234/admin/v2/clusters/TestCluster/workflows/Workflow1/jobs/Job1/configs</a></li> 
+     </ul> 
+     <div class="source"> 
+      <pre>{
+  &quot;id&quot;:&quot;JobConfig&quot;
+  &quot;WorkflowID&quot;:&quot;Workflow1&quot;,
+  &quot;IgnoreDependentJobFailure&quot;:&quot;false&quot;,
+  &quot;MaxForcedReassignmentsPerTask&quot;:&quot;3&quot;
+}
+</pre> 
+     </div></li> 
+    <li> <p><b>“/clusters/{clusterName}/workflows/{workflowName}/jobs/{jobName}/context”</b></p> 
+     <ul> 
+      <li>Represents job runtime information with {jobName} in {workflowName} in cluster {clusterName}. This is new endpoint in v2.0.</li> 
+      <li><b>GET</b> - return job runtime information. Example : curl <a class="externalLink" href="http://localhost:1234/admin/v2/clusters/TestCluster/workflows/Workflow1/jobs/Job1/context">http://localhost:1234/admin/v2/clusters/TestCluster/workflows/Workflow1/jobs/Job1/context</a></li> 
+     </ul> 
+     <div class="source"> 
+      <pre>{
+   &quot;id&quot;:&quot;JobContext&quot;:
+   &quot;START_TIME&quot;:&quot;1491005863291&quot;,
+   &quot;FINISH_TIME&quot;:&quot;149101.0.0612&quot;,
+   &quot;Tasks&quot;:[
+             {
+                 &quot;id&quot;:&quot;0&quot;,
+                 &quot;ASSIGNED_PARTICIPANT&quot;:&quot;P1&quot;,
+                 &quot;FINISH_TIME&quot;:&quot;1491005898905&quot;
+                 &quot;INFO&quot;:&quot;&quot;
+                 &quot;NUM_ATTEMPTS&quot;:&quot;1&quot;
+                 &quot;START_TIME&quot;:&quot;1491005863307&quot;
+                 &quot;STATE&quot;:&quot;COMPLETED&quot;
+                 &quot;TARGET&quot;:&quot;DB_0&quot;
+             },
+             {
+                 &quot;id&quot;:&quot;1&quot;,
+                 &quot;ASSIGNED_PARTICIPANT&quot;:&quot;P5&quot;,
+                 &quot;FINISH_TIME&quot;:&quot;1491005895443&quot;
+                 &quot;INFO&quot;:&quot;&quot;
+                 &quot;NUM_ATTEMPTS&quot;:&quot;1&quot;
+                 &quot;START_TIME&quot;:&quot;1491005863307&quot;
+                 &quot;STATE&quot;:&quot;COMPLETED&quot;
+                 &quot;TARGET&quot;:&quot;DB_1&quot;
+             }
+   ]
+}
+</pre> 
+     </div></li> 
+   </ul> 
+  </div> 
+ </div> 
+</div>
+			</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-0.9.5.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/0.9.5" 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 &copy;2020 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved.</p>
+				<p><a href="http://github.com/andriusvelykis/reflow-maven-skin" title="Reflow Maven skin">Reflow Maven skin</a> by <a href="http://andrius.velykis.lt" target="_blank" title="Andrius Velykis">Andrius Velykis</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="http://helix.apache.org/0.9.5-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 -->
+
+	<!-- Fallback jQuery loading from Google CDN:
+	     http://stackoverflow.com/questions/1014203/best-way-to-use-googles-hosted-jquery-but-fall-back-to-my-hosted-library-on-go -->
+	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
+	<script type="text/javascript">
+		if (typeof jQuery == 'undefined')
+		{
+			document.write(unescape("%3Cscript src='./js/jquery-1.8.3.min.js' type='text/javascript'%3E%3C/script%3E"));
+		}
+	</script>
+	
+	<script src="./js/bootstrap.min.js"></script>
+	<script src="./js/lightbox.js"></script>
+	<script src="./js/jquery.smooth-scroll.min.js"></script>
+	<!-- back button support for smooth scroll -->
+	<script src="./js/jquery.ba-bbq.min.js"></script>
+
+	<script src="./js/reflow-skin.js"></script>
+	
+	</body>
+</html>
\ No newline at end of file

Added: helix/site-content/0.9.5-docs/tutorial_spectator.html
URL: http://svn.apache.org/viewvc/helix/site-content/0.9.5-docs/tutorial_spectator.html?rev=1877963&view=auto
==============================================================================
--- helix/site-content/0.9.5-docs/tutorial_spectator.html (added)
+++ helix/site-content/0.9.5-docs/tutorial_spectator.html Wed May 20 21:04:51 2020
@@ -0,0 +1,294 @@
+
+<!DOCTYPE html>
+<!--
+ Generated by Apache Maven Doxia at 2020-05-11
+ Rendered using Maven Reflow Skin 1.0.0 (http://andriusvelykis.github.com/reflow-maven-skin)
+-->
+<html  xml:lang="en" lang="en">
+
+	<head>
+		<meta charset="UTF-8" />
+		<title>Apache Helix -   Tutorial - Spectator</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="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+		<![endif]-->
+		
+<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="page-tutorial_spectator project-095-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=".nav-collapse">
+						<span class="icon-bar"></span>
+						<span class="icon-bar"></span>
+						<span class="icon-bar"></span>
+					</a>
+					<a class="brand" href="..">Apache Helix</a>
+					<div class="nav-collapse">
+						<ul class="nav pull-right">
+							<li><a href="index.html" title="Helix 0.9.5">Helix 0.9.5 </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-0.9.5.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/0.9.5" 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 class="jumbotron subhead">
+		<div class="row" id="banner">
+			<div class="span12">
+				<div class="pull-left">
+					<a href="../" 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>
+			<ul class="breadcrumb">
+				<li><a href="../" title="Apache Helix">Apache Helix </a></li>
+				<li class="divider">/</li>
+				<li><a href="./" title="Release 0.9.5">Release 0.9.5 </a></li>
+				<li class="divider">/</li>
+				<li>  Tutorial - Spectator</li>
+				<li class="publishDate version-date pull-right">Last Published: 2020-05-11</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. --> 
+<p></p> 
+<div class="section"> 
+ <div class="page-header">
+  <h2 id="Helix_Tutorial:_Spectator"><a href="./Tutorial.html">Helix Tutorial</a>: Spectator</h2>
+ </div> 
+ <p>Next, we'll learn how to implement a <b>spectator</b>. Typically, a spectator needs to react to changes within the distributed system. Examples: a client that needs to know where to send a request, a topic consumer in a consumer group. The spectator is automatically informed of changes in the <i>external state</i> of the cluster, but it does not have to add any code to keep track of other components in the system.</p> 
+ <div class="section"> 
+  <h3 id="Start_a_Connection">Start a Connection</h3> 
+  <p>Same as for a participant, The Helix manager is the common component that connects each system component with the cluster.</p> 
+  <p>It requires the following parameters:</p> 
+  <ul> 
+   <li>clusterName: A logical name to represent the group of nodes</li> 
+   <li>instanceName: A logical name of the process creating the manager instance. Generally this is host:port</li> 
+   <li>instanceType: Type of the process. This can be one of the following types, in this case, use SPECTATOR: 
+    <ul> 
+     <li>CONTROLLER: Process that controls the cluster, any number of controllers can be started but only one will be active at any given time</li> 
+     <li>PARTICIPANT: Process that performs the actual task in the distributed system</li> 
+     <li>SPECTATOR: Process that observes the changes in the cluster</li> 
+     <li>ADMIN: To carry out system admin actions</li> 
+    </ul></li> 
+   <li>zkConnectString: Connection string to ZooKeeper. This is of the form host1:port1,host2:port2,host3:port3</li> 
+  </ul> 
+  <p>After the Helix manager instance is created, the only thing that needs to be registered is the listener. When the ExternalView changes, the listener is notified.</p> 
+  <p>A spectator observes the cluster and is notified when the state of the system changes. Helix consolidates the state of entire cluster in one Znode called ExternalView. Helix provides a default implementation RoutingTableProvider that caches the cluster state and updates it when there is a change in the cluster.</p> 
+  <div class="source"> 
+   <pre>manager = HelixManagerFactory.getZKHelixManager(clusterName,
+                                                instanceName,
+                                                InstanceType.SPECTATOR,
+                                                zkConnectString);
+manager.connect();
+RoutingTableProvider routingTableProvider = new RoutingTableProvider();
+manager.addExternalViewChangeListener(routingTableProvider);
+</pre> 
+  </div> 
+ </div> 
+ <div class="section"> 
+  <h3 id="Spectator_Code">Spectator Code</h3> 
+  <p>In the following code snippet, the application sends the request to a valid instance by interrogating the external view. Suppose the desired resource for this request is in the partition myDB_1.</p> 
+  <div class="source"> 
+   <pre>// instances = routingTableProvider.getInstances(, &quot;PARTITION_NAME&quot;, &quot;PARTITION_STATE&quot;);
+instances = routingTableProvider.getInstances(&quot;myDB&quot;, &quot;myDB_1&quot;, &quot;ONLINE&quot;);
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+// Application-specific code to send a request to one of the instances                        //
+////////////////////////////////////////////////////////////////////////////////////////////////
+
+theInstance = instances.get(0);  // should choose an instance and throw an exception if none are available
+result = theInstance.sendRequest(yourApplicationRequest, responseObject);
+
+</pre> 
+  </div> 
+  <p>When the external view changes, the application needs to react by sending requests to a different instance.</p> 
+ </div> 
+</div>
+			</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-0.9.5.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/0.9.5" 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 &copy;2020 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved.</p>
+				<p><a href="http://github.com/andriusvelykis/reflow-maven-skin" title="Reflow Maven skin">Reflow Maven skin</a> by <a href="http://andrius.velykis.lt" target="_blank" title="Andrius Velykis">Andrius Velykis</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="http://helix.apache.org/0.9.5-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 -->
+
+	<!-- Fallback jQuery loading from Google CDN:
+	     http://stackoverflow.com/questions/1014203/best-way-to-use-googles-hosted-jquery-but-fall-back-to-my-hosted-library-on-go -->
+	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
+	<script type="text/javascript">
+		if (typeof jQuery == 'undefined')
+		{
+			document.write(unescape("%3Cscript src='./js/jquery-1.8.3.min.js' type='text/javascript'%3E%3C/script%3E"));
+		}
+	</script>
+	
+	<script src="./js/bootstrap.min.js"></script>
+	<script src="./js/lightbox.js"></script>
+	<script src="./js/jquery.smooth-scroll.min.js"></script>
+	<!-- back button support for smooth scroll -->
+	<script src="./js/jquery.ba-bbq.min.js"></script>
+
+	<script src="./js/reflow-skin.js"></script>
+	
+	</body>
+</html>
\ No newline at end of file



Mime
View raw message