JPC HA Installation Guide

    Simple JChem PostgreSQL Cartridge highly available step by step setup (as of 2021 December) is available here. It does not contain any specific configuration related to database size (e.g. number of structures), or performance tuning. Use it as a starting point for highly available setup followed by custom settings.

    General HA installation guide

    Installation on master

    Requirements: have PostgreSQL and Java installed. (See JChem PostgreSQL Cartridge requirements.)

    1. Download jchem-psql .deb or .rpm package and run package installation and license file setting as required by your operating system.

    2. Add a user that is going to have access and a database that stores the JPC index data (in our example both are jpc ) to the PostgreSQL database.

    3. Before running service init set the following parameter values in the /etc/chemaxon/jchem-psql.conf file (URL, user and password should be modified according to your JPC index data user and database created beforehand):

    4. The file hazelcast.xml should be already available in the /etc/chemaxon/ directory. (If not, you can download it from here. In the given file hazelcast discovery is set to TCP/IP, which means that hazelcast instances that are listed with their IP address in the member list will find each other and form a cluster. Change the IP addresses to your current cluster (master and slave) IP address.


      To change hazelcast behaviour modify the network settings in the file.

    5. Change the postgresql.conf file:

      listen_addresses = ‘*’
      wal_level = replica
      max_wal_senders = 10
      hot_standby = on
    6. Set up synchronization mode to synchronous or asynchronous by setting the parameters synchronous_commit and synchronous_standby_names . To make it synchronous set synchronous_commit to on and synchronous_standby_names to a valid value different than empty string, we tried ‘*’ which means that all slaves will have synchronous commits. By setting synchronous_commit to off or setting synchronous_standby_names to empty string the commits become asynchronous.

    7. Set up the allowed replication connections in the pg_hba.conf file as required in your system so that the slave PostgreSQL node can reach the master.

    8. Restart PostgreSQL server.

    9. Init jchem-psql service:

      sudo service jchem-psql init
    1. Start jchem-psql service:
      sudo service jchem-psql start

    Installation on slave

    Requirements: have PostgreSQL and Java (at least version 8) installed.

    1. Do the steps 1 to 4 the same way as in the master setup.

    2. Change the postgresql.conf file:

      listen_addresses = ‘*’
      recovery_target_timeline = ‘latest’
      hot_standby = on
    3. Setup replication of the master as postgres user by deleting PostgreSQL data directory (make sure that no data gets lost!) and setting up the replication:

      sudo su postgres
      rm -rf /var/lib/postgresql/12/main
      pg_basebackup -D /var/lib/postgresql/12/main -h -X stream -c fast -R
    4. Restart PostgreSQL server.

    5. Start jchem-psql service:

      sudo service jchem-psql start