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