Installation
AgensGraph runs on Linux and Windows. There are two methods available to install AgensGraph: downloading the binary package or compiling the package from source code.
Installing AgensGraph on Linux
Installation of pre-built packages
Get the pre-compiled binary:
Visit the AgensGraph download page and download the corresponding version of AgensGraph.
Tip: If you do not know your system environment, you can use the command:
uname -sm
Extract the package:
Extract the downloaded file into a directory for your use (for example, /usr/local/AgensGraph/ on Linux)tar xvf /path/to/your/use
Note : If you want AgensGraph on other operating systems, please contact SKAI Worldwide’s support team.
Installation of build source code
Installing AgensGraph requires you to obtain and build the source code to properly configure the database cluster for graph operations. This guide provides a step-by-step procedure to get AgensGraph up and running on your system.
Prerequisites
Install the following essential libraries according to each OS.
Rocky Linux
dnf install gcc glibc glib-common readline readline-devel zlib zlib-devel flex bison
Fedora
dnf install gcc glibc bison flex readline readline-devel zlib zlib-devel
Ubuntu
sudo apt-get install build-essential libreadline-dev zlib1g-dev flex bison
Download the Source Code
Begin by downloading the AgensGraph source code. You can find the latest release on the official GitHub repository. Access the AgensGraph github and get the source code.
git clone https://github.com/skaiworldwide-oss/agensgraph.git cd agensgraph
Configure the Build
Go to the clone location and run configure on the source tree. The –prefix=/path/to/intall option allows you to set the location where AgensGraph will be installed.
./configure
Run the build.
make install
Install the extension module and binary
make install-world
Post-Installation Setup and Configuration
Environment variable setting (optional):
You can add these commands into a shell start-up file, such as the~/.bash_profile
.export LD_LIBRARY_PATH=/usr/local/AgensGraph/lib:$LD_LIBRARY_PATH export PATH=/usr/local/AgensGraph/bin:$PATH export AGDATA=/path/to/make/db_cluster
Creating a database cluster:
initdb [-D /path/to/make/db_cluster]
Starting the server:
ag_ctl start [-D /path/created/by/initdb/]
Creating a database:
createdb [dbname]
If dbname is not specified, a database with the same name as the current user is created, by default.
Execute the interactive terminal:
agens [dbname]
If the db_cluster directory is not specified with
-D
option, the environment variableAGDATA
is used.
Quick Start with Docker
Pull the AgensGraph Docker image
docker pull skaiworldwide/agensgraph
Note: By default, this pulls the
latest
tagCreate and run the AgensGraph container
docker run \ --name agensgraph \ -p 5455:5432 \ -e POSTGRES_USER=postgres \ -e POSTGRES_PASSWORD=agens \ -e POSTGRES_DB=agens \ -d \ skaiworldwide/agensgraph
Connect to AgensGraph client
docker exec -it agensgraph agens -d agens -U postgres
More Information
See more information on the Docker Hub page.
Configuring Server Parameters
In order to attain optimal performance, it is very important to set server parameters correctly according to the size of data and machine resources. Among many server parameters, the following parameters are crucial for AgensGraph graph query performance. (You can edit $AGDATA/postgresql.conf
file to set these parameters (restart required)).
shared_buffers: The size of memory for caching data objects. This parameter should be increased for the production environment. It is optimal when it is as large as the data size. But, this parameter should be set carefully considering concurrent sessions and memory size allocated for each queries. The recommended setting is half of the physical memory size.
work_mem: This should be also increased according to the size of physical memory and the properties of queries that will be executed carefully.
random_page_cost: This parameter is for query optimization. For graph queries, it is recommended to reduce this value to 1 or 0.005 (in case graph data is fully cached in memory).
For more information, you can refer to PostgreSQL documentation.