| <!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 | 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.22.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="druid-quickstart">Druid 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> |
| |
| <p>You will need:</p> |
| |
| <ul> |
| <li>Java 8</li> |
| <li>Linux, Mac OS X, or other Unix-like OS (Windows is not supported)</li> |
| <li>8G of RAM</li> |
| <li>2 vCPUs</li> |
| </ul> |
| |
| <p>On Mac OS X, you can use <a href="http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html">Oracle's JDK |
| 8</a> to install |
| Java.</p> |
| |
| <p>On Linux, your OS package manager should be able to help for Java. If your Ubuntu- |
| based OS does not have a recent enough version of Java, WebUpd8 offers <a href="http://www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html">packages for those |
| OSes</a>.</p> |
| |
| <h2 id="getting-started">Getting started</h2> |
| |
| <p><a href="https://www.apache.org/dyn/closer.cgi?path=/incubator/druid/0.13.0-incubating/apache-druid-0.13.0-incubating-bin.tar.gz">Download</a> |
| the 0.13.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.13.0-incubating-bin.tar.gz |
| <span class="nb">cd</span> apache-druid-0.13.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> - template configurations for a 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'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.13.0-incubating package root.</p> |
| |
| <h2 id="start-up-druid-services">Start up Druid services</h2> |
| |
| <p>From the apache-druid-0.13.0-incubating package root, run the following command:</p> |
| <div class="highlight"><pre><code class="language-bash" data-lang="bash"><span></span>bin/supervise -c quickstart/tutorial/conf/tutorial-cluster.conf |
| </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/supervise -c quickstart/tutorial/conf/tutorial-cluster.conf |
| <span class="o">[</span>Thu Jul <span class="m">26</span> <span class="m">12</span>:16:23 <span class="m">2018</span><span class="o">]</span> Running command<span class="o">[</span>zk<span class="o">]</span>, logging to<span class="o">[</span>/stage/apache-druid-0.13.0-incubating/var/sv/zk.log<span class="o">]</span>: bin/run-zk quickstart/tutorial/conf |
| <span class="o">[</span>Thu Jul <span class="m">26</span> <span class="m">12</span>:16:23 <span class="m">2018</span><span class="o">]</span> Running command<span class="o">[</span>coordinator<span class="o">]</span>, logging to<span class="o">[</span>/stage/apache-druid-0.13.0-incubating/var/sv/coordinator.log<span class="o">]</span>: bin/run-druid coordinator quickstart/tutorial/conf |
| <span class="o">[</span>Thu Jul <span class="m">26</span> <span class="m">12</span>:16:23 <span class="m">2018</span><span class="o">]</span> Running command<span class="o">[</span>broker<span class="o">]</span>, logging to<span class="o">[</span>//stage/apache-druid-0.13.0-incubating/var/sv/broker.log<span class="o">]</span>: bin/run-druid broker quickstart/tutorial/conf |
| <span class="o">[</span>Thu Jul <span class="m">26</span> <span class="m">12</span>:16:23 <span class="m">2018</span><span class="o">]</span> Running command<span class="o">[</span>historical<span class="o">]</span>, logging to<span class="o">[</span>/stage/apache-druid-0.13.0-incubating/var/sv/historical.log<span class="o">]</span>: bin/run-druid historical quickstart/tutorial/conf |
| <span class="o">[</span>Thu Jul <span class="m">26</span> <span class="m">12</span>:16:23 <span class="m">2018</span><span class="o">]</span> Running command<span class="o">[</span>overlord<span class="o">]</span>, logging to<span class="o">[</span>/stage/apache-druid-0.13.0-incubating/var/sv/overlord.log<span class="o">]</span>: bin/run-druid overlord quickstart/tutorial/conf |
| <span class="o">[</span>Thu Jul <span class="m">26</span> <span class="m">12</span>:16:23 <span class="m">2018</span><span class="o">]</span> Running command<span class="o">[</span>middleManager<span class="o">]</span>, logging to<span class="o">[</span>/stage/apache-druid-0.13.0-incubating/var/sv/middleManager.log<span class="o">]</span>: bin/run-druid middleManager quickstart/tutorial/conf |
| </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.13.0-incubating package root. Logs for the services are located at <code>var/sv</code>.</p> |
| |
| <p>Later on, if you'd like to stop the services, CTRL-C to exit the <code>bin/supervise</code> script, which will terminate the Druid processes.</p> |
| |
| <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/supervise</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> |
| <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">"timestamp"</span><span class="p">:</span><span class="s2">"2015-09-12T20:03:45.018Z"</span><span class="p">,</span> |
| <span class="nt">"channel"</span><span class="p">:</span><span class="s2">"#en.wikipedia"</span><span class="p">,</span> |
| <span class="nt">"namespace"</span><span class="p">:</span><span class="s2">"Main"</span><span class="p">,</span> |
| <span class="nt">"page"</span><span class="p">:</span><span class="s2">"Spider-Man's powers and equipment"</span><span class="p">,</span> |
| <span class="nt">"user"</span><span class="p">:</span><span class="s2">"foobar"</span><span class="p">,</span> |
| <span class="nt">"comment"</span><span class="p">:</span><span class="s2">"/* Artificial web-shooters */"</span><span class="p">,</span> |
| <span class="nt">"cityName"</span><span class="p">:</span><span class="s2">"New York"</span><span class="p">,</span> |
| <span class="nt">"regionName"</span><span class="p">:</span><span class="s2">"New York"</span><span class="p">,</span> |
| <span class="nt">"regionIsoCode"</span><span class="p">:</span><span class="s2">"NY"</span><span class="p">,</span> |
| <span class="nt">"countryName"</span><span class="p">:</span><span class="s2">"United States"</span><span class="p">,</span> |
| <span class="nt">"countryIsoCode"</span><span class="p">:</span><span class="s2">"US"</span><span class="p">,</span> |
| <span class="nt">"isAnonymous"</span><span class="p">:</span><span class="kc">false</span><span class="p">,</span> |
| <span class="nt">"isNew"</span><span class="p">:</span><span class="kc">false</span><span class="p">,</span> |
| <span class="nt">"isMinor"</span><span class="p">:</span><span class="kc">false</span><span class="p">,</span> |
| <span class="nt">"isRobot"</span><span class="p">:</span><span class="kc">false</span><span class="p">,</span> |
| <span class="nt">"isUnpatrolled"</span><span class="p">:</span><span class="kc">false</span><span class="p">,</span> |
| <span class="nt">"added"</span><span class="p">:</span><span class="mi">99</span><span class="p">,</span> |
| <span class="nt">"delta"</span><span class="p">:</span><span class="mi">99</span><span class="p">,</span> |
| <span class="nt">"deleted"</span><span class="p">:</span><span class="mi">0</span><span class="p">,</span> |
| <span class="p">}</span> |
| </code></pre></div> |
| <p>The following tutorials demonstrate various methods of loading data into Druid, including both batch and streaming use cases.</p> |
| |
| <h3 id="tutorial-loading-a-file"><a href="./tutorial-batch.html">Tutorial: Loading a file</a></h3> |
| |
| <p>This tutorial demonstrates how to perform a batch file load, using Druid's native batch ingestion.</p> |
| |
| <h3 id="tutorial-loading-stream-data-from-kafka"><a href="./tutorial-kafka.html">Tutorial: Loading stream data from Kafka</a></h3> |
| |
| <p>This tutorial demonstrates how to load streaming data from a Kafka topic.</p> |
| |
| <h3 id="tutorial-loading-a-file-using-hadoop"><a href="./tutorial-batch-hadoop.html">Tutorial: Loading a file using Hadoop</a></h3> |
| |
| <p>This tutorial demonstrates how to perform a batch file load, using a remote Hadoop cluster.</p> |
| |
| <h3 id="tutorial-loading-data-using-tranquility"><a href="./tutorial-tranquility.html">Tutorial: Loading data using Tranquility</a></h3> |
| |
| <p>This tutorial demonstrates how to load streaming data by pushing events to Druid using the Tranquility service.</p> |
| |
| <h3 id="tutorial-writing-your-own-ingestion-spec"><a href="./tutorial-ingestion-spec.html">Tutorial: Writing your own ingestion spec</a></h3> |
| |
| <p>This tutorial demonstrates how to write a new ingestion spec and use it to load data.</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> ·  |
| <a href="/use-cases">Use Cases</a> ·  |
| <a href="/druid-powered">Powered by Druid</a> ·  |
| <a href="/docs/latest/">Docs</a> ·  |
| <a href="/community/">Community</a> ·  |
| <a href="/downloads.html">Download</a> ·  |
| <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> ·  |
| <a title="Follow Druid" href="https://twitter.com/druidio" target="_blank"><span class="fab fa-twitter"></span></a> ·  |
| <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.13.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> |