wiki:rasdamanStoragePostgreSQL

Version 4 (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)

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 create_db.sh script to use create the database in the new tablespace:
    sed -i 's/createdb $DATABASE_NAME/createdb $DATABASE_NAME -D rasdaman/' $RMANHOME/bin/create_db.sh