Requirements: have PostgreSQL and Java (at least version 8) installed.
Download jchem-psql .deb or .rpm package and run package installation and license file setting as required by your operating system.
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.
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):
com.chemaxon.jchem.psql.scheme=crdb
com.chemaxon.jchem.psql.crdb.sqlBuilderProvider=POSTGRESQL
com.chemaxon.jchem.psql.crdb.jdbcUrl=jdbc:postgresql://localhost:5432/jpc
com.chemaxon.jchem.psql.crdb.user=jpc
com.chemaxon.jchem.psql.crdb.password=jpc
com.chemaxon.jchem.psql.crdb.hazelcastConfigFile=/etc/chemaxon/hazelcast.xml
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.
Change the postgresql.conf
file:
listen_addresses = ‘*’
wal_level = replica
max_wal_senders = 10
hot_standby = on
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.
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.
Restart PostgreSQL server.
Init jchem-psql service:
sudo service jchem-psql init
Start jchem-psql service:
Requirements: have PostgreSQL and Java (at least version 8) installed.
Do the steps 1 to 4 the same way as in the master setup.
Change the postgresql.conf
file:
listen_addresses = ‘*’
recovery_target_timeline = ‘latest’
hot_standby = on
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 172.31.1.8 -X stream -c fast -R
Restart PostgreSQL server.
Start jchem-psql service:
sudo service jchem-psql start