This document details the process for migrating to a new ChemLocator installation. If you have not installed ChemLocator yet on the destination, follow the installation guide.
The migration of the PostgreSQL database can be done using the official documented methods found here. Bellow we provide and example of running a backup for the current JPC container and when JPC is installed directly on server.
{info} NOTE: In case of PostgreSQL clusters please reffer to the official documentation regarding backup/restore of the databases.
For the backup and restore you will need postgre client tools provided by the official installers and if you are connecting from a different machine other than localhost (in case of Docker containers) make sure that the versons match (if the server is PostgreSQL 12 the client tools have to be from version 12 as well) and that access is allowed by adding the IP in _pghba.conf file.
Navigate to the folder where the output of the backup should be saved; make sure that enough disk space is available for saving the database dump. The size of the database: psql --dbname=postgresql://postgres:postgres@localhost:5432/chemlocator -c "SELECT pg_size_pretty( pg_database_size('chemlocator') );"
, but in general the size of the backup should not exceed the size of the database on disk.
To start the database backup we will be using _pgdump command and specify the connection information to the database:
pg_dump -Fc --encoding=UTF-8 --dbname=postgresql://postgres:postgres@localhost:5432/chemlocator > chemlocator_psql.back
After running the command, when it finishes a file called _chemlocatorpsql.back will be created containing the database information.
For the purpose of this example we assume that the backup file was copied to the destination server and that postgre client tools are available on the server.
On the destination server the database needs to be created by running following commands:
psql --dbname=postgresql://postgres:postgres@localhost:5432/postgres -c "CREATE DATABASE chemlocator;"
psql --dbname=postgresql://postgres:postgres@localhost:5432/chemlocator -c "CREATE EXTENSION chemaxon_type;"
psql --dbname=postgresql://postgres:postgres@localhost:5432/chemlocator -c "CREATE EXTENSION hstore;"
psql --dbname=postgresql://postgres:postgres@localhost:5432/chemlocator -c "CREATE EXTENSION chemaxon_framework;"
After the above commands are ran, for the restore we will use _pgrestore command:
pg_restore -v -d chemlocator --dbname=postgresql://postgres:postgres@localhost:5432/chemlocator chemlocator_psql.back
If there is no snapshot repository you can create one by using Kibana or by using curl to make calls directly to the Elasticsearch API:
Using Kibana:
Using curl:
curl -X PUT "localhost:9200/_snapshot/cl_backup?pretty" -H 'Content-Type: application/json' -d'
{
"type": "fs",
"settings": {
"location": "/es_backups"
}
}
'
{info} NOTE: For both scenarios, the location value should be part of the path defined in elasticsearch.yml configration file.
For more information please refer to the official documentation for Elasticsearch 7.10 found here.
Creating a snapshot can be done by calling the Elasticsearch API endpoints.
curl -X PUT "localhost:9200/_snapshot/cl_backup/snapshot_1?wait_for_completion=true&pretty"
Once the snapshot is finiished copy it over to the new Elasticsearch cluster, into the folder configured in elasticsearch.yml configration file.
To restore the snapshot, the easiest way is to use Kibana because you might want to exclude some of the indexes:
Start the restore process by clicking on the marked icon:
In first step of the restore, select the desired indexes:
For the next step, adjust the options as needed.
On this final step, click on Restore snapshot.
On the Restore Status tab the progress of the restore process can be monitored.
In order for the new server to be able to crawl incrementally, the paths for the content sources and documents must be updated. I order to do this the following commands must be run:
docker-compose up -d
)docker ps
to view the running containershub.chemaxon.com/cxn-docker-release/chemlocator:[version]
(e.g. hub.chemaxon.com/cxn-docker-release/chemlocator:3.3.15
)docker exec -it [CONTAINER ID] dotnet /app/ChemLocator.dll contentsource -m '{"id":1,"srcBase":"/basepath/data","destBase":"/newPath/data"}'
docker exec -it [CONTAINER ID] dotnet /app/ChemLocator.dll contentsource -l
After the data has been imported and migrated please test the data before rmeoving the source ChemLocator environment, the PostgreSQL dump file and Elasticsearch snapshots