JPC HA Installation Guide

    Installation on master

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

    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):

      1. com.chemaxon.jchem.psql.scheme=crdb

      2. com.chemaxon.jchem.psql.crdb.sqlBuilderProvider=POSTGRESQL

      3. com.chemaxon.jchem.psql.crdb.jdbcUrl=jdbc:postgresql://localhost:5432/jpc

      4. com.chemaxon.jchem.psql.crdb.user=jpc

      5. com.chemaxon.jchem.psql.crdb.password=jpc

      6. com.chemaxon.jchem.psql.crdb.hazelcastConfigFile=/etc/chemaxon/hazelcast.xml

    4. Add the file hazelcast.xml to the /etc/chemaxon/ directory.

      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. To change behavior modify the network settings in the file.

    5. Change the postgresql.conf file:

      1. listen_addresses = ‘*’

      2. wal_level = replica

      3. max_wal_senders = 10

      4. 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

    10. 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:

      1. listen_addresses = ‘*’

      2. recovery_target_timeline = ‘latest’

      3. 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:

      1. sudo su postgres

      2. rm -rf /var/lib/postgresql/12/main

      3. pg_basebackup -D /var/lib/postgresql/12/main -h 172.31.1.8 -X stream -c fast -R

    4. Restart PostgreSQL server.

    5. Start jchem-psql service:

      sudo service jchem-psql start