A database is more than just a place to store data. In today’s article we will make you learn about the basic to advance concepts of ArangoDB which is a multi-purpose open-source database with a flexible data model for documents, graphs, and key-values. Though it has its many features with Multi Model database support, extendable through Java Script, high performance and space efficiency, more over its easy to use with its graphical user interface. We can use ArangoDB as a database or as a combined database/application server because it can answer random HTTP requests directly. Let’s take a review at its major features before we start its installation and configurations.
- Easy to install and configure
- Integrated Application Servers
- Web based console and CLI commands
- Easy Administration and System Monitoring
- Multi Model Database Document, Graphs and Keys
ArangoDB Installation Setup
Now we will describe the steps to install ArangoDB under the Ubuntu 15.04 Operating system. So, first of all we will download the corresponding debian package from the official web link to Arangodb download page. After setting up its repository we will be able to install ArangoDB easily with debian package manager.
STEP 1: Adding repository key to Apt
Before the installation we need to add a particular repository key to apt according to our Operating system version.
For Ubuntu 15.04
Use following commands with root user or sudo privileges to get and add key.
[email protected]:~# wget https://www.arangodb.com/repositories/arangodb2/xUbuntu_15.04/Release.key
[email protected]:~# apt-key add - < Release.key [email protected]:~# echo 'deb https://www.arangodb.com/repositories/arangodb2/xUbuntu_15.04/ /' >> /etc/apt/sources.list.d/arangodb.list
For Ubuntu 14.04
Similar if you are using Ubuntu 14.04 you need to add following key wih root user.
[email protected]:~# wget https://www.arangodb.com/repositories/arangodb2/xUbuntu_14.10/Release.key
[email protected]:~# apt-key add - < Release.key [email protected]:~# echo 'deb https://www.arangodb.com/repositories/arangodb2/xUbuntu_14.10/ /' >> /etc/apt/sources.list.d/arangodb.list
STEP 2: Install ArangoDB
Now Update your system after adding key to apt and then start the installion with apt-get command.
For Ubuntu 15.04:
For Ubuntu 14.04:
STEP 3: Adding HTTPS Downloads Support
This is an optional package if we need to add the download support of HTTPS then we should install the following package.
ro[email protected]:~# apt-get install apt-transport-https
We had done with the basic installation packages now make sure that the ArangoDB service is running properly. We can check its status by following command.
[email protected]:~# systemctl status arangodb
Using ArangoDB Shell
ArangoDB shell is a command line administration of ArangoDB. We will use it to create new databases, users, collections and documents etc.
In next few we show you you can easily get fimilar with the ArangoDB Shell.
STEP 1: Open ArangoDB Shell
We can launch its shell by using following command.
STEP 2: ArangoDB Shell Help
We can get more detailed help of the command line administration of ArangoDB by using the following command.
arangosh [_system]> db._help();
STEP 3: Testing ArangoDB Shell Commands
With the help of arangoDb shell commands now we will create new database and user and check how it works with us.
Use following commands to create new database with its user and password:
arangosh [_system]> db._useDatabase('test')
arangosh [test]> require("org/arangodb/users").save("linux", "linux123");
ArangoDB Web Interface Setup
Before moving to Web interface, we need to setup its basic parameters and configurations to setup server's access point and authentication.
STEP 1: Testing ArangoDB HTTP API
Make sure that ArangoDB is up and running. this could be checked by executing the following curl command to get results from ArangoDB HTTP API.
[email protected]:~# curl http://localhost:8529/_api/version
STEP 2: Configure ArangoDB Endpoints
Open the configurations file to mention your servers IP as below both in the arangod.conf and arangosh.conf file.
[email protected]:~# vi /etc/arangodb/arangod.conf
endpoint = tcp://172.25.10.179:8529
[email protected]:~# vi /etc/arangodb/arangosh.conf
[server] endpoint = tcp://172.25.10.179:8529
STEP 3: Enable Authentication
Its a best practice to enable authentication of ArangoDB Web interface, by default it comes with disabled state. We can make it enable by changing its parameter from yes to no in its configuration file.
[email protected]:~# vi /etc/arangodb/arangod.conf
# disable authentication for the admin frontend
disable-authentication = no
After making changes to configuration file restart Arangodb Service.
[email protected]:~# systemctl restart arangodb.service
Using ArangoDB Web Interface
We are now ready to go with ArangoDB Web Interface, Open your web browser and access it with its configured end point server Ip and default port 8925.
Choosing from the top bar menu of Web Interface click on the drop down option to Manage DBs. Here we can see the previously created databases from the command line that we are now able to manage them from the web interface. Also we can switch to another database or we can delete or add new databases here.
Create New Database
We can add new database from the web interface as below by giving it a specific name, user and password.
ArangoDB Collections and Documents
Collections in ArangoDB are just like the tables where we will create new documents to place and manage our music libraries, users bio data or our books library.
Adding New Collection
Click to add new collection and fill out its name and type to save changes.
Creating New Document
If we click on the newly created collection, you will be able to see that there is no document present there. We can create new document under the same collection by pointing "+" sign on the top right side.
Adding Data to Document
After creating the document we will be able to see it under the contents. Now we will open up the document and put our relevant information to it. To do so click on the particular document and change editor mode from tree to Code to add data in it.
We can add JSON Objects to fill out information in the document as below.
"street": "Street of Happiness",
"city": "Heretown, The Earth"
Now after saving the code, once again switch editor mode from Code to Tree and see its out in human readable format.
Using Applications in ArangoDB
The fresh installation of ArangoDB comes with no application installed on it. We can install new applications from the web interface as well as from command line interface. We can install the applications under different mount paths and using different sources like Github, Store or from the Zipped package.
Adding New Application
From the Web interface we need to click on the Add Application and just mention its mount point and add other information as shown.
Managing New Applications
Using AQL Editor of ArangoDB
ArangoDB comes with AQL Editor that we can use for querying the data from the command line or by using its web interfac as its fully integrated with ArangoDB. From the AQL Editor we will be able to put queries and to get its results from the pre configured databases, collections and documents. So lets see how it works as below.
AQL Query Test
In order to test the EQL Editor we will submit a following query to check its results as below.
AQL Query Result
After we had submitted the query on EQL Editor, Click on Results to check its output as below.
Using ArangoDB Tools
ArangoDB comes with its built in tools that provides the facility to use JS Shell, APIs and with Users and Query management. Using its User management tool we can easily create new users with its user information, password and other current status.
We had done with the Installation of ArangoDB 2.2.5 version's on Ubuntu 15.04 by using its command line as well as Web interface for the administration of its databases in its unique way. So, ArangoDB is one of the best database administration tool because of its many supporting features.We had just covered the main installation steps in it with the overview of its all functional parameters.There are still alot of things that ArangoDB facilitates with us to do.