What is ArangoDB?
ArangoDB is a high availability and scalable multi-model NoSQL database that natively works with graphs and documents and includes a full-text search. It is a free, open-source software developed and maintained by ArangoDB GmbH. The system supports three different data models with one database core and includes a unified query language called AQL (ArangoDB Query Language). This query language is declarative and allows the combination of different data access patterns in a single query. The software can be implemented on multiple systems, including Windows, macOS, Linux, Kubernetes, Docker, and on our Managed Cloud. It has a strong community support base on GitHub, StackOverflow, Google Groups, and Slack.
There are two versions of the ArangoDB software available:
- Community version
- Enterprise version
The community edition offers the following functionality options.
- Multi-Model: Data modeling to suit your application, including documents, graphs and key-value pairs
- Joins: Employ joins for flexible, ad-hoc querying, which means less data redundancy.
Typically, the enterprise edition has more available options regarding security and scalability. The chart below notes the main differences.
In this tutorial, we will be installing the community version of the software.
Below are the requirements for this software install:
- An LW instance of an Ubuntu Server 20.04 LTS.
- Access to the root user account or a user with sudo privileges.
How to Install ArangoDB
The installation process itself is typical and straightforward in regard to a standard apt-based software installation. To begin the process, we will add the ArangoDB GPG repository security key. This key verifies the file download has not been altered or tampered with in any way.
root@host:~# wget -q https://download.arangodb.com/arangodb34/DEBIAN/Release.key -O- | apt-key add -
Next, we will add the repository to our sources using this command.
root@host:~# echo 'deb https://download.arangodb.com/arangodb34/DEBIAN/ /' | tee /etc/apt/sources.list.d/arangodb.list
Now, update apt to refresh the available software using this command.
root@host:~# apt-get update
We then install the apt-transport-https software dependency. The apt-transport-https package enables the usage of https via the package manager using the libapt-pkg library. This keeps the installation secure. Use the below command.
root@host:~# apt-get -y install apt-transport-https
Next, we can install the ArangoDB software.
root@host:~# apt-get -y install arangodb3=3.7.6-1
During the setup, we are asked if we want to upgrade the database files automatically. Select “Yes.” This setting intimates that any new software updates are automatically completed rather than needing manual intervention from a user.
Next, we are prompted to select the type of database storage engine we would like to use. Select Auto here. The alternatives are rocksdb or mmfiles.
Finally, select “Yes” to back up any existing database before any upgrades are made to the ArangoDB software. These backups are stored in the /var/lib/arrangodb-$date folder.
The installation will now proceed and complete quickly. When you return to the command prompt, the installation is complete.
Install Debug Package
We also have the option to install the debug symbols package (which is not required by default). The debug symbols package troubleshoots database crashes. It writes the necessary crash information to a log file along with the backtrace to the call site. This backtrace info can be sent to ArangoDB support for further examination and review. These backtraces are only applicable if the debug symbols package has been installed.
To deploy this software, run the following command.
root@host:~# apt-get install arangodb3-dbg=3.7.6-1
Accessing the ArangoDB Shell
There are several methods to start the ArangoDB software. The specific start-up command will depend on your Linux distribution and the type of ArangoDB implementation you choose (e.g., Single Server, Master-Slave, Active Failover, Cluster, DC2DC).
To begin working within the ArangoDB shell, run the following command.
We are then prompted to enter the admin password created during the installation process. Once authenticated, the ArangoDB shell will appear (which is similar to a MySQL shell), where you can begin managing your databases.
Secure the Installation
During the next phase of the setup, we will establish a new admin password for ArangoDB. In the installation process, we are asked to supply a strong password. Type in a password and then retype the password again to proceed.
root@host:~# shell> arangosh --server.username "root@mydatabase" --server.database mydatabase
The ArangoDB software allows us to restrict the access of our databases to specific users. A default “root” user is created during the installation process, which can access all the databases. As a best practice, we should make a user who has access rights for each application database. It should be noted that all users are considered administrators of the database system.
To create a new database and user, we employ the arangosh command. The arangosh command creates a synchronous shell used for interacting with the server on the command line.
root@host:~# arangosh> db._createDatabase("mydatabase"); root@host:~# arangosh> var users = require("@arangodb/users"); root@host:~# arangosh> users.save("root@mydatabase", "password"); root@host:~# arangosh> users.grantDatabase("root@mydatabase", "mydatabase");
Now we can connect to the database with the user root@mydatabase.
Next, to start and enable the ArangoDB service, run the following commands.
root@host:~# systemctl start arangodb3 root@host:~# systemctl enable arangodb3
Working with ArangoDB
Create a New Database
To create our first database, run the following command.
root@host:~# >shell db._createDatabase("newlwdb");
Create a New User
Next, we will create a new user to access the above database using the following commands.
root@host:~# >shell var users = require("@arangodb/users"); root@host:~# >shell users.save("lwuser@localhost", "PASSWORD"); root@host:~# >shell users.grantDatabase("lwuser@example", "newlwdb"); root@host:~# >shell where PASSWORD is a strong/unique password.
Now, we can verify our new database was created by using this command.
root@host:~# >shell db._databases()
You should see ‘newlwdb’ returned.
To leave the shell, use the ‘Exit’ command. To reconnect, utilize the new user and database with the following command.
root@host:~# >shell arangosh --server.username “lwuser@localhost" --server.database newlwdb
ArangoDB also provides a web-based interface (code name Aardvark) for fundamental database interactions. It allows us to manage the following tasks.
Additionally, we can run and explain queries more expediently. Database statistics and the server status are provided as well. This web interface is available after the arangod process is started.
Access the Database
We can access this interface in our browser via http://ip:8529. The default user for the interface is root, and authentication is enabled implicitly.
Once logged in, the user will ask which database to employ. By default, the installation contains a _system database. Choose this database to continue into the web interface.
The dashboard is presented showing the server statistics
The dashboard interface will differ for standalone instances vs a clustered setup. The Standalone interface will appear like so.
The Cluster dashboard view will look like this.
There are many more features available in the ArangoDB dashboard which can be found on the software's website.
Below are basic command line client tools used within the ArangoDB:command line environment.
- Arangodump: This command creates backups of the data and structures stored in an ArangoDB.
- Arangorestore: This is the command used to restore backups created by using the Arangodump command.
- Arangoimport: This command is used to import data in the JSON, CSV, and TSV formats into the ArangoDB server.
- Arangoexport: This command is used to export data from an ArangoDB server to JSON, CSV, or XML formats.
- Arangobench: This is a testing and benchmarking tool used with the ArangoDB software. It is used to send test requests to a database to measure performance and server functions.
- Arangoinspect: This command collects information on the ArangoDB server setup to facilitate troubleshooting for the ArangoDB support.
The ArangoDB database has two main modes of operation:
- Server mode — This mode will answer client requests.
- Emergency mode — In this mode, ArangoDB uses a console to enter the database immediately in the case of an emergency (e.g., for a corrupted database). The emergency console lets us issue all standard commands. However, in this mode, the server cannot handle any client requests.
Typically, there will be no need to access the emergency console unless you are a developer.
ArangoDB is a free software that is an open-source, multi-model database system that is considered by many to be an optimal framework for flexible data modeling, including documents, graphs, and other key-values.
We pride ourselves on being The Most Helpful Humans In Hosting™!
Liquid Web Support can answer many questions related to database creation and usage. We have intimate knowledge of multiple web hosting technologies, especially those discussed in this article. If you have any questions regarding this tutorial, we are available 24 hours a day, 7 days a week 365 days a year.
If you are a Fully Managed VPS server, Cloud Dedicated, VMWare Private Cloud, Private Parent server, Managed Cloud Servers, or a Dedicated server owner and you are uncomfortable with performing any of the steps outlined, we can be reached via phone at @800.580.4985, a chat or support ticket to assisting you with this process.
Our Sales and Support teams are available 24 hours by phone or e-mail to assist.