Installation PostgreSQL (Ubuntu)

A Research Data Repository Service for Managing Metadata Documents based on JSON or XML.

Installation PostgreSQL (Ubuntu)

Prerequisites

Install PostgreSQL

# Install postgreSQL
user@localhost:/home/user/$sudo apt install postgresql
[...]
user@localhost:/home/user/$

Now postgreSQL is available on localhost via port 5432.

MetaStore

Setup Database 4 MetaStore

user@localhost:/home/user/$sudo -u postgres psql
psql (12.3 (Debian 12.3-1.pgdg100+1))
Type "help" for help.

postgres=# CREATE DATABASE metastore;
CREATE DATABASE
postgres=# CREATE USER metastore_admin WITH ENCRYPTED PASSWORD 'METASTORE_ADMIN_PASSWORD';
CREATE ROLE
postgres=# GRANT ALL PRIVILEGES ON DATABASE metastore TO metastore_admin;
GRANT
postgres=# \q
user@localhost:/home/user/$

Now postgreSQL is setup for MetaStore.

Setup MetaStore2 Microservice

For using this database the settings in ‘application.properties’ should look like this:

[...]
#spring datasource settings
spring.datasource.platform: postgres
spring.datasource.url: jdbc:postgresql://localhost:5432/metastore
spring.datasource.username: metastore_admin
spring.datasource.password: METASTORE_ADMIN_PASSWORD
spring.datasource.driverClassName: org.postgresql.Driver
spring.jpa.database: POSTGRESQL
spring.jpa.database-platform: org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto: update
[...]
NOTE
Make sure that database settings for h2 are disabled in ALL application.properties files!

Indexing-Service

Setup Database 4 Indexing-Service

NOTE
To avoid confusion create a separate user for each service.
user@localhost:/home/user/$sudo -u postgres psql
psql (12.3 (Debian 12.3-1.pgdg100+1))
Type "help" for help.

postgres=# CREATE DATABASE indexing;
CREATE DATABASE
postgres=# CREATE USER indexing_admin WITH ENCRYPTED PASSWORD 'INDEXING_ADMIN_PASSWORD';
CREATE ROLE
postgres=# GRANT ALL PRIVILEGES ON DATABASE indexing TO indexing_admin;
GRANT
postgres=# \q
user@localhost:/home/user/$

Now postgreSQL is setup for indexing-service.

Setup Indexing-Service Microservice

For using this database the settings in ‘application.properties’ should look like this:

[...]
#spring datasource settings
spring.datasource.platform: postgres
spring.datasource.url: jdbc:postgresql://localhost:5432/indexing
spring.datasource.username: indexing_admin
spring.datasource.password: INDEXING_ADMIN_PASSWORD
spring.datasource.driverClassName: org.postgresql.Driver
spring.jpa.database: POSTGRESQL
spring.jpa.database-platform: org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto: update
[...]
NOTE
Make sure that database settings for h2 are disabled in ALL application.properties files!

Manage PostgreSQL

To start/stop docker service afterwards use

user@localhost:/home/user/$sudo systemctl start postgresql
user@localhost:/home/user/$sudo systemctl stop postgresql

Backup PostgreSQL

# Backup metastore
user@localhost:/home/user/$sudo -u postgres pg_dump metastore > dump_metastore_`date +%Y_%m_%dt%H_%M`.sql"
# Backup indexing-service
user@localhost:/home/user/$sudo -u postgres pg_dump indexing > dump_indexing_`date +%Y_%m_%dt%H_%M`.sql"

More Information

« PREVIOUS NEXT »