Create and configure database cluster

Execute the following steps to configure a database cluster, which is required for hosting PostgreSQL databases. If you intend to manage several ImageMaster databases, it is convenient to already set the basic parameters for locales and encodings in the cluster as illustrated below.

If databases for other applications than ImageMaster are already managed in an existing cluster, where you only want to add an ImageMaster database, you can also rely on the encoding settings of the dedicated ImageMaster database, which are set redundantly by the scripts during database creation in chapter  Create ImageMaster database with ImageMaster 9 model.

  1. Sudo into the “postgres” system account:

    sudo su - postgres

  2. Create a database cluster:

    With the command “initdb” create a database cluster with UTF8 encoding and with the same locale setting (see chapter Locale settings), as your application server:

    /usr/pgsql-12/bin/initdb \
      -D /var/lib/pgsql/12/data \
      -E UTF8 --locale=en_US.UTF8

  3. Configure access permissions for client authentication in the file “pg_hba_conf”:

    /var/lib/pgsql/12/data/pg_hba.conf

    The following example entry in this configuration file would allow all connections from all hosts. Use this for testing purposes but not in production environments:

    # TYPE  DATABASE     USER         ADDRESS                 METHOD

    host    all          all          0.0.0.0/0               md5

    For further details on configuration options see the PostgreSQL documentation [PgSQL Client Authentication].

  4. Check and adjust further options in the file “postgresql.conf”:

    /var/lib/pgsql/12/data/postgresql.conf

    • Enable support of prepared transactions by setting a value for “max_prepared_transactions” which must be at least the value of “max_connections”, e.g.:

      #

      # …

      max_connections = 100# (change requires restart)

      # …

       

      #temp_buffers = 8MB# min 800kB

      max_prepared_transactions = 200# zero disables the feature

      # (change requires restart)

      # Caution: it is not advisable to set max_prepared_transactions nonzero unless you actively intend to use prepared transactions.

    • Make sure that the value for “max_connections” (its default is 100) is sufficiently high in production environments.

    For testing purposes the value is OK, but in production environments with high load or lots of parallel processes, e.g. caused by ImageMaster FIS, a higher value can be required. (A general recommendation cannot be given, since the appropriate value depends on several aspects in the overall environment).