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