blob: 804f2a978e1377940b74b114ad30e96e27bee5a9 [file] [log] [blame]
Ian Maxon444ca1b2017-08-25 11:41:41 -07001<!DOCTYPE html>
2<!--
Ian Maxonf9dfc032017-09-14 21:37:24 +02003 | Generated by Apache Maven Doxia at 2017-09-14
Ian Maxon444ca1b2017-08-25 11:41:41 -07004 | Rendered using Apache Maven Fluido Skin 1.3.0
5-->
6<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7 <head>
8 <meta charset="UTF-8" />
9 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
Ian Maxonf9dfc032017-09-14 21:37:24 +020010 <meta name="Date-Revision-yyyymmdd" content="20170914" />
Ian Maxon444ca1b2017-08-25 11:41:41 -070011 <meta http-equiv="Content-Language" content="en" />
12 <title>AsterixDB &#x2013; Introduction</title>
13 <link rel="stylesheet" href="./css/apache-maven-fluido-1.3.0.min.css" />
14 <link rel="stylesheet" href="./css/site.css" />
15 <link rel="stylesheet" href="./css/print.css" media="print" />
16
17
18 <script type="text/javascript" src="./js/apache-maven-fluido-1.3.0.min.js"></script>
19
20
21
Ian Maxon444ca1b2017-08-25 11:41:41 -070022
Ian Maxon444ca1b2017-08-25 11:41:41 -070023
24 </head>
25 <body class="topBarDisabled">
26
27
28
29
30 <div class="container-fluid">
31 <div id="banner">
32 <div class="pull-left">
33 <a href="./" id="bannerLeft">
34 <img src="images/asterixlogo.png" alt="AsterixDB"/>
35 </a>
36 </div>
37 <div class="pull-right"> </div>
38 <div class="clear"><hr/></div>
39 </div>
40
41 <div id="breadcrumbs">
42 <ul class="breadcrumb">
43
44
Ian Maxonf9dfc032017-09-14 21:37:24 +020045 <li id="publishDate">Last Published: 2017-09-14</li>
Ian Maxon444ca1b2017-08-25 11:41:41 -070046
47
48
Ian Maxonf9dfc032017-09-14 21:37:24 +020049 <li id="projectVersion" class="pull-right">Version: 0.9.2</li>
Ian Maxon444ca1b2017-08-25 11:41:41 -070050
51 <li class="divider pull-right">|</li>
52
53 <li class="pull-right"> <a href="index.html" title="Documentation Home">
54 Documentation Home</a>
55 </li>
56
57 </ul>
58 </div>
59
60
61 <div class="row-fluid">
62 <div id="leftColumn" class="span3">
63 <div class="well sidebar-nav">
64
65
66 <ul class="nav nav-list">
67 <li class="nav-header">Get Started - Installation</li>
68
69 <li>
70
71 <a href="ncservice.html" title="Option 1: using NCService">
72 <i class="none"></i>
73 Option 1: using NCService</a>
74 </li>
75
76 <li>
77
78 <a href="ansible.html" title="Option 2: using Ansible">
79 <i class="none"></i>
80 Option 2: using Ansible</a>
81 </li>
82
83 <li>
84
85 <a href="aws.html" title="Option 3: using Amazon Web Services">
86 <i class="none"></i>
87 Option 3: using Amazon Web Services</a>
88 </li>
89
90 <li>
91
92 <a href="yarn.html" title="Option 4: using YARN">
93 <i class="none"></i>
94 Option 4: using YARN</a>
95 </li>
96
97 <li class="active">
98
99 <a href="#"><i class="none"></i>Option 5: using Managix (deprecated)</a>
100 </li>
101 <li class="nav-header">AsterixDB Primer</li>
102
103 <li>
104
105 <a href="sqlpp/primer-sqlpp.html" title="Option 1: using SQL++">
106 <i class="none"></i>
107 Option 1: using SQL++</a>
108 </li>
109
110 <li>
111
112 <a href="aql/primer.html" title="Option 2: using AQL">
113 <i class="none"></i>
114 Option 2: using AQL</a>
115 </li>
116 <li class="nav-header">Data Model</li>
117
118 <li>
119
120 <a href="datamodel.html" title="The Asterix Data Model">
121 <i class="none"></i>
122 The Asterix Data Model</a>
123 </li>
124 <li class="nav-header">Queries - SQL++</li>
125
126 <li>
127
128 <a href="sqlpp/manual.html" title="The SQL++ Query Language">
129 <i class="none"></i>
130 The SQL++ Query Language</a>
131 </li>
132
133 <li>
134
135 <a href="sqlpp/builtins.html" title="Builtin Functions">
136 <i class="none"></i>
137 Builtin Functions</a>
138 </li>
139 <li class="nav-header">Queries - AQL</li>
140
141 <li>
142
143 <a href="aql/manual.html" title="The Asterix Query Language (AQL)">
144 <i class="none"></i>
145 The Asterix Query Language (AQL)</a>
146 </li>
147
148 <li>
149
150 <a href="aql/builtins.html" title="Builtin Functions">
151 <i class="none"></i>
152 Builtin Functions</a>
153 </li>
154 <li class="nav-header">API/SDK</li>
155
156 <li>
157
158 <a href="api.html" title="HTTP API">
159 <i class="none"></i>
160 HTTP API</a>
161 </li>
162
163 <li>
164
165 <a href="csv.html" title="CSV Output">
166 <i class="none"></i>
167 CSV Output</a>
168 </li>
169 <li class="nav-header">Advanced Features</li>
170
171 <li>
172
173 <a href="aql/fulltext.html" title="Support of Full-text Queries">
174 <i class="none"></i>
175 Support of Full-text Queries</a>
176 </li>
177
178 <li>
179
180 <a href="aql/externaldata.html" title="Accessing External Data">
181 <i class="none"></i>
182 Accessing External Data</a>
183 </li>
184
185 <li>
186
187 <a href="feeds/tutorial.html" title="Support for Data Ingestion">
188 <i class="none"></i>
189 Support for Data Ingestion</a>
190 </li>
191
192 <li>
193
194 <a href="udf.html" title="User Defined Functions">
195 <i class="none"></i>
196 User Defined Functions</a>
197 </li>
198
199 <li>
200
201 <a href="aql/filters.html" title="Filter-Based LSM Index Acceleration">
202 <i class="none"></i>
203 Filter-Based LSM Index Acceleration</a>
204 </li>
205
206 <li>
207
208 <a href="aql/similarity.html" title="Support of Similarity Queries">
209 <i class="none"></i>
210 Support of Similarity Queries</a>
211 </li>
212 </ul>
213
214
215
216 <hr class="divider" />
217
218 <div id="poweredBy">
219 <div class="clear"></div>
220 <div class="clear"></div>
221 <div class="clear"></div>
222 <a href="./" title="AsterixDB" class="builtBy">
223 <img class="builtBy" alt="AsterixDB" src="images/asterixlogo.png" />
224 </a>
225 </div>
226 </div>
227 </div>
228
229
230 <div id="bodyColumn" class="span9" >
231
232 <!-- ! Licensed to the Apache Software Foundation (ASF) under one
233 ! or more contributor license agreements. See the NOTICE file
234 ! distributed with this work for additional information
235 ! regarding copyright ownership. The ASF licenses this file
236 ! to you under the Apache License, Version 2.0 (the
237 ! "License"); you may not use this file except in compliance
238 ! with the License. You may obtain a copy of the License at
239 !
240 ! http://www.apache.org/licenses/LICENSE-2.0
241 !
242 ! Unless required by applicable law or agreed to in writing,
243 ! software distributed under the License is distributed on an
244 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
245 ! KIND, either express or implied. See the License for the
246 ! specific language governing permissions and limitations
247 ! under the License.
248 ! --><h1>Introduction</h1>
249<div class="section">
250<h2><a name="Table_of_Contents"></a><a name="toc" id="toc">Table of Contents</a></h2>
251
252<ul>
253
254<li><a href="#PrerequisitesForInstallingAsterixDB">Prerequisites for Installing AsterixDB</a></li>
255
256<li><a href="#Section1SingleMachineAsterixDBInstallation">Section 1: Single-Machine AsterixDB installation</a></li>
257
258<li><a href="#Section2SingleMachineAsterixDBInstallationAdvanced">Section 2: Single-Machine AsterixDB installation (Advanced)</a></li>
259
260<li><a href="#Section3InstallingAsterixDBOnAClusterOfMultipleMachines">Section 3: Installing AsterixDB on a Cluster of Multiple Machines</a></li>
261
262<li><a href="#Section4ManagingTheLifecycleOfAnAsterixDBInstance">Section 4: Managing the Lifecycle of an AsterixDB Instance</a></li>
263
264<li><a href="#Section5FAQ">Section 5: Frequently Asked Questions</a></li>
265</ul>
266<p>This is a quickstart guide for getting AsterixDB running in a distributed environment. This guide also introduces the AsterixDB installer (nicknamed <i><i>Managix</i></i>) and describes how it can be used to create and manage an AsterixDB instance. By following the simple steps described in this guide, you will get a running instance of AsterixDB. You shall be able to use AsterixDB from its Web interface and manage its lifecycle using Managix. This document assumes that you are running some version of <i><i>Linux</i></i> or <i><i>MacOS X</i></i>.</p></div>
267<div class="section">
268<h2><a name="Prerequisites_for_Installing_AsterixDB_Back_to_TOC"></a><a name="PrerequisitesForInstallingAsterixDB" id="PrerequisitesForInstallingAsterixDB">Prerequisites for Installing AsterixDB</a> <font size="4"><a href="#toc">[Back to TOC]</a></font></h2>
269<p>Prerequisite:</p>
270
271<ul>
272
273<li><a class="externalLink" href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">JDK&gt;=8</a>.</li>
274</ul>
275<p>To know the version of Java installed on your system, execute the following:</p>
276
277<div class="source">
278<div class="source">
279<pre>$ java -version
280</pre></div></div>
281<p>If your version is at least 1.8.0_x, similar to the output shown below, you are good to proceed.</p>
282
283<div class="source">
284<div class="source">
285<pre>java version &quot;1.8.0_60&quot;
286Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
287Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
288</pre></div></div>
289<p>If you need to upgrade or install java, please follow <a class="externalLink" href="http://docs.oracle.com/javase/8/docs/technotes/guides/install/install_overview.html">Oracle&#x2019;s instructions</a>. The installation directory for</p>
290
291<ul>
292
293<li>
294<p>Linux would be at a path under <tt>/usr/lib/jvm/[jdk-version]</tt>.</p></li>
295
296<li>
297<p>Mac would be <tt>/Library/Java/JavaVirtualMachines/[jdk-version]/Contents/Home</tt>.</p></li>
298</ul>
299<p>The java installation directory is referred as <tt>JAVA_HOME</tt>. Since we upgraded/installed Java, we need to ensure <tt>JAVA_HOME</tt> points to the installation directory of JDK. Modify your ~/.bash_profile (or ~/.bashrc) and define <tt>JAVA_HOME</tt> accordingly. After the modification, execute the following:</p>
300
301<div class="source">
302<div class="source">
303<pre>$ java -version
304</pre></div></div>
305<p>If the version information you obtain does not show 1.8, you need to update the PATH variable. To do so, execute the following:</p>
306
307<div class="source">
308<div class="source">
309<pre>$ echo &quot;PATH=$JAVA_HOME/bin:$PATH&quot; &gt;&gt; ~/.bash_profile (or ~/.bashrc)
310$ source ~/.bash_profile (or ~/.bashrc)
311</pre></div></div></div>
312<div class="section">
313<h2><a name="Section_1:_Single-Machine_AsterixDB_installation_Back_to_TOC"></a><a name="Section1SingleMachineAsterixDBInstallation" id="Section1SingleMachineAsterixDBInstallation">Section 1: Single-Machine AsterixDB installation</a> <font size="4"><a href="#toc">[Back to TOC]</a></font></h2>
314<p>We assume a user called &#x201c;Joe&#x201d; with a home directory as /home/joe. On a Mac, the home directory for user Joe would be /Users/joe.</p>
315<div class="section">
316<h3><a name="Configuring_Environment"></a>Configuring Environment</h3>
317<p>Ensure that <tt>JAVA_HOME</tt> variable is defined and points to the the java installation directory on your machine. To verify, execute the following:</p>
318
319<div class="source">
320<div class="source">
321<pre>$ echo $JAVA_HOME
322</pre></div></div>
323<p>If you do not see any output, <tt>JAVA_HOME</tt> is not defined. We need to add the following line to your profile located at /home/joe/.bash_profile or /home/joe/.bashrc, whichever you are using. If you do not have any of these files, create a ~/.bash_profile file.</p>
324
325<div class="source">
326<div class="source">
327<pre>export JAVA_HOME=&lt;Path to Java installation directory&gt;
328</pre></div></div>
329<p>After you have edited ~/.bash_profile (or ~/.bashrc), execute the following to make the changes effective in current shell:</p>
330
331<div class="source">
332<div class="source">
333<pre>$ source /home/joe/.bash_profile (or /home/joe/.bashrc)
334</pre></div></div>
335<p>Before proceeding, verify that <tt>JAVA_HOME</tt> is defined by executing the following:</p>
336
337<div class="source">
338<div class="source">
339<pre>$ echo $JAVA_HOME
340</pre></div></div></div>
341<div class="section">
342<h3><a name="Configuring_SSH"></a>Configuring SSH</h3>
343<p>If SSH is not enabled on your system, please follow the instruction below to enable/install it or else skip to the section <a href="#Configuring_Password-less_SSH">Configuring Password-less SSH</a>.</p>
344<div class="section">
345<h4><a name="Enabling_SSH_on_Mac"></a>Enabling SSH on Mac</h4>
346<p>The Apple Mac OS X operating system has SSH installed by default but the SSH daemon is not enabled. This means you can&#x2019;t login remotely or do remote copies until you enable it. To enable it, go to &#x2018;System Preferences&#x2019;. Under &#x2018;Internet &amp; Networking&#x2019; there is a &#x2018;Sharing&#x2019; icon. Run that. In the list that appears, check the &#x2018;Remote Login&#x2019; option. Also check the &#x201c;All users&#x201d; radio button for &#x201c;Allow access for&#x201d;. This starts the SSH daemon immediately and you can remotely login using your username. The &#x2018;Sharing&#x2019; window shows at the bottom the name and IP address to use. You can also find this out using &#x2018;whoami&#x2019; and &#x2018;ifconfig&#x2019; from the Terminal application.</p></div>
347<div class="section">
348<h4><a name="Enabling_SSH_on_Linux"></a>Enabling SSH on Linux</h4>
349
350<div class="source">
351<div class="source">
352<pre>sudo apt-get install openssh-server
353</pre></div></div>
354<p>Assumming that you have enabled SSH on your system, let us proceed.</p></div>
355<div class="section">
356<h4><a name="Configuring_Password-less_SSH"></a>Configuring Password-less SSH</h4>
357<p>For our single-machine setup of AsterixDB, we need to configure password-less SSH access to localhost. We assume that you are on the machine where you want to install AsterixDB. To verify if you already have password-less SSH configured, execute the following:</p>
358
359<div class="source">
360<div class="source">
361<pre>$ ssh 127.0.0.1
362</pre></div></div>
363<p>If you get an output similar to one shown below, type &#x201c;yes&#x201d; and press enter.</p>
364
365<div class="source">
366<div class="source">
367<pre>The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established.
368RSA key fingerprint is aa:7b:51:90:74:39:c4:f6:28:a2:9d:47:c2:8d:33:31.
369Are you sure you want to continue connecting (yes/no)?
370</pre></div></div>
371<p>If you are not prompted for a password, that is if you get an output similar to one shown below, it signifies that you already have password-less SSH configured.</p>
372
373<div class="source">
374<div class="source">
375<pre>$ ssh 127.0.0.1
376Last login: Sat Mar 23 22:52:49 2013
377</pre></div></div>
378<p>[Important: Password-less SSH requires the use of a (public,private) key-pair. The key-pair is located as a pair of files under $HOME/.ssh directory. It is required that the (public,private) key-pair files have default names (id_rsa.pub, id_rsa) respectively. If you are using different names, please rename the files to use the default names]</p>
379<p>Skip to the next section <a href="#Configuring_Managix">Configuring Managix</a>.</p>
380<p>You are here because you were prompted for a password. You need to configure password-less SSH. We shall generate a (public,private) key-pair as id_rsa.pub and id_rsa respectively. If $HOME/.ssh already contains a (public,private) key-pair, please ensure the files are renamed before proceeding. Follow the instructions below.</p>
381
382<div class="source">
383<div class="source">
384<pre>$ ssh-keygen -t rsa -P &quot;&quot;
385Generating public/private rsa key pair.
386Enter file in which to save the key (/home/joe/.ssh/id_rsa):
387[Important: Please ensure that we use the default value, so simply press enter]
388</pre></div></div>
389<p>If a key already exists, you should get an output similar to what is shown below. Press &#x2018;y&#x2019; to overwrite the existing key. It is required to use the default name. If you wish to not overwrite a pre-existing key, ensure that the pre-existing key is saved with a different name.</p>
390
391<div class="source">
392<div class="source">
393<pre>/home/joe/.ssh/id_rsa already exists.
394Overwrite (y/n)?
395</pre></div></div>
396<p>You should see an output similar to one shown below:</p>
397
398<div class="source">
399<div class="source">
400<pre>The key fingerprint is:
4014d:b0:30:14:45:cc:99:86:15:48:17:0b:39:a0:05:ca joe@joe-machine
402The key's randomart image is:
403+--[ RSA 2048]----+
404| ..o+B@O= |
405|.. o ==*+ |
406|.E. oo . |
407| o |
408| S . |
409| |
410| |
411| |
412| |
413+-----------------+
414</pre></div></div>
415<p>Note: for Linux users, you may not get an image representation of the key, but this is not an error. Next, execute the following:</p>
416
417<div class="source">
418<div class="source">
419<pre>$ cat $HOME/.ssh/id_rsa.pub &gt;&gt; $HOME/.ssh/authorized_keys
420$ chmod 700 $HOME/.ssh/authorized_keys
421</pre></div></div>
422<p>We shall now retry SSH without password.</p>
423
424<div class="source">
425<div class="source">
426<pre>$ ssh 127.0.0.1
427</pre></div></div>
428<p>You may see an output similar to one shown below:</p>
429
430<div class="source">
431<div class="source">
432<pre>The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established.
433RSA key fingerprint is aa:7b:51:90:74:39:c4:f6:28:a2:9d:47:c2:8d:33:31.
434Are you sure you want to continue connecting (yes/no)?
435</pre></div></div>
436<p>Type &#x2018;yes&#x2019; and press the enter key. You should see an output similar to one shown below:</p>
437
438<div class="source">
439<div class="source">
440<pre>Warning: Permanently added '127.0.0.1' (RSA) to the list of known hosts.
441Last login: Thu Mar 28 12:27:10 2013
442</pre></div></div>
443<p>You should now be able to log in without being prompted for a password or a response.</p>
444
445<div class="source">
446<div class="source">
447<pre>ssh 127.0.0.1
448Last login: Sat Mar 23 22:54:40 2013
449</pre></div></div>
450<p>Execute &#x2018;exit&#x2019; to close the session.</p>
451
452<div class="source">
453<div class="source">
454<pre>$ exit
455logout
456Connection to 127.0.0.1 closed.
457</pre></div></div></div></div>
458<div class="section">
459<h3><a name="Configuring_Managix"></a>Configuring Managix</h3>
460<p>You will need the AsterixDB installer (a.k.a. Managix). Download the Standalone Cluster installer from <a class="externalLink" href="https://asterixdb.apache.org/download.html">here</a>; this includes the bits for Managix as well as AsterixDB.</p>
461<p>We will refer to the directory containing the extracted files as MANAGIX_HOME and we assume that MANAGIX_HOME/bin is on your PATH.</p>
462<p>To be able to create an AsterixDB instance and manage its lifecycle, Managix requires you to configure a set of configuration files namely:</p>
463
464<ul>
465
466<li><tt>conf/managix-conf.xml</tt>: A configuration XML file that contains configuration settings for Managix.</li>
467
468<li>A configuration XML file that describes the nodes in the cluster, e.g., <tt>clusters/local/local.xml</tt>.</li>
469</ul>
470<p>Since we intend to run AsterixDB on a single node, Managix can auto-configure itself and populate the above configuration files. To auto-configure Managix, execute the following in the MANAGIX_HOME directory:</p>
471
472<div class="source">
473<div class="source">
474<pre>/home/joe/asterix-mgmt&gt; $ managix configure
475</pre></div></div>
476<p>Let us do a sample run to validate the set of configuration files auto-generated by Managix.</p>
477
478<div class="source">
479<div class="source">
480<pre>/home/joe/asterix-mgmt&gt; $ managix validate
481 INFO: Environment [OK]
482 INFO: Managix Configuration [OK]
483
484/home/joe/asterix-mgmt&gt; $ managix validate -c clusters/local/local.xml
485 INFO: Environment [OK]
486 INFO: Cluster configuration [OK]
487</pre></div></div></div>
488<div class="section">
489<h3><a name="Creating_an_AsterixDB_instance"></a>Creating an AsterixDB instance</h3>
490<p>Now that we have configured Managix, we shall next create an AsterixDB instance. An AsterixDB instance is identified by a unique name and is created using the <tt>create</tt> command. The usage description for the <tt>create</tt> command can be obtained by executing the following:</p>
491
492<div class="source">
493<div class="source">
494<pre>$ managix help -cmd create
495Creates an AsterixDB instance with a specified name. Post creation, the instance is in ACTIVE state,
496indicating its availability for executing statements/queries.
497Usage arguments/options:
498-n Name of the AsterixDB instance.
499-c Path to the cluster configuration file
500</pre></div></div>
501<p>We shall now use the <tt>create</tt> command to create an AsterixDB instance by the name &#x201c;my_asterix&#x201d;. In doing so, we shall use the cluster configuration file that was auto-generated by Managix.</p>
502
503<div class="source">
504<div class="source">
505<pre>$ managix create -n my_asterix -c clusters/local/local.xml
506</pre></div></div>
507<p>A sample output of the above command is shown below:</p>
508
509<div class="source">
510<div class="source">
511<pre>INFO: Name:my_asterix
512Created:Thu Mar 07 11:14:13 PST 2013
513Web-Url:http://127.0.0.1:19001
514State:ACTIVE
515</pre></div></div>
516<p>The third line above shows the web-url <a class="externalLink" href="http://127.0.0.1:19001">http://127.0.0.1:19001</a> for an AsterixDB&#x2019;s web interface. The AsterixDB instance is in the &#x2018;ACTIVE&#x2019; state, indicating that you may access the web interface by navigating to the web url.</p>
517<p>Type in the following &#x201c;Hello World&#x201d; query in the box:</p>
518
519<div class="source">
520<div class="source">
521<pre>let $message := 'Hello World!'
522return $message
523</pre></div></div>
524<p>Press the &#x201c;Run&#x201d; button. If the query result shows on the output box, then Congratulations! You have successfully created an AsterixDB instance!</p></div></div>
525<div class="section">
526<h2><a name="Section_2:_Single-Machine_AsterixDB_installation_Advanced_Back_to_TOC"></a><a name="Section2SingleMachineAsterixDBInstallationAdvanced" id="Section2SingleMachineAsterixDBInstallationAdvanced">Section 2: Single-Machine AsterixDB installation (Advanced)</a> <font size="4"><a href="#toc">[Back to TOC]</a></font></h2>
527<p>We assume that you have successfully completed the single-machine AsterixDB installation by following the instructions above in section <a href="#Section_1:_Single-Machine_AsterixDB_installation">AsterixDB installation</a>. In this section, we shall cover advanced topics related to AsterixDB configuration. Before we proceed, it is imperative to go through some preliminary concepts related to AsterixDB runtime.</p>
528<div class="section">
529<h3><a name="AsterixDB_Runtime"></a>AsterixDB Runtime</h3>
530<p>An AsterixDB runtime comprises of a &#x2018;&#x2018;master node&#x2019;&#x2019; and a set of &#x2018;&#x2018;worker nodes&#x2019;&#x2019;, each identified by a unique id. The master node runs a &#x2018;&#x2018;Cluster Controller&#x2019;&#x2019; service (a.k.a. &#x2018;&#x2018;CC&#x2019;&#x2019;), while each worker node runs a &#x2018;&#x2018;Node Controller&#x2019;&#x2019; service (a.k.a. &#x2018;&#x2018;NC&#x2019;&#x2019;). Please note that a node in an AsterixDB cluster is a logical concept in the sense that multiple nodes may map to a single physical machine, which is the case for a single-machine AsterixDB installation. This association or mapping between an AsterixDB node and a physical machine is captured in a cluster configuration XML file. In addition, the XML file contains properties and parameters associated with each node.</p>
531<div class="section">
532<h4><a name="AsterixDB_Runtime_Configuration"></a>AsterixDB Runtime Configuration</h4>
533<p>As observed earlier, Managix can auto-configure itself for a single-machine setup. As part of auto-configuration, Managix generated the cluster XML file. Let us understand the components of the generated cluster XML file. If you have configured Managix (via the <tt>configure</tt> command), you can find a similar cluster XML file as $MANAGIX_HOME/clusters/local/local.xml. The following is a sample XML file generated on a Ubuntu (Linux) setup:</p>
534
535<div class="source">
536<div class="source">
537<pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt;
538&lt;cluster xmlns=&quot;cluster&quot;&gt;
539 &lt;name&gt;local&lt;/name&gt;
540 &lt;java_home&gt;/usr/lib/jvm/jdk1.8.0&lt;/java_home&gt;
541 &lt;log_dir&gt;/home/joe/asterix-mgmt/clusters/local/working_dir/logs&lt;/log_dir&gt;
542 &lt;txn_log_dir&gt;/home/joe/asterix-mgmt/clusters/local/working_dir/logs&lt;/txn_log_dir&gt;
543 &lt;iodevices&gt;/home/joe/asterix-mgmt/clusters/local/working_dir&lt;/iodevices&gt;
544 &lt;store&gt;storage&lt;/store&gt;
545 &lt;working_dir&gt;
546 &lt;dir&gt;/home/joe/asterix-mgmt/clusters/local/working_dir&lt;/dir&gt;
547 &lt;NFS&gt;true&lt;/NFS&gt;
548 &lt;/working_dir&gt;
549 &lt;master_node&gt;
550 &lt;id&gt;master&lt;/id&gt;
551 &lt;client_ip&gt;127.0.0.1&lt;/client_ip&gt;
552 &lt;cluster_ip&gt;127.0.0.1&lt;/cluster_ip&gt;
553 &lt;client_port&gt;1098&lt;/client_port&gt;
554 &lt;cluster_port&gt;1099&lt;/cluster_port&gt;
555 &lt;http_port&gt;8888&lt;/http_port&gt;
556 &lt;/master_node&gt;
557 &lt;node&gt;
558 &lt;id&gt;node1&lt;/id&gt;
559 &lt;cluster_ip&gt;127.0.0.1&lt;/cluster_ip&gt;
560 &lt;/node&gt;
561&lt;/cluster&gt;
562</pre></div></div>
563<p>We shall next explain the components of the cluster configuration XML file.</p></div>
564<div class="section">
565<h4><a name="a1_Defining_nodes_in_AsterixDB_runtime"></a>(1) Defining nodes in AsterixDB runtime</h4>
566<p>The single-machine AsterixDB instance configuration that is auto-generated by Managix (using the <tt>configure</tt> command) involves a master node (CC) and a worker node (NC). Each node is assigned a unique id and provided with an ip address (called &#x2018;&#x2018;cluster_ip&#x2019;&#x2019;) that maps a node to a physical machine. The following snippet from the above XML file captures the master/worker nodes in our AsterixDB installation.</p>
567
568<div class="source">
569<div class="source">
570<pre>&lt;master_node&gt;
571 &lt;id&gt;master&lt;/id&gt;
572 &lt;client_ip&gt;127.0.0.1&lt;/client_ip&gt;
573 &lt;cluster_ip&gt;127.0.0.1&lt;/cluster_ip&gt;
574 &lt;client_port&gt;1098&lt;/client_port&gt;
575 &lt;cluster_port&gt;1099&lt;/cluster_port&gt;
576 &lt;http_port&gt;8888&lt;/http_port&gt;
577&lt;/master_node&gt;
578&lt;node&gt;
579 &lt;id&gt;node1&lt;/id&gt;
580 &lt;cluster_ip&gt;127.0.0.1&lt;/cluster_ip&gt;
581&lt;/node&gt;
582</pre></div></div>
583<p>The following is a description of the different elements in the cluster configuration xml file.</p>
584
585<table border="0" class="table table-striped">
586
587<tr class="a">
588
589<td>Property</td>
590
591<td>Description</td>
592</tr>
593
594<tr class="b">
595
596<td>id</td>
597
598<td>A unique id for a node.</td>
599</tr>
600
601<tr class="a">
602
603<td>cluster_ip</td>
604
605<td>IP address of the machine to which a node maps to. This address is used for all internal communication between the nodes.</td>
606</tr>
607
608<tr class="b">
609
610<td>client_ip</td>
611
612<td>Provided for the master node. This IP should be reachable from clients that want to connect with AsterixDB via its web interface.</td>
613</tr>
614
615<tr class="a">
616
617<td>client_port</td>
618
619<td>Provided for the master node. This is the port at which the Cluster Controller (CC) service listens for connections from clients.</td>
620</tr>
621
622<tr class="b">
623
624<td>cluster_port</td>
625
626<td>Provided for the master node. This is the port used by the Cluster Controller (CC) service to listen for connections from Node Controllers (NCs). </td>
627</tr>
628
629<tr class="a">
630
631<td>http-port</td>
632
633<td>Provided for the master node. This is the http port used by the Cluster Controller (CC) service. </td>
634</tr>
635
636</table></div>
637<div class="section">
638<h4><a name="a2_Properties_associated_with_a_worker_node_NC_in_AsterixDB"></a>(2) Properties associated with a worker node (NC) in AsterixDB</h4>
639<p>The following is a list of properties associated with each worker node in an AsterixDB configuration.</p>
640
641<table border="0" class="table table-striped">
642
643<tr class="a">
644
645<td>Property</td>
646
647<td>Description</td>
648</tr>
649
650<tr class="b">
651
652<td>java_home</td>
653
654<td>Java installation directory at each node.</td>
655</tr>
656
657<tr class="a">
658
659<td>log_dir</td>
660
661<td>A directory where the worker node JVM may write logs.</td>
662</tr>
663
664<tr class="b">
665
666<td>txn_log_dir</td>
667
668<td>A directory where the worker node writes transaction logs.</td>
669</tr>
670
671<tr class="a">
672
673<td>iodevices</td>
674
675<td>Comma separated list of IO Device mount points.</td>
676</tr>
677
678<tr class="b">
679
680<td>store</td>
681
682<td>A data directory (under each iodevice) that AsterixDB uses to store data belonging to dataset(s).</td>
683</tr>
684</table>
685<p>All the above properties can be defined at the global level or a local level. In the former case, these properties apply to all the nodes in an AsterixDB configuration. In the latter case, these properties apply only to the node(s) under which they are defined. A property defined at the local level overrides the definition at the global level.</p></div>
686<div class="section">
687<h4><a name="a3_Working_directory_of_an_AsterixDB_instance"></a>(3) Working directory of an AsterixDB instance</h4>
688<p>Next we explain the following setting in the file $MANAGIX_HOME/clusters/local/local.xml.</p>
689
690<div class="source">
691<div class="source">
692<pre>&lt;working_dir&gt;
693 &lt;dir&gt;/Users/joe/asterix-mgmt/clusters/local/working_dir&lt;/dir&gt;
694 &lt;NFS&gt;true&lt;/NFS&gt;
695&lt;/working_dir&gt;
696</pre></div></div>
697<p>Managix associates a working directory with an AsterixDB instance and uses this directory for transferring binaries to each node. If there is a directory that is readable by each node, Managix can use it to place binaries that can be accessed and used by all the nodes in the AsterixDB set up. A network file system (NFS) provides such a functionality for a cluster of physical machines so that a path on NFS is accessible from each machine in the cluster. In the single-machine set up described above, all nodes correspond to a single physical machine. Each path on the local file system is accessible to all the nodes in the AsterixDB setup and the boolean value for NFS above is thus set to <tt>true</tt>.</p></div></div>
698<div class="section">
699<h3><a name="Managix_Configuration"></a>Managix Configuration</h3>
700<p>Managix allows creation and management of multiple AsterixDB instances and uses Zookeeper as its back-end database to keep track of information related to each instance. We need to provide a set of one or more hosts that Managix can use to run a Zookeeper instance. Zookeeper runs as a daemon process on each of the specified hosts. At each host, Zookeeper stores data under the Zookeeper home directory specified as part of the configuration. The following is an example configuration <tt>$MANAGIX_HOME/conf/managix-conf.xml</tt> that has Zookeeper running on the localhost (127.0.0.1) :</p>
701
702<div class="source">
703<div class="source">
704<pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt;
705&lt;configuration xmlns=&quot;installer&quot;&gt;
706 &lt;zookeeper&gt;
707 &lt;homeDir&gt;/home/joe/asterix/.installer/zookeeper&lt;/homeDir&gt;
708 &lt;clientPort&gt;2900&lt;/clientPort&gt;
709 &lt;servers&gt;
710 &lt;server&gt;127.0.0.1&lt;/server&gt;
711 &lt;/servers&gt;
712 &lt;/zookeeper&gt;
713&lt;/configuration&gt;
714</pre></div></div>
715<p>It is possible to have a single host for Zookeeper. A larger number of hosts would use Zookeeper&#x2019;s replication and fault-tolerance feature such that a failure of a host running Zookeeper would not result in loss of information about existing AsterixDB instances.</p></div></div>
716<div class="section">
717<h2><a name="Section_3:_Installing_AsterixDB_on_a_Cluster_of_Multiple_MachinesBack_to_TOC"></a><a name="Section3InstallingAsterixDBOnAClusterOfMultipleMachines" id="Section3InstallingAsterixDBOnAClusterOfMultipleMachines">Section 3: Installing AsterixDB on a Cluster of Multiple Machines</a><font size="4"><a href="#toc">[Back to TOC]</a></font></h2>
718<p>We assume that you have read the two sections above on single-machine AsterixDB setup. Next we explain how to install AsterixDB in a cluster of multiple machines. As an example, we assume we want to setup AsterixDB on a cluster of three machines, in which we use one machine (called machine A) as the master node and two other machines (called machine B and machine C) as the worker nodes, as shown in the following diagram:</p>
719<p><img src="images/AsterixCluster.png" alt="AsterixCluster" /></p>
720<p>Notice that each machine has a &#x2018;&#x2018;cluster_ip&#x2019;&#x2019; address, which is used by these machines for their intra-cluster communication. Meanwhile, the master machine also has a &#x2018;&#x2018;client_ip&#x2019;&#x2019; address, using which an end-user outside the cluster can communicate with this machine. The reason we differentiate between these two types of IP addresses is that we can have a cluster of machines using a private network. In this case they have internal ip addresses that cannot be used outside the network. In the case all the machines are on a public network, the &#x201c;client_ip&#x201d; and &#x201c;cluster_ip&#x201d; of the master machine can share the same address.</p>
721<p>Next we describe how to set up AsterixDB in this cluster, assuming no Managix has been installed on these machines.</p>
722<div class="section">
723<h3><a name="Step_1:_Configure_SSH"></a>Step (1): Configure SSH</h3>
724<p>The steps of setting up SSH are similar to those in the single-machine setup case. We assume we have a common user account called &#x201c;joe&#x201d; on each machine in the cluster.</p>
725<p>On the master machine, do the following:</p>
726
727<div class="source">
728<div class="source">
729<pre>machineA&gt; ssh 127.0.0.1
730</pre></div></div>
731<p>If you get an output similar to one shown below, type &#x201c;yes&#x201d; and press enter.</p>
732
733<div class="source">
734<div class="source">
735<pre>The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established.
736RSA key fingerprint is aa:7b:51:90:74:39:c4:f6:28:a2:9d:47:c2:8d:33:31.
737Are you sure you want to continue connecting (yes/no)?
738</pre></div></div>
739<p>If you are not prompted for a password, that is if you get an output similar to one shown below, it signifies that you already have password-less SSH configured.</p>
740
741<div class="source">
742<div class="source">
743<pre>$ ssh 127.0.0.1
744Last login: Sat Mar 23 22:52:49 2013
745</pre></div></div>
746<p>[Important: Password-less SSH requires the use of a (public,private) key-pair. The key-pair is located as a pair of files under $HOME/.ssh directory. It is required that the (public,private) key-pair files have default names (id_rsa.pub, id_rsa) respectively. If you are using different names, please rename the files to use the default names]</p>
747<p>If you are prompted for a password, execute the following</p>
748
749<div class="source">
750<div class="source">
751<pre>machineA&gt; ssh-keygen -t rsa -P &quot;&quot;
752machineA&gt; cat $HOME/.ssh/id_rsa.pub &gt;&gt; $HOME/.ssh/authorized_keys
753machineA&gt; chmod 700 $HOME/.ssh/authorized_keys
754</pre></div></div>
755<p>If $HOME is not on the NFS, copy the id_rsa.pub to the directory ~/.ssh (login with the same account) on each machine, and then do the following on each machine. (Notice that this step is not needed if the folder &#x201c;.ssh&#x201d; is on the NFS and can be accessed by all the nodes.)</p>
756
757<div class="source">
758<div class="source">
759<pre>cd ~/.ssh
760cat id_rsa.pub &gt;&gt; authorized_keys
761chmod 700 $HOME/.ssh/authorized_keys
762</pre></div></div>
763<p>Then run the following step again and type &#x201c;yes&#x201d; if prompted:</p>
764
765<div class="source">
766<div class="source">
767<pre>machineA&gt; ssh 127.0.0.1
768</pre></div></div></div>
769<div class="section">
770<h3><a name="Step_2:_Define_the_AsterixDB_cluster"></a>Step (2): Define the AsterixDB cluster</h3>
771<p>We first log into the master machine as the user &#x201c;joe&#x201d;. On this machine, download the Standalone Cluster installer from <a class="externalLink" href="https://asterixdb.apache.org/download.html">here</a> (save as above), then do the following steps similar to the single-machine case described above:</p>
772
773<div class="source">
774<div class="source">
775<pre>machineA&gt; cd ~
776machineA&gt; mkdir asterix-mgmt
777machineA&gt; cd asterix-mgmt
778machineA&gt; unzip &lt;path to the Managix zip bundle&gt;
779</pre></div></div>
780<p>Note that it is recommended that MANAGIX_HOME is not located on a network file system (NFS). Managix creates artifacts/logs that are not required to be shared. Any overhead associated with creating artifacts/logs on the NFS should be avoided.</p>
781<p>We also need an AsterixDB configuration XML file for the cluster. We give the name to the cluster, say, &#x201c;rainbow&#x201d;. We create a folder for the configuration of this cluster:</p>
782
783<div class="source">
784<div class="source">
785<pre>machineA&gt; mkdir asterix-mgmt/rainbow_cluster
786</pre></div></div>
787<p>For this cluster we create a configuration file <tt>$MANAGIX_HOME/rainbow_cluster/rainbow.xml</tt>. The following is a sample file with explanation of the properties:</p>
788
789<div class="source">
790<div class="source">
791<pre>&lt;cluster xmlns=&quot;cluster&quot;&gt;
792
793 &lt;!-- Name of the cluster --&gt;
794 &lt;name&gt;rainbow&lt;/name&gt;
795
796 &lt;!-- username, which should be valid for all the three machines --&gt;
797 &lt;username&gt;joe&lt;/username&gt;
798
799 &lt;!-- The working directory of Managix. It is recommended for the working
800 directory to be on a network file system (NFS) that can accessed by
801 all machines.
802 Managix creates the directory if it it doesn't exist. --&gt;
803 &lt;working_dir&gt;
804 &lt;dir&gt;/home/joe/managix-workingDir&lt;/dir&gt;
805 &lt;NFS&gt;true&lt;/NFS&gt;
806 &lt;/working_dir&gt;
807
808 &lt;!-- Directory for Asterix to store worker logs information for each machine.
809 Needs to be on the local file system of each machine.
810 Managix creates the directory if it doesn't exist.
811 This property can be overriden for a node by redefining at the node level. --&gt;
812 &lt;log_dir&gt;/mnt/joe/logs&lt;/log_dir&gt;
813
814 &lt;!-- Directory for Asterix to store transaction log information for each machine.
815 Needs to be on the local file system of each machine.
816 Managix creates the directory if it doesn't exist.
817 This property can be overriden for a node by redefining at the node level. --&gt;
818 &lt;txn_log_dir&gt;/mnt/joe/txn_logs&lt;/txn_log_dir&gt;
819
820 &lt;!-- Mount point of an iodevice. Use a comma separated list for a machine that
821 has multiple iodevices (disks).
822 This property can be overriden for a node by redefining at the node level. --&gt;
823 &lt;iodevices&gt;/mnt/joe&lt;/iodevices&gt;
824
825 &lt;!-- Path on each iodevice where Asterix will store its data --&gt;
826 &lt;store&gt;storage&lt;/store&gt;
827
828 &lt;!-- Java home for each machine --&gt;
829 &lt;java_home&gt;/usr/lib/jvm/jdk1.8.0&lt;/java_home&gt;
830
831 &lt;!-- IP addresses of the master machine A --&gt;
832 &lt;master_node&gt;
833 &lt;id&gt;master&lt;/id&gt;
834 &lt;client_ip&gt;128.195.52.177&lt;/client_ip&gt;
835 &lt;cluster_ip&gt;192.168.100.0&lt;/cluster_ip&gt;
836 &lt;client_port&gt;1098&lt;/client_port&gt;
837 &lt;cluster_port&gt;1099&lt;/cluster_port&gt;
838 &lt;http_port&gt;8888&lt;/http_port&gt;
839 &lt;/master_node&gt;
840
841 &lt;!-- IP address(es) of machine B --&gt;
842 &lt;node&gt;
843 &lt;id&gt;nodeB&lt;/id&gt;
844 &lt;cluster_ip&gt;192.168.100.1&lt;/cluster_ip&gt;
845 &lt;/node&gt;
846
847 &lt;!-- IP address(es) of machine C --&gt;
848 &lt;node&gt;
849 &lt;id&gt;nodeC&lt;/id&gt;
850 &lt;cluster_ip&gt;192.168.100.2&lt;/cluster_ip&gt;
851 &lt;/node&gt;
852&lt;/cluster&gt;
853</pre></div></div>
854<p>As stated before, each of the above properties can be defined at the cluster level, in which case it applies to all the nodes in the system. Each property can also be defined at a node level.</p>
855<p>Once we have formed the cluster XML file, we can validate the configuration by doing the following:</p>
856
857<div class="source">
858<div class="source">
859<pre>managix validate -c rainbow_cluster/rainbow.xml
860</pre></div></div>
861<p>This will verify the contents of the file, and also attempt to ssh to each node in the cluster to ensure that password-less SSH is configured correctly. You may see output like</p>
862
863<div class="source">
864<div class="source">
865<pre>The authenticity of host '192.168.100.1 (192.168.100.1)' can't be established.
866RSA key fingerprint is 89:80:31:1f:be:51:16:d7:2b:f5:e0:b3:2c:bd:83:94.
867Are you sure you want to continue connecting (yes/no)?
868</pre></div></div>
869<p>and this output may be repeated for each node in the cluster. Answer &#x201c;yes&#x201d; each time.</p>
870<p>If the final output contains the following lines (possibly separated by the RSA prompts mentione above):</p>
871
872<div class="source">
873<div class="source">
874<pre>INFO: Environment [OK]
875INFO: Cluster configuration [OK]
876</pre></div></div>
877<p>it means that the XML configuration file is correct!</p></div>
878<div class="section">
879<h3><a name="Step_3:_Configuring_Managix"></a>Step (3): Configuring Managix</h3>
880<p>Managix uses a configuration XML file at <tt>$MANAGIX_HOME/conf/managix-conf.xml</tt> to configure its own properties, such as its Zookeeper service. We can use the <tt>configure</tt> command to auto-generate this configuration file:</p>
881
882<div class="source">
883<div class="source">
884<pre>machineA&gt; managix configure
885</pre></div></div>
886<p>We use the <tt>validate</tt> command to validate the Managix configuration. To do so, execute the following.</p>
887
888<div class="source">
889<div class="source">
890<pre>machineA&gt; managix validate
891INFO: Environment [OK]
892INFO: Managix Configuration [OK]
893</pre></div></div>
894<p>Note that the <tt>configure</tt> command also generates a cluster configuration XML file at $MANAGIX_HOME/clusters/local/local.xml. This file is not needed in the case of a cluster of machines.</p></div>
895<div class="section">
896<h3><a name="Step_4:_Creating_an_AsterixDB_instance"></a>Step (4): Creating an AsterixDB instance</h3>
897<p>Now that we have configured Managix, we shall next create an AsterixDB instance, which is identified by a unique name and is created using the <tt>create</tt> command. The usage description for the <tt>create</tt> command can be obtained by executing the following:</p>
898
899<div class="source">
900<div class="source">
901<pre>machineA&gt; managix help -cmd create
902
903Creates an AsterixDB instance with a specified name. Post creation, the instance is in ACTIVE state,
904indicating its availability for executing statements/queries.
905Usage arguments/options:
906-n Name of the AsterixDB instance.
907-c Path to the cluster configuration file
908</pre></div></div>
909<p>We shall now use the <tt>create</tt> command to create an AsterixDB instance called &#x201c;rainbow_asterix&#x201d;. In doing so, we shall use the cluster configuration file that was auto-generated by Managix.</p>
910
911<div class="source">
912<div class="source">
913<pre>machineA&gt; managix create -n rainbow_asterix -c clusters/rainbow.xml
914</pre></div></div>
915<p>If the response message does not have warning, then Congratulations! You have successfully installed AsterixDB on this cluster of machines!</p>
916<p>Please refer to the section <a href="#Section_4:_Managing_the_Lifecycle_of_an_AsterixDB_Instance">Managing the Lifecycle of an AsterixDB Instance</a> for a detailed description on the set of available commands/operations that let you manage the lifecycle of an AsterixDB instance. Note that the output of the commands varies with the cluster definition and may not apply to the cluster specification you built above.</p></div></div>
917<div class="section">
918<h2><a name="Section_4:_Managing_the_Lifecycle_of_an_AsterixDB_Instance_Back_to_TOC"></a><a name="Section4ManagingTheLifecycleOfAnAsterixDBInstance" id="Section4ManagingTheLifecycleOfAnAsterixDBInstance">Section 4: Managing the Lifecycle of an AsterixDB Instance</a> <font size="4"><a href="#toc">[Back to TOC]</a></font></h2>
919<p>Now that we have an AsterixDB instance running, let us use Managix to manage the instance&#x2019;s lifecycle. Managix provides the following set of commands/operations:</p>
920<div class="section">
921<div class="section">
922<h4><a name="Managix_Commands"></a>Managix Commands</h4>
923
924<table border="0" class="table table-striped">
925
926<tr class="a">
927<td>Command</td>
928<td>Description</td></tr>
929
930<tr class="b">
931<td><a href="#Creating_an_AsterixDB_instance">create</a></td>
932<td>Creates a new asterix instance.</td></tr>
933
934<tr class="a">
935<td><a href="#Describe_Command">describe</a></td>
936<td>Describes an existing asterix instance.</td></tr>
937
938<tr class="b">
939<td><a href="#Stop_Command">stop</a></td>
940<td>Stops an asterix instance that is in the ACTIVE state.</td></tr>
941
942<tr class="a">
943<td><a href="#Start_Command">start</a></td>
944<td>Starts an AsterixDB instance.</td></tr>
945
946<tr class="b">
947<td><a href="#Backup_Command">backup</a></td>
948<td>Creates a backup for an existing AsterixDB instance.</td></tr>
949
950<tr class="a">
951<td><a href="#Restore_Command">restore</a></td>
952<td>Restores an AsterixDB instance.</td></tr>
953
954<tr class="b">
955<td><a href="#Delete_Command">delete</a></td>
956<td>Deletes an AsterixDB instance.</td></tr>
957
958<tr class="a">
959<td><a href="#Configuring_Managix">validate</a></td>
960<td>Validates the installer/cluster configuration.</td></tr>
961
962<tr class="b">
963<td><a href="#Configuring_Managix">configure</a></td>
964<td>Auto generates a configuration for an AsterixDB instance.</td></tr>
965
966<tr class="a">
967<td><a href="#Log_Command">log</a></td>
968<td>Produces a zip archive containing log files from each node in an AsterixDB instance.</td></tr>
969
970<tr class="b">
971<td><a href="#Shutdown_Command">shutdown</a></td>
972<td>Shuts down the installer service.</td></tr>
973</table>
974<p>You may obtain the above listing by simply executing &#x2018;managix&#x2019; :</p>
975
976<div class="source">
977<div class="source">
978<pre>$ managix
979</pre></div></div>
980<p>We already talked about <tt>create</tt> and <tt>validate</tt> commands. We shall next explain the rest of the commands listed above. We also provide sample output messages of these commands assuming we are running an AsterixDB instance on a single machine.</p>
981<div class="section">
982<h5><a name="Describe_Command"></a>Describe Command</h5>
983<p>The <tt>describe</tt> command provides information about an AsterixDB instance. The usage can be looked up by executing the following:</p>
984
985<div class="source">
986<div class="source">
987<pre>$ managix help -cmd describe
988
989Provides information about an AsterixDB instance.
990The following options are available:
991[-n] Name of the AsterixDB instance.
992[-admin] Provides a detailed description
993</pre></div></div>
994<p>The brackets indicate optional flags.</p>
995<p>The output of the <tt>describe</tt> command when used without the <tt>admin</tt> flag contains minimal information and is similar to the output of the <tt>create</tt> command. Let us try running the describe command in &#x201c;admin&#x201d; mode.</p>
996
997<div class="source">
998<div class="source">
999<pre>$ managix describe -n my_asterix -admin
1000INFO: Name:my_asterix
1001Created:Thu Mar 07 19:07:00 PST 2013
1002Web-Url:http://127.0.0.1:19001
1003State:ACTIVE
1004Master node:master:127.0.0.1
1005node1:127.0.0.1
1006
1007Asterix version:0.0.5
1008Asterix Configuration
1009output_dir = /tmp/asterix_output/
1010Metadata Node:node1
1011Processes
1012NC at 127.0.0.1 [ 22195 ]
1013CC at 127.0.0.1 [ 22161 ]
1014
1015Asterix Configuration
1016 nc.java.opts :-Xmx1024m
1017 cc.java.opts :-Xmx1024m
1018 storage.buffercache.pagesize :32768
1019 storage.buffercache.size :33554432
1020 storage.buffercache.maxopenfiles :214748364
1021 storage.memorycomponent.pagesize :32768
1022 storage.memorycomponent.numpages :1024
1023 storage.memorycomponent.globalbudget :536870192
1024 storage.lsm.mergethreshold :3
1025 storage.lsm.bloomfilter.falsepositiverate:0.01
1026 txn.log.buffer.numpages :8
1027 txn.log.buffer.pagesize :131072
1028 txn.log.partitionsize :2147483648
1029 txn.log.disksectorsize :4096
1030 txn.log.groupcommitinterval :1
1031 txn.log.checkpoint.lsnthreshold :67108864
1032 txn.log.checkpoint.pollfrequency :120
1033 txn.log.checkpoint.history :0
1034 txn.lock.escalationthreshold :1000
1035 txn.lock.shrinktimer :5000
1036 txn.lock.timeout.waitthreshold :60000
1037 txn.lock.timeout.sweepthreshold :10000
1038 compiler.sortmemory :33554432
1039 compiler.joinmemory :33554432
1040 compiler.framesize :32768
1041 web.port :19001
1042 api.port :19002
1043 log.level :INFO
1044</pre></div></div>
1045<p>As seen above, the instance &#x2018;my_asterix&#x2019; is configured such that all processes running at the localhost (127.0.0.1). The process id for each process (JVM) is shown next to it.</p></div>
1046<div class="section">
1047<h5><a name="Stop_Command"></a>Stop Command</h5>
1048<p>The <tt>stop</tt> command can be used for shutting down an AsterixDB instance. After that, the instance is unavailable for executing queries. The usage can be looked up by executing the following.</p>
1049
1050<div class="source">
1051<div class="source">
1052<pre>$ managix help -cmd stop
1053
1054Shuts an AsterixDB instance that is in ACTIVE state. After executing the stop command, the AsterixDB instance transits
1055to the INACTIVE state, indicating that it is no longer available for executing queries.
1056
1057Available arguments/options
1058-n name of the AsterixDB instance.
1059</pre></div></div>
1060<p>To stop the AsterixDB instance.</p>
1061
1062<div class="source">
1063<div class="source">
1064<pre>$ managix stop -n my_asterix
1065 INFO: Stopped AsterixDB instance: my_asterix
1066
1067$ managix describe -n my_asterix
1068 INFO: Name: my_asterix
1069 Created:Thu Mar 07 19:07:00 PST 2013
1070 Web-Url:http://127.0.0.1:19001
1071 State:INACTIVE (Fri Mar 08 09:49:00 PST 2013)
1072</pre></div></div></div>
1073<div class="section">
1074<h5><a name="Start_Command"></a>Start Command</h5>
1075<p>The <tt>start</tt> command starts an AsterixDB instance that is in the INACTIVE state. The usage can be looked up by executing the following:</p>
1076
1077<div class="source">
1078<div class="source">
1079<pre> $ managix help -cmd start
1080
1081 Starts an AsterixDB instance that is in INACTIVE state. After executing the start command, the AsterixDB instance transits to the ACTIVE state, indicating that it is now available for executing statements/queries.
1082
1083 Available arguments/options
1084 -n name of the AsterixDB instance.
1085</pre></div></div>
1086<p>Let us now start the AsterixDB instance.</p>
1087
1088<div class="source">
1089<div class="source">
1090<pre> $ managix start -n my_asterix
1091 INFO: Name:my_asterix
1092 Created:Thu Mar 07 19:07:00 PST 2013
1093 Web-Url:http://127.0.0.1:19001
1094 State:ACTIVE (Fri Mar 08 09:49:00 PST 2013)
1095</pre></div></div></div>
1096<div class="section">
1097<h5><a name="Backup_Command"></a>Backup Command</h5>
1098<p>The backup command allows you to take a backup of the data stored with an AsterixDB instance. The backup can be taken on the local file system or on an HDFS instance. In either case, the snapshots are stored under a backup directory. You need to make sure the backup directory has appropriate read/write permissions. Configuring settings for backup can be found inside the Managix&#x2019;s configuration file located at <tt>$MANAGIX_HOME/conf/managix-conf.xml</tt>.</p>
1099<p><i>Configuring backup on the local file system</i></p>
1100<p>We need to provide a path to a backup directory on the local file system. The backup directory can be configured be editing the Managix configuration XML, found at <tt>$MANAGIX_HOME/conf/managix-conf.xml</tt>.</p>
1101
1102<div class="source">
1103<div class="source">
1104<pre>&lt;backup&gt;
1105 &lt;backupDir&gt;Provide path to the backup directory here&lt;/backupDir&gt;
1106&lt;/backup&gt;
1107</pre></div></div>
1108<p>Prior to taking a backup of an AsterixDB instance, it is required for the instance to be in the INACTIVE state. We do so by using the <tt>stop</tt> command, as shown below:</p>
1109
1110<div class="source">
1111<div class="source">
1112<pre>$ managix stop -n my_asterix
1113 INFO: Stopped AsterixDB instance: my_asterix
1114</pre></div></div>
1115<p>We can now take the backup by executing the following:</p>
1116
1117<div class="source">
1118<div class="source">
1119<pre>$ managix backup -n my_asterix
1120 INFO: my_asterix backed up 0_Fri Mar 08 16:16:34 PST 2013 (LOCAL)
1121</pre></div></div>
1122<p><i>Configuring backup on an HDFS instance</i></p>
1123<p>To configure a backup to be taken on an HDFS instance, we need to provide required information about the running HDFS instance. This information includes the HDFS version and the HDFS url. Simply edit the Managix configuration file and provide the required information.</p>
1124
1125<div class="source">
1126<div class="source">
1127<pre>&lt;backup&gt;
1128 &lt;backupDir&gt;Provide path to the backup directory here&lt;/backupDir&gt;
1129 &lt;hdfs&gt;
1130 &lt;version&gt;0.20.2&lt;/version&gt;
1131 &lt;url&gt;&lt;/url&gt;
1132 &lt;/hdfs&gt;
1133&lt;/backup&gt;
1134</pre></div></div>
1135<p>A sample output when a backup is taken on an HDFS is shown below:</p>
1136
1137<div class="source">
1138<div class="source">
1139<pre>$ managix backup -n my_asterix
1140 INFO: my_asterix backed up 1_Fri Mar 08 17:10:38 PST 2013 (HDFS)
1141</pre></div></div>
1142<p>Each time we take a backup, we are provided with a unique id (a monotonically increasing value starting with 0). This id is required when we need to restore from a previously taken backup. Information about all available backup snapshots can be obtained by using the <tt>describe</tt> command in the admin mode, as shown below:</p>
1143
1144<div class="source">
1145<div class="source">
1146<pre>$ managix describe -n my_asterix -admin
1147INFO: Name:my_asterix
1148Created:Fri Mar 08 15:11:12 PST 2013
1149Web-Url:http://127.0.0.1:19001
1150State:INACTIVE (Fri Mar 08 16:14:20 PST 2013)
1151Master node:master:127.0.0.1
1152node1:127.0.0.1
1153
1154Backup:0 created at Fri Mar 08 16:16:34 PST 2013 (LOCAL)
1155Backup:1 created at Fri Mar 08 17:10:38 PST 2013 (HDFS)
1156
1157Asterix version:0.0.5
1158Asterix Configuration
1159Metadata Node:node1
1160Processes
1161</pre></div></div>
1162<p>The above output shows the available backup identified by it&#x2019;s id (0). We shall next describe the method for restoring an AsterixDB instance from a backup snapshot.</p></div>
1163<div class="section">
1164<h5><a name="Restore_Command"></a>Restore Command</h5>
1165<p>The <tt>restore</tt> command allows you to restore an AsterixDB instance&#x2019;s data from a previously taken backup. The usage description can be obtained as follows:</p>
1166
1167<div class="source">
1168<div class="source">
1169<pre>$ managix help -cmd restore
1170
1171Restores an AsterixDB instance's data from a previously taken backup.
1172Available arguments/options
1173
1174-n name of the AsterixDB instance
1175-b id of the backup snapshot
1176</pre></div></div>
1177<p>The following command restores our AsterixDB instance from the backup snapshot identified by the id (0). Prior to restoring an instance from a backup, it is required that the instance is in the INACTIVE state.</p>
1178
1179<div class="source">
1180<div class="source">
1181<pre>$ managix restore -n my_asterix -b 0
1182INFO: AsterixDB instance: my_asterix has been restored from backup
1183</pre></div></div>
1184<p>You can start the AsterixDB instance by using the start command.</p></div>
1185<div class="section">
1186<h5><a name="Log_Command"></a>Log Command</h5>
1187<p>The <tt>log</tt> command allows you to collect the log files coresponding to each node of an AsterixDB instance into a zip archive. The zip archive is produced on the local file system of the machine running managix.</p>
1188
1189<div class="source">
1190<div class="source">
1191<pre>$ managix help -cmd log
1192
1193Creates a zip archive containing log files corresponding to each worker node (NC) and the master (CC) for an AsterixDB instance
1194
1195Available arguments/options
1196-n name of the AsterixDB instance.
1197-d destination directory for producing the zip archive. Defaults to $MANAGIX_HOME/logdump.
1198</pre></div></div>
1199<p>The following is an example showing the use of the log command.</p>
1200
1201<div class="source">
1202<div class="source">
1203<pre>$ managix log -n my_asterix -d /Users/joe/logdump
1204INFO: Log zip archive created at /Users/joe/logdump/log_Thu_Jun_06_00:53:51_PDT_2013.zip
1205</pre></div></div></div>
1206<div class="section">
1207<h5><a name="Delete_Command"></a>Delete Command</h5>
1208<p>As the name suggests, the <tt>delete</tt> command permanently removes an AsterixDB instance by cleaning up all associated data/artifacts. The usage can be looked up by executing the following:</p>
1209
1210<div class="source">
1211<div class="source">
1212<pre>$ managix help -cmd delete
1213Permanently deletes an AsterixDB instance. The instance must be in the INACTIVE state.
1214
1215Available arguments/options
1216-n name of the AsterixDB instance.
1217
1218
1219$ managix delete -n my_asterix
1220 INFO: AsterixDB instance my_asterix deleted.
1221</pre></div></div></div>
1222<div class="section">
1223<h5><a name="Shutdown_Command"></a>Shutdown Command</h5>
1224<p>Managix uses Zookeeper service for storing all information about created AsterixDB instances. The Zookeeper service runs in the background and can be shut down using the <tt>shutdown</tt> command.</p>
1225
1226<div class="source">
1227<div class="source">
1228<pre>$ managix shutdown
1229</pre></div></div></div>
1230<div class="section">
1231<h5><a name="Help_Command"></a>Help Command</h5>
1232<p>The <tt>help</tt> command provides a usage description of a Managix command.</p>
1233
1234<div class="source">
1235<div class="source">
1236<pre>$ managix help -cmd &lt;command name&gt;
1237</pre></div></div>
1238<p>As an example, for looking up the help for the <tt>configure</tt> command, execute the following</p>
1239
1240<div class="source">
1241<div class="source">
1242<pre>$ managix help -cmd configure
1243
1244Auto-generates the AsterixDB installer configruation settings and AsterixDB cluster
1245configuration settings for a single node setup.
1246</pre></div></div></div></div></div></div>
1247<div class="section">
1248<h2><a name="Section_5:_Frequently_Asked_Questions_Back_to_TOC"></a><a name="Section5FAQ" id="Section5FAQ">Section 5: Frequently Asked Questions</a> <font size="4"><a href="#toc">[Back to TOC]</a></font></h2>
1249<div class="section">
1250<div class="section">
1251<div class="section">
1252<h5><a name="Question"></a>Question</h5>
1253<p>What happens if a machine acting as a node in the Asterix cluster becomes unreachable for some reason (network partition/machine failure) ?</p></div>
1254<div class="section">
1255<h5><a name="Answer"></a>Answer</h5>
1256<p>When a node leaves the Asterix cluster, the AsterixDB instance transits to an &#x2018;UNUSABLE&#x2019; state, indicating that it is no longer available for serving queries. To know which set of node(s) left the cluster, run the describe command with -admin flag.</p>
1257
1258<div class="source">
1259<div class="source">
1260<pre>$ $MANAGIX_HOME/bin/managix describe -n &lt;name of the AsterixDB instance&gt;-admin
1261</pre></div></div>
1262<p>Above command will show the state of AsterixDB instance and list the set of nodes that have left the cluster.</p>
1263<p>The failed node must be brought back to re-join the cluster. Once done, you may bring back the instance to an &#x2018;ACTIVE&#x2019; state by executing the following sequence.</p>
1264<p>1) Get rid of the Asterix processes running on the nodes in the cluster:-</p>
1265
1266<div class="source">
1267<div class="source">
1268<pre>managix stop -n my_asterix
1269</pre></div></div>
1270<p>The processes associated with the instance are terminated and the instance moves to the INACTIVE state.</p>
1271<p>2) Start the AsterixDB instance using the start command.</p>
1272
1273<div class="source">
1274<div class="source">
1275<pre>managix start -n &lt;name of your AsterixDB instance&gt;
1276</pre></div></div></div>
1277<div class="section">
1278<h5><a name="Question"></a>Question</h5>
1279<p>Do I need to create all the directories/paths I put into the cluster configuration XML ?</p></div>
1280<div class="section">
1281<h5><a name="Answer"></a>Answer</h5>
1282<p>Managix will create a path if it is not existing. It does so using the user account mentioned in the cluster configuration xml. Please ensure that the user account has appropriate permissions for creating the missing paths.</p></div>
1283<div class="section">
1284<h5><a name="Question"></a>Question</h5>
1285<p>Should MANAGIX_HOME be on the network file system (NFS) ?</p></div>
1286<div class="section">
1287<h5><a name="Answer"></a>Answer</h5>
1288<p>It is recommended that MANAGIX_HOME is not on the NFS. Managix produces artifacts/logs on disk which are not required to be shared. As such an overhead in creating the artifacts/logs on the NFS should be avoided.</p></div>
1289<div class="section">
1290<h5><a name="Question"></a>Question</h5>
1291<p>How do we change the underlying code (apply a code patch) for an &#x2018;active&#x2019; asterix instance?</p></div>
1292<div class="section">
1293<h5><a name="Answer"></a>Answer</h5>
1294<p>At times, end-user (particularly asterix developer) may run into the need to altering the underlying code that is being run by an asterix instance. In the current version of managix, this can be achieved as follows:-</p>
1295<p>Assume that you have an &#x2018;active&#x2019; instance by the name a1 that is running version v1 of asterix. You have a revised version of asterix - v2 that fixes some bug(s).</p>
1296<p>To upgrade asterix from v1 to v2:-</p>
1297<p>step 1) managix stop -n a1</p>
1298<p>step 2) managix shutdown</p>
1299<p>step 3) copy asterix-server zip (version v2) to asterix/</p>
1300<p>step 4) managix start -n a1</p>
1301<p>a1 now is running on version v2.</p>
1302<p>Limitations:-</p>
1303<p>a) Obviously this wont work in a situation where v2 has made a change that is incompatible with earlier version, such altering schema.</p>
1304<p>b) A change in asterix zip applies to all existing instances (after a restart) and subsequent instances that user creates.</p></div></div></div></div>
1305 </div>
1306 </div>
1307 </div>
1308
1309 <hr/>
1310
1311 <footer>
1312 <div class="container-fluid">
1313 <div class="row span12">Copyright &copy; 2017
1314 <a href="https://www.apache.org/">The Apache Software Foundation</a>.
1315 All Rights Reserved.
1316
1317 </div>
1318
1319 <?xml version="1.0" encoding="UTF-8"?>
1320<div class="row-fluid">Apache AsterixDB, AsterixDB, Apache, the Apache
1321 feather logo, and the Apache AsterixDB project logo are either
1322 registered trademarks or trademarks of The Apache Software
1323 Foundation in the United States and other countries.
1324 All other marks mentioned may be trademarks or registered
1325 trademarks of their respective owners.</div>
1326
1327
1328 </div>
1329 </footer>
1330 </body>
1331</html>