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.
Installation of pre-built packages
Installing AgensGraph on Linux
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
Access the AgensGraph github and get the source code.
git clone https://github.com/skaiworldwide-oss/agensgraph.git
Install the following essential libraries according to each OS.
CENTOS
yum 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
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
-Doption, the environment variableAGDATAis used.
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.