Create Directory Database

Creating a New Directory Database

Installing a new MOPS 4.0 system involves creating a new directory database. A script to create the directory database have been provided as create_directory_db.pgsql. This script is run using the PostgreSQL command line tool psql. If this tool is not already installed you should do so now. Refer to the general installation instructions when installing psql.

From a PowerShell command prompt in the folder of the above file to execute, run the below command:

psql --file create_directory_db.pgsql  postgres://{host}:{port} postgres
psql --file seed_directory_db.pgsql    postgres://{username}:{password}@{host}:{port}/{databasename}

Where:

  1. {host} is to be replaced by the node name of the postgres server.
  2. {port} is replace by the port number of postgresql server. PostgreSQL default is 5432 but the MOPS container installation is normally configured to expose the database on port 5434.
  3. postgres is the default postgres database administration account. You will be prompted for its password when running the command so you need to know it from when installing the database server.

NOTE: It is important that you run the command from PowerShell since scripts will invoke PowerShell for certain operations and will fail other wise.

The first script creates the database schema and the second adds metadata, display components, displays and dashboards.

Customizing the Database Setup

The file variables.pgsql may be updated to customize the database setup. It allow changing database and schema name as well as the user to be created for the database.

Example:

\set DIRDB_USER             u_dirdb
\set DIRDB_USER_PWD         {password}
\set DIRDB_NAME             dirdb
\set DIRDB_SCHEMA           directory
\set DIRDB_ENCODING         UTF8
\set DIRDB_CONNECTION_LIMIT 100
\set DIRDB_SCHEMA_VERSION   7

Do not alter DIRDB_ENCODING or DIRDB_SCHEMA_VERSION.