Version 6 (modified by pbaumann, 21 months ago) (diff)


Configuring PostgreSQL for use with rasdaman

This page describes how to configure an existing PostgreSQL installation for use with rasdaman. PostgreSQL can be used in conjunction with rasdaman for two purposes:

(more to come)

Basic configuration

To implement the geo semantics, petascope uses a relational database for the geo-related metadata. Currently, only PostgreSQL is supported; for the future, support of SQLite is planned (in parallel to the rasdaman array engine). This is how to set up PostgreSQL for use by petascope:

  1. Prepare postgres:
    # if postgres has not been initialized yet:
    sudo service postgresql initdb
    # you may need to allow trust-based access in PostgreSQL
    # NOTE: On Debian 8 this file is in /etc/postgresql/9.4/main/pg_hba.conf
    #       On CentOS 7 this file can be found in /var/lib/pgsql/data/pg_hba.conf
    editor /etc/postgresql/9.4/main/pg_hba.conf
    # add the below to the `pg_hba.conf` PostgreSQL configuration file (before the ident lines):
    # "local" is for Unix domain socket connections only
    local   all         all                               trust
    # IPv4 local connections:
    host    all         all          trust
    # IPv6 local connections:
    host    all         all         ::1/128               trust
    # reload PostgreSQL so that the new configuration will take effect
    sudo service postgresql reload

Database location

By default, PostgreSQL keeps the database in /var/lib/postgresql. In case of storing arrays inside the database, this directory may become massive, so at this step you may want to move it to another place.

Alternative PostgreSQL database location

Moving the database

By default postgresql keeps the database in /var/lib/postgresql/8.4/main/, to move it to another place (let's say /data/pgdata) follow the steps below.

  1. Stop postgresql
    service postgresql stop
  2. Create new directory for the postgres database\
    mkdir -p /data/pgdata
    chown postgres: /data/pgdata
  3. Edit postgres configuration file and change the 'data_directory' to point to /data/pgdata
    editor /etc/postgresql/8.4/main/postgresql.conf
    3.1. Option 1: initialize new data dir
    sudo -u postgres /usr/lib/postgresql/8.4/bin/initdb -D /data/pgdata
    3.2. Option 2: move your old directory to the new place
    mv /var/lib/postgresql/8.4/main/* /data/pgdata
  4. Link to ssl certificates
    ln -s /etc/ssl/certs/ssl-cert-snakeoil.pem /data/pgdata/server.crt
    ln -s /etc/ssl/private/ssl-cert-snakeoil.key /data/pgdata/server.key
    4.1 Or alternatively set ssl = false in postgresql.conf
  1. Start postgresql
    service postgresql start

Use a tablespace

Alternatively we can use a tablespace, and create RASBASE in that tablespace.

  1. Create new directory for the new tablespace:
    mkdir -p /data/pgdata
    chown postgres: /data/pgdata
  2. Create a rasdaman tablespace in postgres:
    sudo -u postgres psql -d postgres
    CREATE TABLESPACE rasdaman LOCATION '/data/pgdata';
  3. Patch the rasdaman script to use create the database in the new tablespace:
    sed -i 's/createdb $DATABASE_NAME/createdb $DATABASE_NAME -D rasdaman/' $RMANHOME/bin/