blob: f6e90eed4a501fe5264b9688622426b67ba24067 [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 | Lookups</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.17.1/">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="lookups">Lookups</h1>
<div class="note caution">
Lookups are an <a href="../development/experimental.html">experimental</a> feature.
</div>
<p>Lookups are a concept in Apache Druid (incubating) where dimension values are (optionally) replaced with new values, allowing join-like
functionality. Applying lookups in Druid is similar to joining a dimension table in a data warehouse. See
<a href="../querying/dimensionspecs.html">dimension specs</a> for more information. For the purpose of these documents, a &quot;key&quot;
refers to a dimension value to match, and a &quot;value&quot; refers to its replacement. So if you wanted to map
<code>appid-12345</code> to <code>Super Mega Awesome App</code> then the key would be <code>appid-12345</code> and the value would be
<code>Super Mega Awesome App</code>.</p>
<p>It is worth noting that lookups support not just use cases where keys map one-to-one to unique values, such as country
code and country name, but also support use cases where multiple IDs map to the same value, e.g. multiple app-ids
mapping to a single account manager. When lookups are one-to-one, Druid is able to apply additional optimizations at
query time; see <a href="#query-execution">Query execution</a> below for more details.</p>
<p>Lookups do not have history. They always use the current data. This means that if the chief account manager for a
particular app-id changes, and you issue a query with a lookup to store the app-id to account manager relationship,
it will return the current account manager for that app-id REGARDLESS of the time range over which you query.</p>
<p>If you require data time range sensitive lookups, such a use case is not currently supported dynamically at query time,
and such data belongs in the raw denormalized data for use in Druid.</p>
<p>Very small lookups (count of keys on the order of a few dozen to a few hundred) can be passed at query time as a &quot;map&quot;
lookup as per <a href="../querying/dimensionspecs.html">dimension specs</a>.</p>
<p>Other lookup types are available as extensions, including:</p>
<ul>
<li>Globally cached lookups from local files, remote URIs, or JDBC through <a href="../development/extensions-core/lookups-cached-global.html">lookups-cached-global</a>.</li>
<li>Globally cached lookups from a Kafka topic through <a href="../development/extensions-core/kafka-extraction-namespace.html">kafka-extraction-namespace</a>.</li>
</ul>
<h2 id="query-execution">Query Execution</h2>
<p>When executing an aggregation query involving lookups, Druid can decide to apply lookups either while scanning and
aggregating rows, or to apply them after aggregation is complete. It is more efficient to apply lookups after
aggregation is complete, so Druid will do this if it can. Druid decides this by checking if the lookup is marked
as &quot;injective&quot; or not. In general, you should set this property for any lookup that is naturally one-to-one, to allow
Druid to run your queries as fast as possible.</p>
<p>Injective lookups should include <em>all</em> possible keys that may show up in your dataset, and should also map all keys to
<em>unique values</em>. This matters because non-injective lookups may map different keys to the same value, which must be
accounted for during aggregation, lest query results contain two result values that should have been aggregated into
one.</p>
<p>This lookup is injective (assuming it contains all possible keys from your data):</p>
<div class="highlight"><pre><code class="language-text" data-lang="text"><span></span>1 -&gt; Foo
2 -&gt; Bar
3 -&gt; Billy
</code></pre></div>
<p>But this one is not, since both &quot;2&quot; and &quot;3&quot; map to the same key:</p>
<div class="highlight"><pre><code class="language-text" data-lang="text"><span></span>1 -&gt; Foo
2 -&gt; Bar
3 -&gt; Bar
</code></pre></div>
<p>To tell Druid that your lookup is injective, you must specify <code>&quot;injective&quot; : true</code> in the lookup configuration. Druid
will not detect this automatically.</p>
<h2 id="dynamic-configuration">Dynamic Configuration</h2>
<div class="note caution">
Dynamic lookup configuration is an <a href="../development/experimental.html">experimental</a> feature. Static
configuration is no longer supported.
</div>
<p>The following documents the behavior of the cluster-wide config which is accessible through the Coordinator.
The configuration is propagated through the concept of &quot;tier&quot; of servers.
A &quot;tier&quot; is defined as a group of services which should receive a set of lookups.
For example, you might have all Historicals be part of <code>__default</code>, and Peons be part of individual tiers for the datasources they are tasked with.
The tiers for lookups are completely independent of Historical tiers.</p>
<p>These configs are accessed using JSON through the following URI template</p>
<div class="highlight"><pre><code class="language-text" data-lang="text"><span></span>http://&lt;COORDINATOR_IP&gt;:&lt;PORT&gt;/druid/coordinator/v1/lookups/config/{tier}/{id}
</code></pre></div>
<p>All URIs below are assumed to have <code>http://&lt;COORDINATOR_IP&gt;:&lt;PORT&gt;</code> prepended.</p>
<p>If you have NEVER configured lookups before, you MUST post an empty json object <code>{}</code> to <code>/druid/coordinator/v1/lookups/config</code> to initialize the configuration.</p>
<p>These endpoints will return one of the following results:</p>
<ul>
<li>404 if the resource is not found</li>
<li>400 if there is a problem in the formatting of the request</li>
<li>202 if the request was accepted asynchronously (<code>POST</code> and <code>DELETE</code>)</li>
<li>200 if the request succeeded (<code>GET</code> only)</li>
</ul>
<h2 id="configuration-propagation-behavior">Configuration propagation behavior</h2>
<p>The configuration is propagated to the query serving processes (Broker / Router / Peon / Historical) by the Coordinator.
The query serving processes have an internal API for managing lookups on the process and those are used by the Coordinator.
The Coordinator periodically checks if any of the processes need to load/drop lookups and updates them appropriately.</p>
<h1 id="api-for-configuring-lookups">API for configuring lookups</h1>
<h2 id="bulk-update">Bulk update</h2>
<p>Lookups can be updated in bulk by posting a JSON object to <code>/druid/coordinator/v1/lookups/config</code>. The format of the json object is as follows:</p>
<div class="highlight"><pre><code class="language-json" data-lang="json"><span></span><span class="p">{</span>
<span class="nt">&quot;&lt;tierName&gt;&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;&lt;lookupName&gt;&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;version&quot;</span><span class="p">:</span> <span class="s2">&quot;&lt;version&gt;&quot;</span><span class="p">,</span>
<span class="nt">&quot;lookupExtractorFactory&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;&lt;someExtractorFactoryType&gt;&quot;</span><span class="p">,</span>
<span class="nt">&quot;&lt;someExtractorField&gt;&quot;</span><span class="p">:</span> <span class="s2">&quot;&lt;someExtractorValue&gt;&quot;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre></div>
<p>Note that &quot;version&quot; is an arbitrary string assigned by the user, when making updates to existing lookup then user would need to specify a lexicographically higher version.</p>
<p>For example, a config might look something like:</p>
<div class="highlight"><pre><code class="language-json" data-lang="json"><span></span><span class="p">{</span>
<span class="nt">&quot;__default&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;country_code&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;version&quot;</span><span class="p">:</span> <span class="s2">&quot;v0&quot;</span><span class="p">,</span>
<span class="nt">&quot;lookupExtractorFactory&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;map&quot;</span><span class="p">,</span>
<span class="nt">&quot;map&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;77483&quot;</span><span class="p">:</span> <span class="s2">&quot;United States&quot;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">},</span>
<span class="nt">&quot;site_id&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;version&quot;</span><span class="p">:</span> <span class="s2">&quot;v0&quot;</span><span class="p">,</span>
<span class="nt">&quot;lookupExtractorFactory&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;cachedNamespace&quot;</span><span class="p">,</span>
<span class="nt">&quot;extractionNamespace&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;jdbc&quot;</span><span class="p">,</span>
<span class="nt">&quot;connectorConfig&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;createTables&quot;</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
<span class="nt">&quot;connectURI&quot;</span><span class="p">:</span> <span class="s2">&quot;jdbc:mysql:\/\/localhost:3306\/druid&quot;</span><span class="p">,</span>
<span class="nt">&quot;user&quot;</span><span class="p">:</span> <span class="s2">&quot;druid&quot;</span><span class="p">,</span>
<span class="nt">&quot;password&quot;</span><span class="p">:</span> <span class="s2">&quot;diurd&quot;</span>
<span class="p">},</span>
<span class="nt">&quot;table&quot;</span><span class="p">:</span> <span class="s2">&quot;lookupTable&quot;</span><span class="p">,</span>
<span class="nt">&quot;keyColumn&quot;</span><span class="p">:</span> <span class="s2">&quot;country_id&quot;</span><span class="p">,</span>
<span class="nt">&quot;valueColumn&quot;</span><span class="p">:</span> <span class="s2">&quot;country_name&quot;</span><span class="p">,</span>
<span class="nt">&quot;tsColumn&quot;</span><span class="p">:</span> <span class="s2">&quot;timeColumn&quot;</span>
<span class="p">},</span>
<span class="nt">&quot;firstCacheTimeout&quot;</span><span class="p">:</span> <span class="mi">120000</span><span class="p">,</span>
<span class="nt">&quot;injective&quot;</span><span class="p">:</span> <span class="kc">true</span>
<span class="p">}</span>
<span class="p">},</span>
<span class="nt">&quot;site_id_customer1&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;version&quot;</span><span class="p">:</span> <span class="s2">&quot;v0&quot;</span><span class="p">,</span>
<span class="nt">&quot;lookupExtractorFactory&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;map&quot;</span><span class="p">,</span>
<span class="nt">&quot;map&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;847632&quot;</span><span class="p">:</span> <span class="s2">&quot;Internal Use Only&quot;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">},</span>
<span class="nt">&quot;site_id_customer2&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;version&quot;</span><span class="p">:</span> <span class="s2">&quot;v0&quot;</span><span class="p">,</span>
<span class="nt">&quot;lookupExtractorFactory&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;map&quot;</span><span class="p">,</span>
<span class="nt">&quot;map&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;AHF77&quot;</span><span class="p">:</span> <span class="s2">&quot;Home&quot;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">},</span>
<span class="nt">&quot;realtime_customer1&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;country_code&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;version&quot;</span><span class="p">:</span> <span class="s2">&quot;v0&quot;</span><span class="p">,</span>
<span class="nt">&quot;lookupExtractorFactory&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;map&quot;</span><span class="p">,</span>
<span class="nt">&quot;map&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;77483&quot;</span><span class="p">:</span> <span class="s2">&quot;United States&quot;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">},</span>
<span class="nt">&quot;site_id_customer1&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;version&quot;</span><span class="p">:</span> <span class="s2">&quot;v0&quot;</span><span class="p">,</span>
<span class="nt">&quot;lookupExtractorFactory&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;map&quot;</span><span class="p">,</span>
<span class="nt">&quot;map&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;847632&quot;</span><span class="p">:</span> <span class="s2">&quot;Internal Use Only&quot;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">},</span>
<span class="nt">&quot;realtime_customer2&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;country_code&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;version&quot;</span><span class="p">:</span> <span class="s2">&quot;v0&quot;</span><span class="p">,</span>
<span class="nt">&quot;lookupExtractorFactory&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;map&quot;</span><span class="p">,</span>
<span class="nt">&quot;map&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;77483&quot;</span><span class="p">:</span> <span class="s2">&quot;United States&quot;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">},</span>
<span class="nt">&quot;site_id_customer2&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;version&quot;</span><span class="p">:</span> <span class="s2">&quot;v0&quot;</span><span class="p">,</span>
<span class="nt">&quot;lookupExtractorFactory&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;map&quot;</span><span class="p">,</span>
<span class="nt">&quot;map&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;AHF77&quot;</span><span class="p">:</span> <span class="s2">&quot;Home&quot;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre></div>
<p>All entries in the map will UPDATE existing entries. No entries will be deleted.</p>
<h2 id="update-lookup">Update Lookup</h2>
<p>A <code>POST</code> to a particular lookup extractor factory via <code>/druid/coordinator/v1/lookups/config/{tier}/{id}</code> will update that specific extractor factory.</p>
<p>For example, a post to <code>/druid/coordinator/v1/lookups/config/realtime_customer1/site_id_customer1</code> might contain the following:</p>
<div class="highlight"><pre><code class="language-json" data-lang="json"><span></span><span class="p">{</span>
<span class="nt">&quot;version&quot;</span><span class="p">:</span> <span class="s2">&quot;v1&quot;</span><span class="p">,</span>
<span class="nt">&quot;lookupExtractorFactory&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;map&quot;</span><span class="p">,</span>
<span class="nt">&quot;map&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;847632&quot;</span><span class="p">:</span> <span class="s2">&quot;Internal Use Only&quot;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre></div>
<p>This will replace the <code>site_id_customer1</code> lookup in the <code>realtime_customer1</code> with the definition above.</p>
<h2 id="get-all-lookups">Get All Lookups</h2>
<p>A <code>GET</code> to <code>/druid/coordinator/v1/lookups/config/all</code> will return all known lookup specs for all tiers.</p>
<h2 id="get-lookup">Get Lookup</h2>
<p>A <code>GET</code> to a particular lookup extractor factory is accomplished via <code>/druid/coordinator/v1/lookups/config/{tier}/{id}</code></p>
<p>Using the prior example, a <code>GET</code> to <code>/druid/coordinator/v1/lookups/config/realtime_customer2/site_id_customer2</code> should return</p>
<div class="highlight"><pre><code class="language-json" data-lang="json"><span></span><span class="p">{</span>
<span class="nt">&quot;version&quot;</span><span class="p">:</span> <span class="s2">&quot;v1&quot;</span><span class="p">,</span>
<span class="nt">&quot;lookupExtractorFactory&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;map&quot;</span><span class="p">,</span>
<span class="nt">&quot;map&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;AHF77&quot;</span><span class="p">:</span> <span class="s2">&quot;Home&quot;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre></div>
<h2 id="delete-lookup">Delete Lookup</h2>
<p>A <code>DELETE</code> to <code>/druid/coordinator/v1/lookups/config/{tier}/{id}</code> will remove that lookup from the cluster.</p>
<h2 id="list-tier-names">List tier names</h2>
<p>A <code>GET</code> to <code>/druid/coordinator/v1/lookups/config</code> will return a list of known tier names in the dynamic configuration.
To discover a list of tiers currently active in the cluster <strong>instead of</strong> ones known in the dynamic configuration, the parameter <code>discover=true</code> can be added as per <code>/druid/coordinator/v1/lookups?discover=true</code>.</p>
<h2 id="list-lookup-names">List lookup names</h2>
<p>A <code>GET</code> to <code>/druid/coordinator/v1/lookups/config/{tier}</code> will return a list of known lookup names for that tier.</p>
<h1 id="additional-api-related-to-status-of-configured-lookups">Additional API related to status of configured lookups</h1>
<p>These end points can be used to get the propagation status of configured lookups to processes using lookups such as Historicals.</p>
<h2 id="list-load-status-of-all-lookups">List load status of all lookups</h2>
<p><code>GET /druid/coordinator/v1/lookups/status</code> with optional query parameter <code>detailed</code>.</p>
<h2 id="list-load-status-of-lookups-in-a-tier">List load status of lookups in a tier</h2>
<p><code>GET /druid/coordinator/v1/lookups/status/{tier}</code> with optional query parameter <code>detailed</code>.</p>
<h2 id="list-load-status-of-single-lookup">List load status of single lookup</h2>
<p><code>GET /druid/coordinator/v1/lookups/status/{tier}/{lookup}</code> with optional query parameter <code>detailed</code>.</p>
<h2 id="list-lookup-state-of-all-processes">List lookup state of all processes</h2>
<p><code>GET /druid/coordinator/v1/lookups/nodeStatus</code> with optional query parameter <code>discover</code> to discover tiers from zookeeper or configured lookup tiers are listed.</p>
<h2 id="list-lookup-state-of-processes-in-a-tier">List lookup state of processes in a tier</h2>
<p><code>GET /druid/coordinator/v1/lookups/nodeStatus/{tier}</code></p>
<h2 id="list-lookup-state-of-single-process">List lookup state of single process</h2>
<p><code>GET /druid/coordinator/v1/lookups/nodeStatus/{tier}/{host:port}</code></p>
<h1 id="internal-api">Internal API</h1>
<p>The Peon, Router, Broker, and Historical processes all have the ability to consume lookup configuration.
There is an internal API these processes use to list/load/drop their lookups starting at <code>/druid/listen/v1/lookups</code>.
These follow the same convention for return values as the cluster wide dynamic configuration. Following endpoints
can be used for debugging purposes but not otherwise.</p>
<h2 id="get-lookups">Get Lookups</h2>
<p>A <code>GET</code> to the process at <code>/druid/listen/v1/lookups</code> will return a json map of all the lookups currently active on the process.
The return value will be a json map of the lookups to their extractor factories.</p>
<div class="highlight"><pre><code class="language-json" data-lang="json"><span></span><span class="p">{</span>
<span class="nt">&quot;site_id_customer2&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;version&quot;</span><span class="p">:</span> <span class="s2">&quot;v1&quot;</span><span class="p">,</span>
<span class="nt">&quot;lookupExtractorFactory&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;map&quot;</span><span class="p">,</span>
<span class="nt">&quot;map&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;AHF77&quot;</span><span class="p">:</span> <span class="s2">&quot;Home&quot;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre></div>
<h2 id="get-lookup">Get Lookup</h2>
<p>A <code>GET</code> to the process at <code>/druid/listen/v1/lookups/some_lookup_name</code> will return the LookupExtractorFactory for the lookup identified by <code>some_lookup_name</code>.
The return value will be the json representation of the factory.</p>
<div class="highlight"><pre><code class="language-json" data-lang="json"><span></span><span class="p">{</span>
<span class="nt">&quot;version&quot;</span><span class="p">:</span> <span class="s2">&quot;v1&quot;</span><span class="p">,</span>
<span class="nt">&quot;lookupExtractorFactory&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;map&quot;</span><span class="p">,</span>
<span class="nt">&quot;map&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;AHF77&quot;</span><span class="p">:</span> <span class="s2">&quot;Home&quot;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre></div>
<h1 id="configuration">Configuration</h1>
<p>See <a href="../configuration/index.html#lookups-dynamic-configuration">Lookups Dynamic Configuration</a> for Coordinator configuration.</p>
<p>To configure a Broker / Router / Historical / Peon to announce itself as part of a lookup tier, use the <code>druid.zk.paths.lookupTier</code> property.</p>
<table><thead>
<tr>
<th>Property</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead><tbody>
<tr>
<td><code>druid.lookup.lookupTier</code></td>
<td>The tier for <strong>lookups</strong> for this process. This is independent of other tiers.</td>
<td><code>__default</code></td>
</tr>
<tr>
<td><code>druid.lookup.lookupTierIsDatasource</code></td>
<td>For some things like indexing service tasks, the datasource is passed in the runtime properties of a task. This option fetches the tierName from the same value as the datasource for the task. It is suggested to only use this as Peon options for the indexing service, if at all. If true, <code>druid.lookup.lookupTier</code> MUST NOT be specified</td>
<td><code>&quot;false&quot;</code></td>
</tr>
</tbody></table>
<p>To configure the behavior of the dynamic configuration manager, use the following properties on the Coordinator:</p>
<table><thead>
<tr>
<th>Property</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead><tbody>
<tr>
<td><code>druid.manager.lookups.hostTimeout</code></td>
<td>Timeout (in ms) PER HOST for processing request</td>
<td><code>2000</code>(2 seconds)</td>
</tr>
<tr>
<td><code>druid.manager.lookups.allHostTimeout</code></td>
<td>Timeout (in ms) to finish lookup management on all the processes.</td>
<td><code>900000</code>(15 mins)</td>
</tr>
<tr>
<td><code>druid.manager.lookups.period</code></td>
<td>How long to pause between management cycles</td>
<td><code>120000</code>(2 mins)</td>
</tr>
<tr>
<td><code>druid.manager.lookups.threadPoolSize</code></td>
<td>Number of service processes that can be managed concurrently</td>
<td><code>10</code></td>
</tr>
</tbody></table>
<h2 id="saving-configuration-across-restarts">Saving configuration across restarts</h2>
<p>It is possible to save the configuration across restarts such that a process will not have to wait for Coordinator action to re-populate its lookups. To do this the following property is set:</p>
<table><thead>
<tr>
<th>Property</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead><tbody>
<tr>
<td><code>druid.lookup.snapshotWorkingDir</code></td>
<td>Working path used to store snapshot of current lookup configuration, leaving this property null will disable snapshot/bootstrap utility</td>
<td>null</td>
</tr>
<tr>
<td><code>druid.lookup.enableLookupSyncOnStartup</code></td>
<td>Enable the lookup synchronization process with Coordinator on startup. The queryable processes will fetch and load the lookups from the Coordinator instead of waiting for the Coordinator to load the lookups for them. Users may opt to disable this option if there are no lookups configured in the cluster.</td>
<td>true</td>
</tr>
<tr>
<td><code>druid.lookup.numLookupLoadingThreads</code></td>
<td>Number of threads for loading the lookups in parallel on startup. This thread pool is destroyed once startup is done. It is not kept during the lifetime of the JVM</td>
<td>Available Processors / 2</td>
</tr>
<tr>
<td><code>druid.lookup.coordinatorFetchRetries</code></td>
<td>How many times to retry to fetch the lookup bean list from Coordinator, during the sync on startup.</td>
<td>3</td>
</tr>
<tr>
<td><code>druid.lookup.lookupStartRetries</code></td>
<td>How many times to retry to start each lookup, either during the sync on startup, or during the runtime.</td>
<td>3</td>
</tr>
<tr>
<td><code>druid.lookup.coordinatorRetryDelay</code></td>
<td>How long to delay (in millis) between retries to fetch lookup list from the Coordinator during the sync on startup.</td>
<td>60_000</td>
</tr>
</tbody></table>
<h2 id="introspect-a-lookup">Introspect a Lookup</h2>
<p>The Broker provides an API for lookup introspection if the lookup type implements a <code>LookupIntrospectHandler</code>. </p>
<p>A <code>GET</code> request to <code>/druid/v1/lookups/introspect/{lookupId}</code> will return the map of complete values. </p>
<p>ex: <code>GET /druid/v1/lookups/introspect/nato-phonetic</code>
```
{
&quot;A&quot;: &quot;Alfa&quot;,
&quot;B&quot;: &quot;Bravo&quot;,
&quot;C&quot;: &quot;Charlie&quot;,
...
&quot;Y&quot;: &quot;Yankee&quot;,
&quot;Z&quot;: &quot;Zulu&quot;,
&quot;-&quot;: &quot;Dash&quot;
}</p>
<div class="highlight"><pre><code class="language-text" data-lang="text"><span></span>The list of keys can be retrieved via `GET` to `/druid/v1/lookups/introspect/{lookupId}/keys&quot;`
ex: `GET /druid/v1/lookups/introspect/nato-phonetic/keys`
</code></pre></div>
<p>[
&quot;A&quot;,
&quot;B&quot;,
&quot;C&quot;,
...
&quot;Y&quot;,
&quot;Z&quot;,
&quot;-&quot;
]
```</p>
<p>A <code>GET</code> request to <code>/druid/v1/lookups/introspect/{lookupId}/values&quot;</code> will return the list of values.</p>
<p>ex: <code>GET /druid/v1/lookups/introspect/nato-phonetic/values</code>
<code>
[
&quot;Alfa&quot;,
&quot;Bravo&quot;,
&quot;Charlie&quot;,
...
&quot;Yankee&quot;,
&quot;Zulu&quot;,
&quot;Dash&quot;
]
</code></p>
<h2 id="druid-version-0-10-0-to-0-10-1-upgrade-downgrade">Druid version 0.10.0 to 0.10.1 upgrade/downgrade</h2>
<p>Overall druid cluster lookups configuration is persisted in metadata store and also individual lookup processes optionally persist a snapshot of loaded lookups on disk.
If upgrading from druid version 0.10.0 to 0.10.1, then migration for all persisted metadata is handled automatically.
If downgrading from 0.10.1 to 0.9.0 then lookups updates done via Coordinator while 0.10.1 was running, would be lost.</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.0-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>