DEV Community

Tito Osadebey
Tito Osadebey

Posted on • Updated on

Getting Started with Apache AGE: A Comprehensive Guide (Part 1)

Introduction

In this guide, we will walk through everything you need to know to get started with Apache AGE. Whether you’re an experienced graph database user or you’re just starting out, this guide will provide you with a detailed process to working with Apache AGE. In this first part, we’ll cover the introduction and installation of Apache AGE. By the end of this tutorial, you should have a deep understanding of Apache AGE and have it installed.

What is Apache AGE?

AGE Logo

Apache AGE is an open-source graph database management system that provides a powerful and scalable solution for storing, managing and analyzing large-scale graph data. It is built as an extension of PostgreSQL and supports complex graph queries and provides fast query response times, making it an excellent choice over traditional relational database management systems. With Apache AGE, users can gain deeper insights into data and make more informed decisions. Apache AGE is a tool you won’t want to overlook as a developer, data scientist or graph expert.

Setting up and Installation

Apache AGE is built as an extension to PostgreSQl. Hence, you should have either PostgreSQL 11 or 12 installed on your device (AGE is only compatible with these versions as of the time of this post).
For a step-by-step guide to install the required version, click here.
With PostgreSQL installed, follow the steps below to install AGE:

1. Clone the AGE repository in the same directory where you installed PostgreSQL.

git clone https://github.com/apache/age.git
Enter fullscreen mode Exit fullscreen mode

2. Move into the repository and change the branch to the latest version which is v1.1.0.

cd age
git checkout release/PG12/1.1.0
Enter fullscreen mode Exit fullscreen mode

3. Make PG_CONFIG an environment variable and install.

export PG_CONFIG=/usr/local/pgsql-12/bin/pg_config
Enter fullscreen mode Exit fullscreen mode

Or

sudo make PG_CONFIG=/usr/local/pgsql-12/bin/pg_config install
Enter fullscreen mode Exit fullscreen mode

After installation, we initialize a database cluster to set up AGE on PostgreSQL.

initdb age_test
Enter fullscreen mode Exit fullscreen mode

Next, we start a server.

pg_ctl -D age_test -l logfile start
Enter fullscreen mode Exit fullscreen mode
createdb age_testdb
Enter fullscreen mode Exit fullscreen mode

Start up PostgreSQL, create the extension, load the extension and set the search_path.

psql age_testdb
Enter fullscreen mode Exit fullscreen mode
CREATE EXTENSION age;
LOAD ‘age’;
SET search_path = ag_catalog, “$user”, public;
Enter fullscreen mode Exit fullscreen mode

After initializing a DB, the AGE extension has to be loaded to start using it. This can be set in the postgresql.conf located in the DB directory which will make AGE load automatically and also set the search_path.
To view installed extensions:

\dx
Enter fullscreen mode Exit fullscreen mode

If age is listed, then it has been successfully installed.

Conclusion

Setting up Apache AGE is just the first step in unlocking the power of graph data analytics. With Apache AGE, we can create complex graphs, store, manage, and query large-scale graph data with ease. As we move forward in this guide, we will explore the advanced features of Apache AGE and how to use this powerful system efficiently. In the next part, we would look at creating and analyzing graphs.

References
Apache AGE website
Apache AGE project

Top comments (0)