The zendhqctl database Module
The zendhqctl database command is used to test and migrate ZendHQ databases of your ZendHQ installation. Use cases of these database commands are database migration and disaster recovery. For more usage information and warnings, see ZendHQ Database Configurations.
zendhqctl database configuration
The command zendhqctl
needs access to the ZendHQ database without running the ZendHQ daemon.
By default, the command uses the default ZendHQ configuration file ${INSTALL_PREFIX}/etc/zendhqd.ini
for the database configuration.
If you are using a different ZendHQ configuration file, specify the name of the file with the -c, --config-file your_path
command-line argument, or with the ZENDHQ_CONFIG_FILE
environment variable.
For example:
zendhqctl -c /opt/zend/zendphp/etc/zendhqd_current.ini module ...
Or:
export ZENDHQ_CONFIG_FILE=/opt/zend/zendphp/etc/zendhqd_current.ini zendhqctl module ...
Replace module ... by, for example, database migrate
and so on, to use database commands.
Commands
- test
Tests the current database configuration. - migrate
Migrates data to the new database.
The test
command
zendhqctl database test [-t|--table-prefix prefix]
Use this command to test the database configuration by opening the connection,
creating a test table prefix_test
, inserting data into the table, and then dropping the table. The default test table prefix is zendhqctl
.
- -t or --table-prefix
(Optional) Define a custom table prefix for the test table.
The migrate
command
zendhqctl database migrate [-y|--yes] [-k|--keep-migration-file] FROM [TO]
Use this command to migrate the ZendHQ database from the existing database engine configured in FROM
to the new ZendHQ database configured in the main ZendHQ configuration file or a custom location.
- FROM
The path to the existing database engine to migrate. For example,
/opt/zendhqd_sqlite.ini
. - TO
(Optional) A new custom path where to store the new ZendHQ database.
- -y or --yes
(Optional) Automatically answer
yes
to all prompts. Useful for a silent installation. - -k or --keep-migration-file
(Optional) Keep the temporary migration file.
For example, to migrate data from the existing SQLite database configured in /opt/zend/zendphp/etc/zendhqd_sqlite.ini
:
zendhqctl database migrate /opt/zend/zendphp/etc/zendhqd_sqlite.ini