blob: fac514ae435a678c1f4c3a6a7f04405cfcbe5fd7 [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 | Apache Druid (incubating) Single-Server Quickstart</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="apache-druid-incubating-single-server-quickstart">Apache Druid (incubating) Single-Server Quickstart</h1>
<p>In this quickstart, we will download Druid and set it up on a single machine. The cluster will be ready to load data
after completing this initial setup.</p>
<p>Before beginning the quickstart, it is helpful to read the <a href="../design/index.html">general Druid overview</a> and the
<a href="../ingestion/index.html">ingestion overview</a>, as the tutorials will refer to concepts discussed on those pages.</p>
<h2 id="prerequisites">Prerequisites</h2>
<h3 id="software">Software</h3>
<p>You will need:</p>
<ul>
<li>Java 8 (8u92+)</li>
<li>Linux, Mac OS X, or other Unix-like OS (Windows is not supported)</li>
</ul>
<h3 id="hardware">Hardware</h3>
<p>Druid includes several example <a href="../operations/single-server.html">single-server configurations</a>, along with scripts to
start the Druid processes using these configurations.</p>
<p>If you&#39;re running on a small machine such as a laptop for a quick evaluation, the <code>micro-quickstart</code> configuration is
a good choice, sized for a 4CPU/16GB RAM environment.</p>
<p>If you plan to use the single-machine deployment for further evaluation beyond the tutorials, we recommend a larger
configuration than <code>micro-quickstart</code>.</p>
<h2 id="getting-started">Getting started</h2>
<p><a href="https://www.apache.org/dyn/closer.cgi?path=/incubator/druid/0.15.0-incubating/apache-druid-0.15.0-incubating-bin.tar.gz">Download</a>
the 0.15.0-incubating release.</p>
<p>Extract Druid by running the following commands in your terminal:</p>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span></span>tar -xzf apache-druid-0.15.0-incubating-bin.tar.gz
<span class="nb">cd</span> apache-druid-0.15.0-incubating
</code></pre></div>
<p>In the package, you should find:</p>
<ul>
<li><code>DISCLAIMER</code>, <code>LICENSE</code>, and <code>NOTICE</code> files</li>
<li><code>bin/*</code> - scripts useful for this quickstart</li>
<li><code>conf/*</code> - example configurations for single-server and clustered setup</li>
<li><code>extensions/*</code> - core Druid extensions</li>
<li><code>hadoop-dependencies/*</code> - Druid Hadoop dependencies</li>
<li><code>lib/*</code> - libraries and dependencies for core Druid</li>
<li><code>quickstart/*</code> - configuration files, sample data, and other files for the quickstart tutorials</li>
</ul>
<h2 id="download-zookeeper">Download Zookeeper</h2>
<p>Druid has a dependency on <a href="http://zookeeper.apache.org/">Apache ZooKeeper</a> for distributed coordination. You&#39;ll
need to download and run Zookeeper.</p>
<p>In the package root, run the following commands:</p>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span></span>curl https://archive.apache.org/dist/zookeeper/zookeeper-3.4.11/zookeeper-3.4.11.tar.gz -o zookeeper-3.4.11.tar.gz
tar -xzf zookeeper-3.4.11.tar.gz
mv zookeeper-3.4.11 zk
</code></pre></div>
<p>The startup scripts for the tutorial will expect the contents of the Zookeeper tarball to be located at <code>zk</code> under the
apache-druid-0.15.0-incubating package root.</p>
<h2 id="start-up-druid-services">Start up Druid services</h2>
<p>The following commands will assume that you are using the <code>micro-quickstart</code> single-machine configuration. If you are
using a different configuration, the <code>bin</code> directory has equivalent scripts for each configuration, such as
<code>bin/start-single-server-small</code>.</p>
<p>From the apache-druid-0.15.0-incubating package root, run the following command:</p>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span></span>./bin/start-micro-quickstart
</code></pre></div>
<p>This will bring up instances of Zookeeper and the Druid services, all running on the local machine, e.g.:</p>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span></span>$ ./bin/start-micro-quickstart
<span class="o">[</span>Fri May <span class="m">3</span> <span class="m">11</span>:40:50 <span class="m">2019</span><span class="o">]</span> Running command<span class="o">[</span>zk<span class="o">]</span>, logging to<span class="o">[</span>/apache-druid-0.15.0-incubating/var/sv/zk.log<span class="o">]</span>: bin/run-zk conf
<span class="o">[</span>Fri May <span class="m">3</span> <span class="m">11</span>:40:50 <span class="m">2019</span><span class="o">]</span> Running command<span class="o">[</span>coordinator-overlord<span class="o">]</span>, logging to<span class="o">[</span>/apache-druid-0.15.0-incubating/var/sv/coordinator-overlord.log<span class="o">]</span>: bin/run-druid coordinator-overlord conf/druid/single-server/micro-quickstart
<span class="o">[</span>Fri May <span class="m">3</span> <span class="m">11</span>:40:50 <span class="m">2019</span><span class="o">]</span> Running command<span class="o">[</span>broker<span class="o">]</span>, logging to<span class="o">[</span>/apache-druid-0.15.0-incubating/var/sv/broker.log<span class="o">]</span>: bin/run-druid broker conf/druid/single-server/micro-quickstart
<span class="o">[</span>Fri May <span class="m">3</span> <span class="m">11</span>:40:50 <span class="m">2019</span><span class="o">]</span> Running command<span class="o">[</span>router<span class="o">]</span>, logging to<span class="o">[</span>/apache-druid-0.15.0-incubating/var/sv/router.log<span class="o">]</span>: bin/run-druid router conf/druid/single-server/micro-quickstart
<span class="o">[</span>Fri May <span class="m">3</span> <span class="m">11</span>:40:50 <span class="m">2019</span><span class="o">]</span> Running command<span class="o">[</span>historical<span class="o">]</span>, logging to<span class="o">[</span>/apache-druid-0.15.0-incubating/var/sv/historical.log<span class="o">]</span>: bin/run-druid historical conf/druid/single-server/micro-quickstart
<span class="o">[</span>Fri May <span class="m">3</span> <span class="m">11</span>:40:50 <span class="m">2019</span><span class="o">]</span> Running command<span class="o">[</span>middleManager<span class="o">]</span>, logging to<span class="o">[</span>/apache-druid-0.15.0-incubating/var/sv/middleManager.log<span class="o">]</span>: bin/run-druid middleManager conf/druid/single-server/micro-quickstart
</code></pre></div>
<p>All persistent state such as the cluster metadata store and segments for the services will be kept in the <code>var</code> directory under the apache-druid-0.15.0-incubating package root. Logs for the services are located at <code>var/sv</code>.</p>
<p>Later on, if you&#39;d like to stop the services, CTRL-C to exit the <code>bin/start-micro-quickstart</code> script, which will terminate the Druid processes.</p>
<p>Once the cluster has started, you can navigate to <a href="http://localhost:8888">http://localhost:8888</a>.
The <a href="../development/router.html">Druid router process</a>, which serves the Druid console, resides at this address.</p>
<p><img src="../tutorials/img/tutorial-quickstart-01.png" alt="Druid console" title="Druid console"></p>
<p>It takes a few seconds for all the Druid processes to fully start up. If you open the console immediately after starting the services, you may see some errors that you can safely ignore.</p>
<h2 id="loading-data">Loading Data</h2>
<h3 id="tutorial-dataset">Tutorial Dataset</h3>
<p>For the following data loading tutorials, we have included a sample data file containing Wikipedia page edit events that occurred on 2015-09-12.</p>
<p>This sample data is located at <code>quickstart/tutorial/wikiticker-2015-09-12-sampled.json.gz</code> from the Druid package root.
The page edit events are stored as JSON objects in a text file.</p>
<p>The sample data has the following columns, and an example event is shown below:</p>
<ul>
<li>added</li>
<li>channel</li>
<li>cityName</li>
<li>comment</li>
<li>countryIsoCode</li>
<li>countryName</li>
<li>deleted</li>
<li>delta</li>
<li>isAnonymous</li>
<li>isMinor</li>
<li>isNew</li>
<li>isRobot</li>
<li>isUnpatrolled</li>
<li>metroCode</li>
<li>namespace</li>
<li>page</li>
<li>regionIsoCode</li>
<li>regionName</li>
<li>user</li>
</ul>
<div class="highlight"><pre><code class="language-json" data-lang="json"><span></span><span class="p">{</span>
<span class="nt">&quot;timestamp&quot;</span><span class="p">:</span><span class="s2">&quot;2015-09-12T20:03:45.018Z&quot;</span><span class="p">,</span>
<span class="nt">&quot;channel&quot;</span><span class="p">:</span><span class="s2">&quot;#en.wikipedia&quot;</span><span class="p">,</span>
<span class="nt">&quot;namespace&quot;</span><span class="p">:</span><span class="s2">&quot;Main&quot;</span><span class="p">,</span>
<span class="nt">&quot;page&quot;</span><span class="p">:</span><span class="s2">&quot;Spider-Man&#39;s powers and equipment&quot;</span><span class="p">,</span>
<span class="nt">&quot;user&quot;</span><span class="p">:</span><span class="s2">&quot;foobar&quot;</span><span class="p">,</span>
<span class="nt">&quot;comment&quot;</span><span class="p">:</span><span class="s2">&quot;/* Artificial web-shooters */&quot;</span><span class="p">,</span>
<span class="nt">&quot;cityName&quot;</span><span class="p">:</span><span class="s2">&quot;New York&quot;</span><span class="p">,</span>
<span class="nt">&quot;regionName&quot;</span><span class="p">:</span><span class="s2">&quot;New York&quot;</span><span class="p">,</span>
<span class="nt">&quot;regionIsoCode&quot;</span><span class="p">:</span><span class="s2">&quot;NY&quot;</span><span class="p">,</span>
<span class="nt">&quot;countryName&quot;</span><span class="p">:</span><span class="s2">&quot;United States&quot;</span><span class="p">,</span>
<span class="nt">&quot;countryIsoCode&quot;</span><span class="p">:</span><span class="s2">&quot;US&quot;</span><span class="p">,</span>
<span class="nt">&quot;isAnonymous&quot;</span><span class="p">:</span><span class="kc">false</span><span class="p">,</span>
<span class="nt">&quot;isNew&quot;</span><span class="p">:</span><span class="kc">false</span><span class="p">,</span>
<span class="nt">&quot;isMinor&quot;</span><span class="p">:</span><span class="kc">false</span><span class="p">,</span>
<span class="nt">&quot;isRobot&quot;</span><span class="p">:</span><span class="kc">false</span><span class="p">,</span>
<span class="nt">&quot;isUnpatrolled&quot;</span><span class="p">:</span><span class="kc">false</span><span class="p">,</span>
<span class="nt">&quot;added&quot;</span><span class="p">:</span><span class="mi">99</span><span class="p">,</span>
<span class="nt">&quot;delta&quot;</span><span class="p">:</span><span class="mi">99</span><span class="p">,</span>
<span class="nt">&quot;deleted&quot;</span><span class="p">:</span><span class="mi">0</span><span class="p">,</span>
<span class="p">}</span>
</code></pre></div>
<h3 id="data-loading-tutorials">Data loading tutorials</h3>
<p>The following tutorials demonstrate various methods of loading data into Druid, including both batch and streaming use cases.
All tutorials assume that you are using the <code>micro-quickstart</code> single-machine configuration mentioned above.</p>
<ul>
<li><a href="./tutorial-batch.html">Loading a file</a> - this tutorial demonstrates how to perform a batch file load, using Druid&#39;s native batch ingestion.</li>
<li><a href="./tutorial-kafka.html">Loading stream data from Apache Kafka</a> - this tutorial demonstrates how to load streaming data from a Kafka topic.</li>
<li><a href="./tutorial-batch-hadoop.html">Loading a file using Apache Hadoop</a> - this tutorial demonstrates how to perform a batch file load, using a remote Hadoop cluster.</li>
<li><a href="./tutorial-tranquility.html">Loading data using Tranquility</a> - this tutorial demonstrates how to load streaming data by pushing events to Druid using the Tranquility service.</li>
<li><a href="./tutorial-ingestion-spec.html">Writing your own ingestion spec</a> - this tutorial demonstrates how to write a new ingestion spec and use it to load data.</li>
</ul>
<h3 id="resetting-cluster-state">Resetting cluster state</h3>
<p>If you want a clean start after stopping the services, delete the <code>var</code> directory and run the <code>bin/start-micro-quickstart</code> script again.</p>
<p>Once every service has started, you are now ready to load data.</p>
<h4 id="resetting-kafka">Resetting Kafka</h4>
<p>If you completed <a href="./tutorial-kafka.html">Tutorial: Loading stream data from Kafka</a> and wish to reset the cluster state, you should additionally clear out any Kafka state.</p>
<p>Shut down the Kafka broker with CTRL-C before stopping Zookeeper and the Druid services, and then delete the Kafka log directory at <code>/tmp/kafka-logs</code>:</p>
<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span></span>rm -rf /tmp/kafka-logs
</code></pre></div>
</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.15.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>