By Dassi Orleando, Alibaba Cloud Tech Share Author. Tech Share is Alibaba Cloud's incentive program to encourage the sharing of technical knowledge and best practices within the cloud community.
ArangoDB is a native multi-model NoSQL database management system with search capabilities and flexible data models for documents, graphs, and key-values. With ArangoDB, you can build high performance applications using a convenient SQL-like query language or JavaScript extensions.
In this article, we'll cover some initial setup of ArangoDB to be able to run it on an Alibaba Cloud Elastic Compute Service (ECS) instance.
Firstly, we need to create an ECS. For this article, I'm using a simple ECS Ubuntu instance with 1 Core and 0.5 GB of memory then you log into via ssh/console as described into the guide.
Next, we need to install the ArangoDB package itself using one of the binary provided into the download page where we see two kind of binary one is the enterprise edition and the other the community with less features (services) of course.
Let's choose the community edition then download the exact binary corresponding to our operating system currently in use.
Note: The docker installation is preferred as it's making quicker the whole installation process and easier the configurations later.
We can either use the Ubuntu single package for quick installation via the server tool (containing the client tool), install it via Package Manager after having updated our repository or even follow the manual installation.
The latest version at the time of writing this article is the 3.4.2-1, let's run the following command to have it on our Ubuntu instance (supposed we're still connected via ssh):
curl https://download.arangodb.com/arangodb34/Community/Linux/arangodb3_3.4.2-1_amd64.deb
Once downloaded we run it knowing we're still in the same directory the file is located:
sudo apt install arangodb3_3.4.2-1_amd64.deb
arangosh is the executable to use in order to run it in command line and therefore being able to perform console commands and access the web interface (called Aardvark) at http://our-ip-address:8529/
Once put it on, we'll see a login screen as following:
Arangosh command-line tool can be used for administration of ArangoDB and/or performing quick queries; by default, it'll try to connect to a locally running server on localhost on port 8529 with the username root and an empty password while connecting to the default database _system.
It's possible to run this executable with some options addressing a remote server installation:
For example,
arangosh --server.endpoint http://192.168.122.103:8529 --server.username root --server.database databasename --server.disable-authentication false
arangosh will then display a password prompt and perform the explicit connection attempt once the password has been provided.
You can have more details about the ArangoDB shell program here here.
Let's specify our credentials at the login screen to access the next step which is selecting the database to connect to:
Let's click on the Select DB button once chosen, the dashboard will be then display as follow:
arangosh comes with a set of commands we'll see in the following sections; those can be executed straight from the arangosh prompt.
Arangosh has multiple options we can specify in the prompt when starting our database server, they are separated into 4 groups as follow:
STANDARD Options:
JAVASCRIPT Options:
LOGGING options:
CLIENT options:
One of the most important thing to do immediately once having your ArangoDB fully installed is to make sure you're (or your users) actually the only one (persons) accessing it the way you want.
As noticed up here, we were connected to our server installation with the root account without any password which is very weak for the purpose of saving our data, most of the time database management system are doing this to allow users quickly experiment the features.
In order to have a fully secured instance, let's run the command arango-secure-installation which will prompt us to provide a password for the root user then restart the server again.
Now, let's manage our user as an administrator. Giving access with some permissions is something we always do when we want to access a database from an application we're building or a third party.
The quicker way to do this is to access the Users management area from the dashboard on the left menu, accessible with a link like: http://our-ip-address:8529/_db/_system/_admin/aardvark/index.html - users:
We then have the possibility to define user's details and their permissions within our ArangoDB server installation.
From the screenshot above, the root user has the administrator permission on the default _system database.
Arangosh isn't the only executable shipped with the ArangoDB installation, there are also:
ArangoDB is a distributed database supporting multiple data models, and can thus be scaled horizontally as it can be deployed on a cluster (by using many servers). This approach not only provides performance as well as capacity increases, but also achieves resilience by means of replication and automatic fail-over.
NoSQL databases are so common in their way to manage content to be saved, either it's by using Graph or Document but as stated up here ArangoDB is special because it's a Multi-Model NoSQL database meaning it can simultaneously manage time key/values, documents and graphs data.
A Database is a set of collections and Collections stores records (talking about documents), the collections are equivalent to tables in relational database area and documents to rows in table just that attributes (columns) are dynamic in that particular case.
Data model refers to how the data are being saved into the database. In ArangoDB documents are saved following almost the JSON format with a document containing 0 or many attributes, each of these attributes having a value that can either be an atomic type (number, string, boolean or null) or a compound type (array or embedded document/object).
There are two types of collections that can be used for our database, the document collection (referred as vertex in the context of graphs) as well as edge collections. Edge collections store documents too, but they include two special attributes, _from and _to, which are used to create relations between documents. Usually, two documents (vertices) stored in document collections are linked by a document (edge) stored in an edge collection.
More details will be described here.
The database creation could be simply made either by hitting a command or by using the graphical interface as shown below:
Then we click on Add Database button that allows us to fill the database's details like the name and the owner (existing database user):
We now have an empty database where we can start adding one or more collections on it, let's go into the Collections menu item:
From that area every single collection created will belongs to the current database we're connected to which is the default one called _system, to be able to add collections to the one we've just created up here we'll need to switch as at this level all is contextual.
From the top menu, click on the currently edited database to have the database selection UI again where we can select the desired database as illustrated in the following screen:
As any other database management system, query is the operations used to filter, count, update, list, delete, create and find our data.
ArangoDB's queries need to be written in a specific format they've built for the purpose called ArangoDB Query Language.
For many data as output could be long, a cursor is always returned allowing to iterate over the results of queries instead of getting one big hunk.
Instead of accessing our database/collections from the cleaner graphical interface, another option to know as database administrator is to use the command line approach which consists of following a specified syntax once running arangosh in your terminal, here we have:
Here are some commands to use as examples:
The following image is illustrating how the command line result looks like:
It's very essential for a database management system to have many interfaces the programmers can use to access their databases from outside of the server. As for now we've seen how to access and perform some operations in our database from the graphical interface and with some commands.
Driver helps us to do these same operations with a specific programming languages as ArangoDB has a rest interface; currently it does supports plenty of platforms like: NodeJs, PHP, Java, Javascript, .NET, Go, Python, Scala, Ruby, F# and more. The full list is accessible on their website.
In this long article, we've seen how to install ArangoDB (server + client) and performing basics queries and management tasks into an Ubuntu powered by ECS.
2,599 posts | 762 followers
FollowAlibaba Clouder - June 5, 2019
Alibaba Clouder - June 5, 2019
Alibaba Clouder - September 7, 2020
- December 5, 2017
Alibaba Container Service - October 25, 2024
Alibaba Clouder - January 5, 2021
2,599 posts | 762 followers
FollowElastic and secure virtual cloud servers to cater all your cloud hosting needs.
Learn MoreLearn More
An encrypted and secure cloud storage service which stores, processes and accesses massive amounts of data from anywhere in the world
Learn MoreMore Posts by Alibaba Clouder