Deployment
System Requirements
AgensGraph requires at least 4GB of RAM and 2.5GB of disk space to run. It may run on any general Unix-compatible platforms, but the officially-certified platforms are Linux series (Centos, Ubuntu, RHEL) and Windows series (Windows Server 2008 64bits, Windows Server 2012 64bits, Windows 7 64bits).
Pre-install tasks
User account
Like other externally-accessible server daemons, it is recommended to run AgensGraph with a separate user account. If you are on Unix-compatible platforms, you can add a user account using useradd
or adduser
command.
useradd agens
Kernel resource management
Single instance install
There are two ways to install AgensGraph. You can download the binary from the official website and download the source code and build/install it. Either way, we recommend that you work with an account for managing AgensGraph.
Installing via binary download
Download the binary or installer suitable for your operating system from S/W Download menu of official AgensGraph website.
Linux
Linux binaries are compressed with tarball. After unzipping them to the desired location, perform the post-installation task to complete the installation.
Windows
Coming soon.
Installation by Source Code Build
Connect to github of AgensGraph and clone the source code.
git clone https://github.com/skaiworldwide-oss/agensgraph.git
Move to the clone location and run configure on the source tree. At this time, you can set the location where AgensGraph will be installed via
--prefix=/path/to/install
.
./configure
Perform a build.
make install
Install the extension module and binaries.
make install-world
Post-Installation Tasks (Linux)
In the case of Unix series and Linux, if you do not register an environment variable, you will not be able to read/activate the installed libraries properly, and you will have to enter the absolute path when making a call. The above problem can be prevented by adding an environment variable to bash_profile of the user with AgensGraph installed as follows:
export AGHOME=/path/to/AgensGraph
export AGDATA=/path/to/AgensGraph /data
export PATH=$AGHOME/bin:$PATH
export LD_LIBRARY_PATH=$AGHOME/lib:$LD_LIBRARY_PATH
Environment |
Description |
---|---|
AGHOME |
This is the directory where AgensGraph is installed. |
AGDATA |
Location of the data directory |
PATH |
Set $AGHOME/bin as the directory path to use AgensGraph. |
LD_LIBRARY_PATH |
This is the path where the shared library needed for using AgensGraph is located. Set $AGHOME/lib. |
Operations
initDB
To run AgensGraph, you need to initialize the database storage area using initdb. Such an area is called a database cluster, which is a collection of databases managed by a single instance of a running database server. A database cluster consists of a single directory where all the data is stored. From the file system perspective, it is considered a data directory or a data area. You can set where to store this data with -D option.
initdb -D /home/agensgraph/data
Or, you can initialize the database storage area using ag_ctl.
ag_ctl initdb -D /home/agensgraph/data
initdb creates a directory if the specified directory does not exist, and denies execution if it is already initialized.
Create a role
Roles can be considered a database user or a group of database users, depending on how the database is set up. As a role can own a database object, it may assign permissions for the object to other roles to control who can access the object. As the membership of a role can be granted to other roles, you may make the member role use the permissions assigned to other roles. To create/delete a role, you should use the following SQL command.
db=# CREATE ROLE name;
db=# DROP ROLE name;
For your convenience, createuser and dropuser can be invoked from the shell command line (serving as the wrapper of SQL commands).
createuser name
dropuser name
createdb
To create/remove a database, start the AgensGraph server and create it using SQL commands CREATE DATABASE and DROP DATABASE.
db=# CREATE DATABASE name;
db=# DROP DATABASE name;
The current role that has performed CREATE DATABASE automatically becomes the owner of the new database.
For your convenience, you may create/remove databases by calling createdb and dropdb from the shell command line. You may use -O option to designate the owner of the new database that you are creating.
createdb dbname [-O rolename]
dropdb dbname
Startup
You should start the database server before accessing the database using ag_ctl. You need an initialized database repository to start, and have to specify the corresponding directory with -D
option. If you set the database repository location via AGDATA
, an environment variable, you may start the server without -D
option. Using -l
option, you may set logfile that will contain logs.
ag_ctl start [-D /home/agensgraph/data] [-l /home/agensgraph/data/logfile]
Shutdown
There are several ways to terminate AgensGraph. You may control the types of termination depending on which signal is sent to the master process.
Mode |
Description |
---|---|
SIGTERM |
Smart shutdown mode. The server does not allow any new connections, but waits for the old session to terminate normally before shutdown. |
SIGINT |
Fast shutdown mode. The server does not allow any new connections, and aborts/terminates transactions for all existing processes. |
SIGQUIT |
Immediate shutdown mode. The server terminates all child processes. |
You can terminate ag_ctl with -m option as follows (unless -m is specified, the default is smart):
ag_ctl stop [-D DATADIR] -[m smart|fast|immediate]