mercury-cmd: administrative commands and backup of the Lucene index
mercury-cmd runs the administrative commands of the server: generating and checking the Lucene index, reindexing, encoding passwords, testing database connections, calibrating the query optimizer and, through REST, the backup and restore of the Lucene index. This article describes how to run it, how to configure it, all its commands and how the backup works.
Running
mercury-cmd.sh --help # list of the commands
mercury-cmd.sh <command> --help # help of one command
mercury-cmd.sh --version
mercury-cmd.sh <command> [arguments and options]
- Every command has a long name (
generate-lucene) and a short alias (gl). The older form with a leading dash (-gl) no longer works: the name of the command is the first argument, without a dash. - The option
-Dkey=valuesets a JVM system property for the command, before or after the name of the command (for example-Dmercury.lucene.config.file=lucene.properties). - The scripts are in the directory
binof the installation package; they find the installation directory themselves and read the configuration from../config. In the Docker image of the server the scripts are in/opt/mercury-3.0/bin, so a command can be run withdocker exec <container> /opt/mercury-3.0/bin/mercury-cmd.sh ....
Exit codes
| Code | Meaning |
|---|---|
0 | success |
1 | error of the operation (configuration, login, a response of the server, a transfer error, a timeout) |
2 | wrong arguments (the help or the reason is printed) |
The commands that start the application context of the server (generate-lucene, reindex-cases and the like) print Operation finished without errors. and, when the process stays alive, Please press 'Ctrl+C' to finish process. Scripts rely on these English lines, so they are not translated.
Language
The help and the messages are printed in the first language that is set in this order:
- the option
--lang <code>(for example--lang de), - the environment variables
LC_ALL,LC_MESSAGES,LANG(for examplepl_PL.UTF-8;CandPOSIXmean English), - the language of the JVM,
- English.
The scripts of the installation package set LANG and LC_ALL to pl_PL.UTF-8; change them in the script or give --lang.
Configuration: config/commandLine.properties
| Property | Meaning |
|---|---|
mercury.config.file, sclogger.config.file, mercury.lucene.config.file | Locations of the configuration files of the server (by default in ../config) |
mercury.lucene.build.threads, mercury.lucene.build.pageSize | Number of threads (default 10) and size of the page (default 100) when the index is generated |
mercury.cmd.jms.brokerURL | Address of Apache ActiveMQ (for example tcp://localhost:61616) |
mercury.cmd.db.default.url, .dbUser, .dbPassword | The main database (offline commands) |
mercury.cmd.db.common.url, .dbUser, .dbPassword | The common database |
cmis.integration | true enables the commands that need the CMIS repository (sync-types) |
mercury.cmd.rest.url | Address of the server application for the commands that call REST, for example http://localhost:8080/mercury-ws-app |
mercury.cmd.rest.node | Name of the cluster node that should do the operation (the option --node has priority) |
mercury.cmd.rest.url.<node> | Address of the given node (for example mercury.cmd.rest.url.node1) |
mercury.cmd.rest.clientId, mercury.cmd.rest.clientSecret | Data of the OAuth client (client_id and client_secret) used to log in |
The passwords and the secrets can be written in plain text or encoded with the command ep (mercury-cmd.sh ep 'my password' prints the value to paste into the file).
mercury.cmd.db.default.url=jdbc:postgresql://localhost:5432/mercury-db
mercury.cmd.db.default.dbUser=mercury
mercury.cmd.db.default.dbPassword=-9f9cc3fdab740a564265f4892564719
mercury.cmd.rest.url=http://localhost:8080/mercury-ws-app
mercury.cmd.rest.clientId=GIUPortalClient
mercury.cmd.rest.clientSecret=<the secret of the client, plain or encoded with ep>
Commands of mercury-cmd
| Command | Alias | What it does |
|---|---|---|
encode-password <password> | ep | Encodes a password for a configuration file |
sync-types | ts | Synchronizes the document types with the document repository (needs the CMIS integration) |
generate-lucene <Case|GroupCase> [--threads n] | gl | Generates the Lucene index of an entity |
validate-entities <Case|GroupCase> [--threads n] | vl | Validates an entity: builds the index without saving it |
reindex-cases <fromScn> [<toScn>] | ric | Indexes the cases again, starting after the given archive SCN number (the case with this number is not included) up to toScn (default: no limit) |
reload-predefined | rpd | Reloads the predefined parameter definitions |
jdbc-test | jdbctest | Tests the connections to the SQL databases |
lucene-calibration [options] | lc | Calibrates the query optimizer of Lucene, see Calibrating the Lucene query optimizer |
index-backup [options] | ib | Orders the server to create a backup of the Lucene index of cases |
index-restore [--backup-id id] [options] | ir | Orders the server to restore the index from a backup (the latest by default) |
index-backups [options] | ibs | Lists the backups kept by the server and shows the state of a running operation |
The Docker start script of the server uses ep and generate-lucene Case.
mercury-cmd.sh ep 'my password'
mercury-cmd.sh gl Case --threads 8
mercury-cmd.sh ric 58305
mercury-cmd.sh lc --generate 40 --out /tmp/calibration
Backup and restore of the Lucene index
The commands index-backup (ib), index-restore (ir) and index-backups (ibs) are only a proxy: they call the REST service of the server, and the server makes the copy and restores the index. They are described, together with the options, the logging in, the choice of the node in a cluster and the way the server works, in the article Backup and restore of the Lucene index.
See also: Backup and restore of the Lucene index, mercury-transfer.