blob: 71848fa075f0cc9a454b8819d0ee73cede3c2163 [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Apache Druid">
<meta name="keywords" content="druid,kafka,database,analytics,streaming,real-time,real time,apache,open source">
<meta name="author" content="Apache Software Foundation">
<title>Druid | Amazon Kinesis Indexing Service</title>
<link rel="alternate" type="application/atom+xml" href="/feed">
<link rel="shortcut icon" href="/img/favicon.png">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
<link href='//fonts.googleapis.com/css?family=Open+Sans+Condensed:300,700,300italic|Open+Sans:300italic,400italic,600italic,400,300,600,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="/css/bootstrap-pure.css?v=1.1">
<link rel="stylesheet" href="/css/base.css?v=1.1">
<link rel="stylesheet" href="/css/header.css?v=1.1">
<link rel="stylesheet" href="/css/footer.css?v=1.1">
<link rel="stylesheet" href="/css/syntax.css?v=1.1">
<link rel="stylesheet" href="/css/docs.css?v=1.1">
<script>
(function() {
var cx = '000162378814775985090:molvbm0vggm';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
'//cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
</head>
<body>
<!-- Start page_header include -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<div class="top-navigator">
<div class="container">
<div class="left-cont">
<a class="logo" href="/"><span class="druid-logo"></span></a>
</div>
<div class="right-cont">
<ul class="links">
<li class=""><a href="/technology">Technology</a></li>
<li class=""><a href="/use-cases">Use Cases</a></li>
<li class=""><a href="/druid-powered">Powered By</a></li>
<li class=""><a href="/docs/latest/design/">Docs</a></li>
<li class=""><a href="/community/">Community</a></li>
<li class="header-dropdown">
<a>Apache</a>
<div class="header-dropdown-menu">
<a href="https://www.apache.org/" target="_blank">Foundation</a>
<a href="https://www.apache.org/events/current-event" target="_blank">Events</a>
<a href="https://www.apache.org/licenses/" target="_blank">License</a>
<a href="https://www.apache.org/foundation/thanks.html" target="_blank">Thanks</a>
<a href="https://www.apache.org/security/" target="_blank">Security</a>
<a href="https://www.apache.org/foundation/sponsorship.html" target="_blank">Sponsorship</a>
</div>
</li>
<li class=" button-link"><a href="/downloads.html">Download</a></li>
</ul>
</div>
</div>
<div class="action-button menu-icon">
<span class="fa fa-bars"></span> MENU
</div>
<div class="action-button menu-icon-close">
<span class="fa fa-times"></span> MENU
</div>
</div>
<script type="text/javascript">
var $menu = $('.right-cont');
var $menuIcon = $('.menu-icon');
var $menuIconClose = $('.menu-icon-close');
function showMenu() {
$menu.fadeIn(100);
$menuIcon.fadeOut(100);
$menuIconClose.fadeIn(100);
}
$menuIcon.click(showMenu);
function hideMenu() {
$menu.fadeOut(100);
$menuIconClose.fadeOut(100);
$menuIcon.fadeIn(100);
}
$menuIconClose.click(hideMenu);
$(window).resize(function() {
if ($(window).width() >= 840) {
$menu.fadeIn(100);
$menuIcon.fadeOut(100);
$menuIconClose.fadeOut(100);
}
else {
$menu.fadeOut(100);
$menuIcon.fadeIn(100);
$menuIconClose.fadeOut(100);
}
});
</script>
<!-- Stop page_header include -->
<div class="container doc-container">
<p> Looking for the <a href="/docs/0.19.0/">latest stable documentation</a>?</p>
<div class="row">
<div class="col-md-9 doc-content">
<p>
<a class="btn btn-default btn-xs visible-xs-inline-block visible-sm-inline-block" href="#toc">Table of Contents</a>
</p>
<!--
~ 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.
-->
<h1 id="kinesis-indexing-service">Kinesis Indexing Service</h1>
<p>Similar to the <a href="./kafka-ingestion.html">Kafka indexing service</a>, the Kinesis indexing service enables the configuration of <em>supervisors</em> on the Overlord, which facilitate ingestion from
Kinesis by managing the creation and lifetime of Kinesis indexing tasks. These indexing tasks read events using Kinesis&#39;s own
Shards and Sequence Number mechanism and are therefore able to provide guarantees of exactly-once ingestion. They are also
able to read non-recent events from Kinesis and are not subject to the window period considerations imposed on other
ingestion mechanisms using Tranquility. The supervisor oversees the state of the indexing tasks to coordinate handoffs, manage failures,
and ensure that the scalability and replication requirements are maintained.</p>
<p>The Kinesis indexing service is provided as the <code>druid-kinesis-indexing-service</code> core Apache Druid (incubating) extension (see
<a href="../../operations/including-extensions.html">Including Extensions</a>). Please note that this is
currently designated as an <em>experimental feature</em> and is subject to the usual
<a href="../experimental.html">experimental caveats</a>.</p>
<h2 id="submitting-a-supervisor-spec">Submitting a Supervisor Spec</h2>
<p>The Kinesis indexing service requires that the <code>druid-kinesis-indexing-service</code> extension be loaded on both the Overlord
and the MiddleManagers. A supervisor for a dataSource is started by submitting a supervisor spec via HTTP POST to
<code>http://&lt;OVERLORD_IP&gt;:&lt;OVERLORD_PORT&gt;/druid/indexer/v1/supervisor</code>, for example:</p>
<div class="highlight"><pre><code class="language-text" data-lang="text"><span></span>curl -X POST -H &#39;Content-Type: application/json&#39; -d @supervisor-spec.json http://localhost:8090/druid/indexer/v1/supervisor
</code></pre></div>
<p>A sample supervisor spec is shown below:</p>
<div class="highlight"><pre><code class="language-json" data-lang="json"><span></span><span class="p">{</span>
<span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;kinesis&quot;</span><span class="p">,</span>
<span class="nt">&quot;dataSchema&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;dataSource&quot;</span><span class="p">:</span> <span class="s2">&quot;metrics-kinesis&quot;</span><span class="p">,</span>
<span class="nt">&quot;parser&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;string&quot;</span><span class="p">,</span>
<span class="nt">&quot;parseSpec&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;format&quot;</span><span class="p">:</span> <span class="s2">&quot;json&quot;</span><span class="p">,</span>
<span class="nt">&quot;timestampSpec&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;column&quot;</span><span class="p">:</span> <span class="s2">&quot;timestamp&quot;</span><span class="p">,</span>
<span class="nt">&quot;format&quot;</span><span class="p">:</span> <span class="s2">&quot;auto&quot;</span>
<span class="p">},</span>
<span class="nt">&quot;dimensionsSpec&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;dimensions&quot;</span><span class="p">:</span> <span class="p">[],</span>
<span class="nt">&quot;dimensionExclusions&quot;</span><span class="p">:</span> <span class="p">[</span>
<span class="s2">&quot;timestamp&quot;</span><span class="p">,</span>
<span class="s2">&quot;value&quot;</span>
<span class="p">]</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">},</span>
<span class="nt">&quot;metricsSpec&quot;</span><span class="p">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;count&quot;</span><span class="p">,</span>
<span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;count&quot;</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;value_sum&quot;</span><span class="p">,</span>
<span class="nt">&quot;fieldName&quot;</span><span class="p">:</span> <span class="s2">&quot;value&quot;</span><span class="p">,</span>
<span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;doubleSum&quot;</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;value_min&quot;</span><span class="p">,</span>
<span class="nt">&quot;fieldName&quot;</span><span class="p">:</span> <span class="s2">&quot;value&quot;</span><span class="p">,</span>
<span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;doubleMin&quot;</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;value_max&quot;</span><span class="p">,</span>
<span class="nt">&quot;fieldName&quot;</span><span class="p">:</span> <span class="s2">&quot;value&quot;</span><span class="p">,</span>
<span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;doubleMax&quot;</span>
<span class="p">}</span>
<span class="p">],</span>
<span class="nt">&quot;granularitySpec&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;uniform&quot;</span><span class="p">,</span>
<span class="nt">&quot;segmentGranularity&quot;</span><span class="p">:</span> <span class="s2">&quot;HOUR&quot;</span><span class="p">,</span>
<span class="nt">&quot;queryGranularity&quot;</span><span class="p">:</span> <span class="s2">&quot;NONE&quot;</span>
<span class="p">}</span>
<span class="p">},</span>
<span class="nt">&quot;tuningConfig&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;kinesis&quot;</span><span class="p">,</span>
<span class="nt">&quot;maxRowsPerSegment&quot;</span><span class="p">:</span> <span class="mi">5000000</span>
<span class="p">},</span>
<span class="nt">&quot;ioConfig&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;stream&quot;</span><span class="p">:</span> <span class="s2">&quot;metrics&quot;</span><span class="p">,</span>
<span class="nt">&quot;endpoint&quot;</span><span class="p">:</span> <span class="s2">&quot;kinesis.us-east-1.amazonaws.com&quot;</span><span class="p">,</span>
<span class="nt">&quot;taskCount&quot;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
<span class="nt">&quot;replicas&quot;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
<span class="nt">&quot;taskDuration&quot;</span><span class="p">:</span> <span class="s2">&quot;PT1H&quot;</span><span class="p">,</span>
<span class="nt">&quot;recordsPerFetch&quot;</span><span class="p">:</span> <span class="mi">2000</span><span class="p">,</span>
<span class="nt">&quot;fetchDelayMillis&quot;</span><span class="p">:</span> <span class="mi">1000</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre></div>
<h2 id="supervisor-configuration">Supervisor Configuration</h2>
<table><thead>
<tr>
<th>Field</th>
<th>Description</th>
<th>Required</th>
</tr>
</thead><tbody>
<tr>
<td><code>type</code></td>
<td>The supervisor type, this should always be <code>kinesis</code>.</td>
<td>yes</td>
</tr>
<tr>
<td><code>dataSchema</code></td>
<td>The schema that will be used by the Kinesis indexing task during ingestion, see <a href="../../ingestion/ingestion-spec.html#dataschema">Ingestion Spec DataSchema</a>.</td>
<td>yes</td>
</tr>
<tr>
<td><code>ioConfig</code></td>
<td>A KinesisSupervisorIOConfig to configure the supervisor and indexing tasks, see below.</td>
<td>yes</td>
</tr>
<tr>
<td><code>tuningConfig</code></td>
<td>A KinesisSupervisorTuningConfig to configure the supervisor and indexing tasks, see below.</td>
<td>no</td>
</tr>
</tbody></table>
<h3 id="kinesissupervisortuningconfig">KinesisSupervisorTuningConfig</h3>
<p>The tuningConfig is optional and default parameters will be used if no tuningConfig is specified.</p>
<table><thead>
<tr>
<th>Field</th>
<th>Type</th>
<th>Description</th>
<th>Required</th>
</tr>
</thead><tbody>
<tr>
<td><code>type</code></td>
<td>String</td>
<td>The indexing task type, this should always be <code>kinesis</code>.</td>
<td>yes</td>
</tr>
<tr>
<td><code>maxRowsInMemory</code></td>
<td>Integer</td>
<td>The number of rows to aggregate before persisting. This number is the post-aggregation rows, so it is not equivalent to the number of input events, but the number of aggregated rows that those events result in. This is used to manage the required JVM heap size. Maximum heap memory usage for indexing scales with maxRowsInMemory * (2 + maxPendingPersists).</td>
<td>no (default == 100000)</td>
</tr>
<tr>
<td><code>maxBytesInMemory</code></td>
<td>Long</td>
<td>The number of bytes to aggregate in heap memory before persisting. This is based on a rough estimate of memory usage and not actual usage. Normally this is computed internally and user does not need to set it. The maximum heap memory usage for indexing is maxBytesInMemory * (2 + maxPendingPersists).</td>
<td>no (default == One-sixth of max JVM memory)</td>
</tr>
<tr>
<td><code>maxRowsPerSegment</code></td>
<td>Integer</td>
<td>The number of rows to aggregate into a segment; this number is post-aggregation rows. Handoff will happen either if <code>maxRowsPerSegment</code> or <code>maxTotalRows</code> is hit or every <code>intermediateHandoffPeriod</code>, whichever happens earlier.</td>
<td>no (default == 5000000)</td>
</tr>
<tr>
<td><code>maxTotalRows</code></td>
<td>Long</td>
<td>The number of rows to aggregate across all segments; this number is post-aggregation rows. Handoff will happen either if <code>maxRowsPerSegment</code> or <code>maxTotalRows</code> is hit or every <code>intermediateHandoffPeriod</code>, whichever happens earlier.</td>
<td>no (default == unlimited)</td>
</tr>
<tr>
<td><code>intermediatePersistPeriod</code></td>
<td>ISO8601 Period</td>
<td>The period that determines the rate at which intermediate persists occur.</td>
<td>no (default == PT10M)</td>
</tr>
<tr>
<td><code>maxPendingPersists</code></td>
<td>Integer</td>
<td>Maximum number of persists that can be pending but not started. If this limit would be exceeded by a new intermediate persist, ingestion will block until the currently-running persist finishes. Maximum heap memory usage for indexing scales with maxRowsInMemory * (2 + maxPendingPersists).</td>
<td>no (default == 0, meaning one persist can be running concurrently with ingestion, and none can be queued up)</td>
</tr>
<tr>
<td><code>indexSpec</code></td>
<td>Object</td>
<td>Tune how data is indexed, see &#39;IndexSpec&#39; below for more details.</td>
<td>no</td>
</tr>
<tr>
<td><code>reportParseExceptions</code></td>
<td>Boolean</td>
<td>If true, exceptions encountered during parsing will be thrown and will halt ingestion; if false, unparseable rows and fields will be skipped.</td>
<td>no (default == false)</td>
</tr>
<tr>
<td><code>handoffConditionTimeout</code></td>
<td>Long</td>
<td>Milliseconds to wait for segment handoff. It must be &gt;= 0, where 0 means to wait forever.</td>
<td>no (default == 0)</td>
</tr>
<tr>
<td><code>resetOffsetAutomatically</code></td>
<td>Boolean</td>
<td>Whether to reset the consumer sequence numbers if the next sequence number that it is trying to fetch is less than the earliest available sequence number for that particular shard. The sequence number will be reset to either the earliest or latest sequence number depending on <code>useEarliestOffset</code> property of <code>KinesisSupervisorIOConfig</code> (see below). This situation typically occurs when messages in Kinesis are no longer available for consumption and therefore won&#39;t be ingested into Druid. If set to false then ingestion for that particular shard will halt and manual intervention is required to correct the situation, please see <code>Reset Supervisor</code> API below.</td>
<td>no (default == false)</td>
</tr>
<tr>
<td><code>skipSequenceNumberAvailabilityCheck</code></td>
<td>Boolean</td>
<td>Whether to enable checking if the current sequence number is still available in a particular Kinesis shard. If set to false, the indexing task will attempt to reset the current sequence number (or not), depending on the value of <code>resetOffsetAutomatically</code>.</td>
<td>no (default == false)</td>
</tr>
<tr>
<td><code>workerThreads</code></td>
<td>Integer</td>
<td>The number of threads that will be used by the supervisor for asynchronous operations.</td>
<td>no (default == min(10, taskCount))</td>
</tr>
<tr>
<td><code>chatThreads</code></td>
<td>Integer</td>
<td>The number of threads that will be used for communicating with indexing tasks.</td>
<td>no (default == min(10, taskCount * replicas))</td>
</tr>
<tr>
<td><code>chatRetries</code></td>
<td>Integer</td>
<td>The number of times HTTP requests to indexing tasks will be retried before considering tasks unresponsive.</td>
<td>no (default == 8)</td>
</tr>
<tr>
<td><code>httpTimeout</code></td>
<td>ISO8601 Period</td>
<td>How long to wait for a HTTP response from an indexing task.</td>
<td>no (default == PT10S)</td>
</tr>
<tr>
<td><code>shutdownTimeout</code></td>
<td>ISO8601 Period</td>
<td>How long to wait for the supervisor to attempt a graceful shutdown of tasks before exiting.</td>
<td>no (default == PT80S)</td>
</tr>
<tr>
<td><code>recordBufferSize</code></td>
<td>Integer</td>
<td>Size of the buffer (number of events) used between the Kinesis fetch threads and the main ingestion thread.</td>
<td>no (default == 10000)</td>
</tr>
<tr>
<td><code>recordBufferOfferTimeout</code></td>
<td>Integer</td>
<td>Length of time in milliseconds to wait for space to become available in the buffer before timing out.</td>
<td>no (default == 5000)</td>
</tr>
<tr>
<td><code>recordBufferFullWait</code></td>
<td>Integer</td>
<td>Length of time in milliseconds to wait for the buffer to drain before attempting to fetch records from Kinesis again.</td>
<td>no (default == 5000)</td>
</tr>
<tr>
<td><code>fetchSequenceNumberTimeout</code></td>
<td>Integer</td>
<td>Length of time in milliseconds to wait for Kinesis to return the earliest or latest sequence number for a shard. Kinesis will not return the latest sequence number if no data is actively being written to that shard. In this case, this fetch call will repeatedly timeout and retry until fresh data is written to the stream.</td>
<td>no (default == 60000)</td>
</tr>
<tr>
<td><code>fetchThreads</code></td>
<td>Integer</td>
<td>Size of the pool of threads fetching data from Kinesis. There is no benefit in having more threads than Kinesis shards.</td>
<td>no (default == max(1, {numProcessors} - 1))</td>
</tr>
<tr>
<td><code>segmentWriteOutMediumFactory</code></td>
<td>Object</td>
<td>Segment write-out medium to use when creating segments. See below for more information.</td>
<td>no (not specified by default, the value from <code>druid.peon.defaultSegmentWriteOutMediumFactory.type</code> is used)</td>
</tr>
<tr>
<td><code>intermediateHandoffPeriod</code></td>
<td>ISO8601 Period</td>
<td>How often the tasks should hand off segments. Handoff will happen either if <code>maxRowsPerSegment</code> or <code>maxTotalRows</code> is hit or every <code>intermediateHandoffPeriod</code>, whichever happens earlier.</td>
<td>no (default == P2147483647D)</td>
</tr>
<tr>
<td><code>logParseExceptions</code></td>
<td>Boolean</td>
<td>If true, log an error message when a parsing exception occurs, containing information about the row where the error occurred.</td>
<td>no, default == false</td>
</tr>
<tr>
<td><code>maxParseExceptions</code></td>
<td>Integer</td>
<td>The maximum number of parse exceptions that can occur before the task halts ingestion and fails. Overridden if <code>reportParseExceptions</code> is set.</td>
<td>no, unlimited default</td>
</tr>
<tr>
<td><code>maxSavedParseExceptions</code></td>
<td>Integer</td>
<td>When a parse exception occurs, Druid can keep track of the most recent parse exceptions. &quot;maxSavedParseExceptions&quot; limits how many exception instances will be saved. These saved exceptions will be made available after the task finishes in the <a href="../../ingestion/reports.html">task completion report</a>. Overridden if <code>reportParseExceptions</code> is set.</td>
<td>no, default == 0</td>
</tr>
<tr>
<td><code>maxRecordsPerPoll</code></td>
<td>Integer</td>
<td>The maximum number of records/events to be fetched from buffer per poll. The actual maximum will be `Max(maxRecordsPerPoll, Max(bufferSize, 1))</td>
<td>no, default == 100</td>
</tr>
</tbody></table>
<h4 id="indexspec">IndexSpec</h4>
<table><thead>
<tr>
<th>Field</th>
<th>Type</th>
<th>Description</th>
<th>Required</th>
</tr>
</thead><tbody>
<tr>
<td>bitmap</td>
<td>Object</td>
<td>Compression format for bitmap indexes. Should be a JSON object; see below for options.</td>
<td>no (defaults to Concise)</td>
</tr>
<tr>
<td>dimensionCompression</td>
<td>String</td>
<td>Compression format for dimension columns. Choose from <code>LZ4</code>, <code>LZF</code>, or <code>uncompressed</code>.</td>
<td>no (default == <code>LZ4</code>)</td>
</tr>
<tr>
<td>metricCompression</td>
<td>String</td>
<td>Compression format for metric columns. Choose from <code>LZ4</code>, <code>LZF</code>, <code>uncompressed</code>, or <code>none</code>.</td>
<td>no (default == <code>LZ4</code>)</td>
</tr>
<tr>
<td>longEncoding</td>
<td>String</td>
<td>Encoding format for metric and dimension columns with type long. Choose from <code>auto</code> or <code>longs</code>. <code>auto</code> encodes the values using sequence number or lookup table depending on column cardinality, and store them with variable size. <code>longs</code> stores the value as is with 8 bytes each.</td>
<td>no (default == <code>longs</code>)</td>
</tr>
</tbody></table>
<h5 id="bitmap-types">Bitmap types</h5>
<p>For Concise bitmaps:</p>
<table><thead>
<tr>
<th>Field</th>
<th>Type</th>
<th>Description</th>
<th>Required</th>
</tr>
</thead><tbody>
<tr>
<td><code>type</code></td>
<td>String</td>
<td>Must be <code>concise</code>.</td>
<td>yes</td>
</tr>
</tbody></table>
<p>For Roaring bitmaps:</p>
<table><thead>
<tr>
<th>Field</th>
<th>Type</th>
<th>Description</th>
<th>Required</th>
</tr>
</thead><tbody>
<tr>
<td><code>type</code></td>
<td>String</td>
<td>Must be <code>roaring</code>.</td>
<td>yes</td>
</tr>
<tr>
<td><code>compressRunOnSerialization</code></td>
<td>Boolean</td>
<td>Use a run-length encoding where it is estimated as more space efficient.</td>
<td>no (default == <code>true</code>)</td>
</tr>
</tbody></table>
<h4 id="segmentwriteoutmediumfactory">SegmentWriteOutMediumFactory</h4>
<table><thead>
<tr>
<th>Field</th>
<th>Type</th>
<th>Description</th>
<th>Required</th>
</tr>
</thead><tbody>
<tr>
<td><code>type</code></td>
<td>String</td>
<td>See <a href="../../configuration/index.html#segmentwriteoutmediumfactory">Additional Peon Configuration: SegmentWriteOutMediumFactory</a> for explanation and available options.</td>
<td>yes</td>
</tr>
</tbody></table>
<h3 id="kinesissupervisorioconfig">KinesisSupervisorIOConfig</h3>
<table><thead>
<tr>
<th>Field</th>
<th>Type</th>
<th>Description</th>
<th>Required</th>
</tr>
</thead><tbody>
<tr>
<td><code>stream</code></td>
<td>String</td>
<td>The Kinesis stream to read.</td>
<td>yes</td>
</tr>
<tr>
<td><code>endpoint</code></td>
<td>String</td>
<td>The AWS Kinesis stream endpoint for a region. You can find a list of endpoints <a href="http://docs.aws.amazon.com/general/latest/gr/rande.html#ak_region">here</a>.</td>
<td>no (default == kinesis.us-east-1.amazonaws.com)</td>
</tr>
<tr>
<td><code>replicas</code></td>
<td>Integer</td>
<td>The number of replica sets, where 1 means a single set of tasks (no replication). Replica tasks will always be assigned to different workers to provide resiliency against process failure.</td>
<td>no (default == 1)</td>
</tr>
<tr>
<td><code>taskCount</code></td>
<td>Integer</td>
<td>The maximum number of <em>reading</em> tasks in a <em>replica set</em>. This means that the maximum number of reading tasks will be <code>taskCount * replicas</code> and the total number of tasks (<em>reading</em> + <em>publishing</em>) will be higher than this. See &#39;Capacity Planning&#39; below for more details. The number of reading tasks will be less than <code>taskCount</code> if <code>taskCount &gt; {numKinesisshards}</code>.</td>
<td>no (default == 1)</td>
</tr>
<tr>
<td><code>taskDuration</code></td>
<td>ISO8601 Period</td>
<td>The length of time before tasks stop reading and begin publishing their segment.</td>
<td>no (default == PT1H)</td>
</tr>
<tr>
<td><code>startDelay</code></td>
<td>ISO8601 Period</td>
<td>The period to wait before the supervisor starts managing tasks.</td>
<td>no (default == PT5S)</td>
</tr>
<tr>
<td><code>period</code></td>
<td>ISO8601 Period</td>
<td>How often the supervisor will execute its management logic. Note that the supervisor will also run in response to certain events (such as tasks succeeding, failing, and reaching their taskDuration) so this value specifies the maximum time between iterations.</td>
<td>no (default == PT30S)</td>
</tr>
<tr>
<td><code>useEarliestSequenceNumber</code></td>
<td>Boolean</td>
<td>If a supervisor is managing a dataSource for the first time, it will obtain a set of starting sequence numbers from Kinesis. This flag determines whether it retrieves the earliest or latest sequence numbers in Kinesis. Under normal circumstances, subsequent tasks will start from where the previous segments ended so this flag will only be used on first run.</td>
<td>no (default == false)</td>
</tr>
<tr>
<td><code>completionTimeout</code></td>
<td>ISO8601 Period</td>
<td>The length of time to wait before declaring a publishing task as failed and terminating it. If this is set too low, your tasks may never publish. The publishing clock for a task begins roughly after <code>taskDuration</code> elapses.</td>
<td>no (default == PT6H)</td>
</tr>
<tr>
<td><code>lateMessageRejectionPeriod</code></td>
<td>ISO8601 Period</td>
<td>Configure tasks to reject messages with timestamps earlier than this period before the task was created; for example if this is set to <code>PT1H</code> and the supervisor creates a task at <em>2016-01-01T12:00Z</em>, messages with timestamps earlier than <em>2016-01-01T11:00Z</em> will be dropped. This may help prevent concurrency issues if your data stream has late messages and you have multiple pipelines that need to operate on the same segments (e.g. a realtime and a nightly batch ingestion pipeline).</td>
<td>no (default == none)</td>
</tr>
<tr>
<td><code>earlyMessageRejectionPeriod</code></td>
<td>ISO8601 Period</td>
<td>Configure tasks to reject messages with timestamps later than this period after the task reached its taskDuration; for example if this is set to <code>PT1H</code>, the taskDuration is set to <code>PT1H</code> and the supervisor creates a task at <em>2016-01-01T12:00Z</em>, messages with timestamps later than <em>2016-01-01T14:00Z</em> will be dropped. <strong>Note:</strong> Tasks sometimes run past their task duration, for example, in cases of supervisor failover. Setting earlyMessageRejectionPeriod too low may cause messages to be dropped unexpectedly whenever a task runs past its originally configured task duration.</td>
<td>no (default == none)</td>
</tr>
<tr>
<td><code>recordsPerFetch</code></td>
<td>Integer</td>
<td>The number of records to request per GetRecords call to Kinesis. See &#39;Determining Fetch Settings&#39; below.</td>
<td>no (default == 2000)</td>
</tr>
<tr>
<td><code>fetchDelayMillis</code></td>
<td>Integer</td>
<td>Time in milliseconds to wait between subsequent GetRecords calls to Kinesis. See &#39;Determining Fetch Settings&#39; below.</td>
<td>no (default == 1000)</td>
</tr>
<tr>
<td><code>awsAssumedRoleArn</code></td>
<td>String</td>
<td>The AWS assumed role to use for additional permissions.</td>
<td>no</td>
</tr>
<tr>
<td><code>awsExternalId</code></td>
<td>String</td>
<td>The AWS external id to use for additional permissions.</td>
<td>no</td>
</tr>
<tr>
<td><code>deaggregate</code></td>
<td>Boolean</td>
<td>Whether to use the de-aggregate function of the KCL. See below for details.</td>
<td>no</td>
</tr>
</tbody></table>
<h2 id="operations">Operations</h2>
<p>This section gives descriptions of how some supervisor APIs work specifically in Kinesis Indexing Service.
For all supervisor APIs, please check <a href="../../operations/api-reference.html#supervisors">Supervisor APIs</a>.</p>
<h3 id="aws-authentication">AWS Authentication</h3>
<p>To authenticate with AWS, you must provide your AWS access key and AWS secret key via runtime.properties, for example:
<code>
-Ddruid.kinesis.accessKey=123 -Ddruid.kinesis.secretKey=456
</code>
The AWS access key ID and secret access key are used for Kinesis API requests. If this is not provided, the service will look for credentials set in environment variables, in the default profile configuration file, and from the EC2 instance profile provider (in this order).</p>
<h3 id="getting-supervisor-status-report">Getting Supervisor Status Report</h3>
<p><code>GET /druid/indexer/v1/supervisor/&lt;supervisorId&gt;/status</code> returns a snapshot report of the current state of the tasks managed by the given supervisor. This includes the latest
sequence numbers as reported by Kinesis. Unlike the Kafka Indexing Service, stats about lag is not yet supported.</p>
<h3 id="updating-existing-supervisors">Updating Existing Supervisors</h3>
<p><code>POST /druid/indexer/v1/supervisor</code> can be used to update existing supervisor spec.
Calling this endpoint when there is already an existing supervisor for the same dataSource will cause:</p>
<ul>
<li>The running supervisor to signal its managed tasks to stop reading and begin publishing.</li>
<li>The running supervisor to exit.</li>
<li>A new supervisor to be created using the configuration provided in the request body. This supervisor will retain the
existing publishing tasks and will create new tasks starting at the sequence numbers the publishing tasks ended on.</li>
</ul>
<p>Seamless schema migrations can thus be achieved by simply submitting the new schema using this endpoint.</p>
<h3 id="suspending-and-resuming-supervisors">Suspending and Resuming Supervisors</h3>
<p>You can suspend and resume a supervisor using <code>POST /druid/indexer/v1/supervisor/&lt;supervisorId&gt;/suspend</code> and <code>POST /druid/indexer/v1/supervisor/&lt;supervisorId&gt;/resume</code>, respectively.</p>
<p>Note that the supervisor itself will still be operating and emitting logs and metrics,
it will just ensure that no indexing tasks are running until the supervisor is resumed.</p>
<h3 id="resetting-supervisors">Resetting Supervisors</h3>
<p>To reset a running supervisor, you can use <code>POST /druid/indexer/v1/supervisor/&lt;supervisorId&gt;/reset</code>.</p>
<p>The indexing service keeps track of the latest persisted Kinesis sequence number in order to provide exactly-once ingestion
guarantees across tasks. Subsequent tasks must start reading from where the previous task completed in order for the
generated segments to be accepted. If the messages at the expected starting sequence numbers are no longer available in Kinesis
(typically because the message retention period has elapsed or the topic was removed and re-created) the supervisor will
refuse to start and in-flight tasks will fail.</p>
<p>This endpoint can be used to clear the stored sequence numbers which will cause the supervisor to start reading from
either the earliest or latest sequence numbers in Kinesis (depending on the value of <code>useEarliestSequenceNumber</code>). The supervisor must be
running for this endpoint to be available. After the stored sequence numbers are cleared, the supervisor will automatically kill
and re-create any active tasks so that tasks begin reading from valid sequence numbers.</p>
<p>Note that since the stored sequence numbers are necessary to guarantee exactly-once ingestion, resetting them with this endpoint
may cause some Kinesis messages to be skipped or to be read twice.</p>
<h3 id="terminating-supervisors">Terminating Supervisors</h3>
<p><code>POST /druid/indexer/v1/supervisor/&lt;supervisorId&gt;/terminate</code> terminates a supervisor and causes all associated indexing
tasks managed by this supervisor to immediately stop and begin
publishing their segments. This supervisor will still exist in the metadata store and it&#39;s history may be retrieved
with the supervisor history api, but will not be listed in the &#39;get supervisors&#39; api response nor can it&#39;s configuration
or status report be retrieved. The only way this supervisor can start again is by submitting a functioning supervisor
spec to the create api.</p>
<h3 id="capacity-planning">Capacity Planning</h3>
<p>Kinesis indexing tasks run on MiddleManagers and are thus limited by the resources available in the MiddleManager
cluster. In particular, you should make sure that you have sufficient worker capacity (configured using the
<code>druid.worker.capacity</code> property) to handle the configuration in the supervisor spec. Note that worker capacity is
shared across all types of indexing tasks, so you should plan your worker capacity to handle your total indexing load
(e.g. batch processing, realtime tasks, merging tasks, etc.). If your workers run out of capacity, Kinesis indexing tasks
will queue and wait for the next available worker. This may cause queries to return partial results but will not result
in data loss (assuming the tasks run before Kinesis purges those sequence numbers).</p>
<p>A running task will normally be in one of two states: <em>reading</em> or <em>publishing</em>. A task will remain in reading state for
<code>taskDuration</code>, at which point it will transition to publishing state. A task will remain in publishing state for as long
as it takes to generate segments, push segments to deep storage, and have them be loaded and served by a Historical process
(or until <code>completionTimeout</code> elapses).</p>
<p>The number of reading tasks is controlled by <code>replicas</code> and <code>taskCount</code>. In general, there will be <code>replicas * taskCount</code>
reading tasks, the exception being if taskCount &gt; {numKinesisShards} in which case {numKinesisShards} tasks will
be used instead. When <code>taskDuration</code> elapses, these tasks will transition to publishing state and <code>replicas * taskCount</code>
new reading tasks will be created. Therefore to allow for reading tasks and publishing tasks to run concurrently, there
should be a minimum capacity of:</p>
<div class="highlight"><pre><code class="language-text" data-lang="text"><span></span>workerCapacity = 2 * replicas * taskCount
</code></pre></div>
<p>This value is for the ideal situation in which there is at most one set of tasks publishing while another set is reading.
In some circumstances, it is possible to have multiple sets of tasks publishing simultaneously. This would happen if the
time-to-publish (generate segment, push to deep storage, loaded on Historical) &gt; <code>taskDuration</code>. This is a valid
scenario (correctness-wise) but requires additional worker capacity to support. In general, it is a good idea to have
<code>taskDuration</code> be large enough that the previous set of tasks finishes publishing before the current set begins.</p>
<h3 id="supervisor-persistence">Supervisor Persistence</h3>
<p>When a supervisor spec is submitted via the <code>POST /druid/indexer/v1/supervisor</code> endpoint, it is persisted in the
configured metadata database. There can only be a single supervisor per dataSource, and submitting a second spec for
the same dataSource will overwrite the previous one.</p>
<p>When an Overlord gains leadership, either by being started or as a result of another Overlord failing, it will spawn
a supervisor for each supervisor spec in the metadata database. The supervisor will then discover running Kinesis indexing
tasks and will attempt to adopt them if they are compatible with the supervisor&#39;s configuration. If they are not
compatible because they have a different ingestion spec or shard allocation, the tasks will be killed and the
supervisor will create a new set of tasks. In this way, the supervisors are persistent across Overlord restarts and
fail-overs.</p>
<p>A supervisor is stopped via the <code>POST /druid/indexer/v1/supervisor/&lt;supervisorId&gt;/terminate</code> endpoint. This places a
tombstone marker in the database (to prevent the supervisor from being reloaded on a restart) and then gracefully
shuts down the currently running supervisor. When a supervisor is shut down in this way, it will instruct its
managed tasks to stop reading and begin publishing their segments immediately. The call to the shutdown endpoint will
return after all tasks have been signalled to stop but before the tasks finish publishing their segments.</p>
<h3 id="schema-configuration-changes">Schema/Configuration Changes</h3>
<p>Schema and configuration changes are handled by submitting the new supervisor spec via the same
<code>POST /druid/indexer/v1/supervisor</code> endpoint used to initially create the supervisor. The Overlord will initiate a
graceful shutdown of the existing supervisor which will cause the tasks being managed by that supervisor to stop reading
and begin publishing their segments. A new supervisor will then be started which will create a new set of tasks that
will start reading from the sequence numbers where the previous now-publishing tasks left off, but using the updated schema.
In this way, configuration changes can be applied without requiring any pause in ingestion.</p>
<h3 id="deployment-notes">Deployment Notes</h3>
<h4 id="on-the-subject-of-segments">On the Subject of Segments</h4>
<p>Each Kinesis Indexing Task puts events consumed from Kinesis Shards assigned to it in a single segment for each segment
granular interval until maxRowsPerSegment, maxTotalRows or intermediateHandoffPeriod limit is reached, at this point a new shard
for this segment granularity is created for further events. Kinesis Indexing Task also does incremental hand-offs which
means that all the segments created by a task will not be held up till the task duration is over. As soon as maxRowsPerSegment,
maxTotalRows or intermediateHandoffPeriod limit is hit, all the segments held by the task at that point in time will be handed-off
and new set of segments will be created for further events. This means that the task can run for longer durations of time
without accumulating old segments locally on Middle Manager processes and it is encouraged to do so.</p>
<p>Kinesis Indexing Service may still produce some small segments. Lets say the task duration is 4 hours, segment granularity
is set to an HOUR and Supervisor was started at 9:10 then after 4 hours at 13:10, new set of tasks will be started and
events for the interval 13:00 - 14:00 may be split across previous and new set of tasks. If you see it becoming a problem then
one can schedule re-indexing tasks be run to merge segments together into new segments of an ideal size (in the range of ~500-700 MB per segment).
Details on how to optimize the segment size can be found on <a href="../../operations/segment-optimization.html">Segment size optimization</a>.
There is also ongoing work to support automatic segment compaction of sharded segments as well as compaction not requiring
Hadoop (see <a href="https://github.com/apache/incubator-druid/pull/5102">here</a>).</p>
<h3 id="determining-fetch-settings">Determining Fetch Settings</h3>
<p>Internally, the Kinesis Indexing Service uses the Kinesis Record Supplier abstraction for fetching Kinesis data records and storing the records
locally. The way the Kinesis Record Supplier fetches records is to have a separate thread run the fetching operation per each Kinesis Shard, the
max number of threads is determined by <code>fetchThreads</code>. For example, a Kinesis stream with 3 shards will have 3 threads, each fetching from a shard separately.
There is a delay between each fetching operation, which is controlled by <code>fetchDelayMillis</code>. The maximum number of records to be fetched per thread per
operation is controlled by <code>recordsPerFetch</code>. Note that this is not the same as <code>maxRecordsPerPoll</code>.</p>
<p>The records fetched by each thread will be pushed to a queue in the order that they are fetched. The records are stored in this queue until <code>poll()</code> is called
by either the supervisor or the indexing task. <code>poll()</code> will attempt to drain the internal buffer queue up to a limit of <code>max(maxRecordsPerPoll, q.size())</code>.
Here <code>maxRecordsPerPoll</code> controls the theoretical maximum records to drain out of the buffer queue, so setting this parameter to a reasonable value is essential
in preventing the queue from overflowing or memory exceeding heap size.</p>
<p>Kinesis places the following restrictions on calls to fetch records:</p>
<ul>
<li>Each data record can be up to 1 MB in size.</li>
<li>Each shard can support up to 5 transactions per second for reads.</li>
<li>Each shard can read up to 2 MB per second.</li>
<li>The maximum size of data that GetRecords can return is 10 MB.</li>
</ul>
<p>Values for <code>recordsPerFetch</code> and <code>fetchDelayMillis</code> should be chosen to maximize throughput under the above constraints.
The values that you choose will depend on the average size of a record and the number of consumers you have reading from
a given shard (which will be <code>replicas</code> unless you have other consumers also reading from this Kinesis stream).</p>
<p>If the above limits are violated, AWS will throw ProvisionedThroughputExceededException errors on subsequent calls to
read data. When this happens, the Kinesis indexing service will pause by <code>fetchDelayMillis</code> and then attempt the call
again.</p>
<p>Internally, each indexing task maintains a buffer that stores the fetched but not yet processed record. <code>recordsPerFetch</code> and <code>fetchDelayMillis</code>
control this behavior. The number of records that the indexing task fetch from the buffer is controlled by <code>maxRecordsPerPoll</code>, which
determines the number of records to be processed per each ingestion loop in the task.</p>
<h2 id="deaggregation">Deaggregation</h2>
<p>See <a href="https://github.com/apache/incubator-druid/issues/6714">issue</a></p>
<p>The Kinesis indexing service supports de-aggregation of multiple rows packed into a single record by the Kinesis
Producer Library&#39;s aggregate method for more efficient data transfer. Currently, enabling the de-aggregate functionality
requires the user to manually provide the Kinesis Client Library on the classpath, since this library has a license not
compatible with Apache projects.</p>
<p>To enable this feature, add the <code>amazon-kinesis-client</code> (tested on version <code>1.9.2</code>) jar file (<a href="https://mvnrepository.com/artifact/com.amazonaws/amazon-kinesis-client/1.9.2">link</a>) under <code>dist/druid/extensions/druid-kinesis-indexing-service/</code>.
Then when submitting a supervisor-spec, set <code>deaggregate</code> to true.</p>
</div>
<div class="col-md-3">
<div class="searchbox">
<gcse:searchbox-only></gcse:searchbox-only>
</div>
<div id="toc" class="nav toc hidden-print">
</div>
</div>
</div>
</div>
<!-- Start page_footer include -->
<footer class="druid-footer">
<div class="container">
<div class="text-center">
<p>
<a href="/technology">Technology</a>&ensp;·&ensp;
<a href="/use-cases">Use Cases</a>&ensp;·&ensp;
<a href="/druid-powered">Powered by Druid</a>&ensp;·&ensp;
<a href="/docs/latest/">Docs</a>&ensp;·&ensp;
<a href="/community/">Community</a>&ensp;·&ensp;
<a href="/downloads.html">Download</a>&ensp;·&ensp;
<a href="/faq">FAQ</a>
</p>
</div>
<div class="text-center">
<a title="Join the user group" href="https://groups.google.com/forum/#!forum/druid-user" target="_blank"><span class="fa fa-comments"></span></a>&ensp;·&ensp;
<a title="Follow Druid" href="https://twitter.com/druidio" target="_blank"><span class="fab fa-twitter"></span></a>&ensp;·&ensp;
<a title="GitHub" href="https://github.com/apache/druid" target="_blank"><span class="fab fa-github"></span></a>
</div>
<div class="text-center license">
Copyright © 2020 <a href="https://www.apache.org/" target="_blank">Apache Software Foundation</a>.<br>
Except where otherwise noted, licensed under <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA 4.0</a>.<br>
Apache Druid, Druid, and the Druid logo are either registered trademarks or trademarks of The Apache Software Foundation in the United States and other countries.
</div>
</div>
</footer>
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-131010415-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-131010415-1');
</script>
<script>
function trackDownload(type, url) {
ga('send', 'event', 'download', type, url);
}
</script>
<script src="//code.jquery.com/jquery.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="/assets/js/druid.js"></script>
<!-- stop page_footer include -->
<script>
$(function() {
$(".toc").load("/docs/0.14.2-incubating/toc.html");
// There is no way to tell when .gsc-input will be async loaded into the page so just try to set a placeholder until it works
var tries = 0;
var timer = setInterval(function() {
tries++;
if (tries > 300) clearInterval(timer);
var searchInput = $('input.gsc-input');
if (searchInput.length) {
searchInput.attr('placeholder', 'Search');
clearInterval(timer);
}
}, 100);
});
</script>
</body>
</html>