Starting and Stopping HAWQ
In a HAWQ DBMS, the database server instances (the master and all segments) are started or stopped across all of the hosts in the system in such a way that they can work together as a unified DBMS.
Because a HAWQ system is distributed across many machines, the process for starting and stopping a HAWQ system is different than the process for starting and stopping a regular PostgreSQL DBMS.
object commands to start and stop HAWQ, respectively. These management tools are located in the
$GPHOME/bin directory on your HAWQ master host.
Initializing a HAWQ system also starts the system.
Do not issue a
KILL command to end any Postgres process. Instead, use the database command
When a HAWQ system is first initialized, it is also started. For more information about initializing HAWQ, see hawq init.
To start a stopped HAWQ system that was previously initialized, run the
hawq start command on the master instance.
You can also use the
hawq start master command to start only the HAWQ master, without segment nodes, then add these later, using
hawq start segment. If you want HAWQ to ignore hosts that fail ssh validation, use the hawq start
hawq start cluster command to start a HAWQ system that has already been initialized by the
hawq init cluster command, but has been stopped by the
hawq stop cluster command. The
hawq start cluster command starts a HAWQ system on the master host and starts all its segments. The command orchestrates this process and performs the process in parallel.
Stop the HAWQ system and then restart it.
hawq restart command with the appropriate
cluster or node-type option will stop and then restart HAWQ after the shutdown completes. If the master or segments are already stopped, restart will have no effect.
To restart a HAWQ cluster, enter the following command on the master host:
$ hawq restart cluster
Reload changes to the HAWQ configuration files without interrupting the system.
hawq stop command can reload changes to the
pg_hba.confconfiguration file and to runtime parameters in the
pg_hba.conf files without service interruption. Active sessions pick up changes when they reconnect to the database. Many server configuration parameters require a full system restart (
hawq restart cluster) to activate. For information about server configuration parameters, see the Server Configuration Parameter Reference.
Reload configuration file changes without shutting down the system using the
$ hawq stop cluster --reload
$ hawq stop cluster -u
Start only the master to perform maintenance or administrative tasks without affecting data on the segments.
Maintenance mode is a superuser-only mode that should only be used when required for a particular maintenance task. For example, you can connect to a database only on the master instance in maintenance mode and edit system catalog settings.
hawq starton the
$ hawq start master -m
Connect to the master in maintenance mode to do catalog maintenance. For example:
$ PGOPTIONS='-c gp_session_role=utility' psql template1
After completing your administrative tasks, restart the master in production mode.
$ hawq restart master
Incorrect use of maintenance mode connections can result in an inconsistent HAWQ system state. Only expert users should perform this operation.
hawq stop cluster command stops or restarts your HAWQ system and always runs on the master host. When activated,
hawq stop cluster stops all
postgres processes in the system, including the master and all segment instances. The
hawq stop cluster command uses a default of up to 64 parallel worker threads to bring down the segments that make up the HAWQ cluster. The system waits for any active transactions to finish before shutting down. To stop HAWQ immediately, use fast mode. The commands
hawq stop master,
hawq stop segment,
hawq stop standby, or
hawq stop allsegments can be used to stop the master, the local segment node, standby, or all segments in the cluster. Stopping the master will stop only the master segment, and will not shut down a cluster.
To stop HAWQ:
$ hawq stop cluster
To stop HAWQ in fast mode:
$ hawq stop cluster -M fast
For best results in using
hawq start and
hawq stop to manage your HAWQ system, the following best practices are recommended.
CHECKPOINTcommand to update and flush all data files to disk and update the log file before stopping the cluster. A checkpoint ensures that, in the event of a crash, files can be restored from the checkpoint snapshot.
Stop the entire HAWQ system by stopping the cluster on the master host.
$ hawq stop cluster
To stop segments and kill any running queries without causing data loss or inconsistency issues, use
immediatemode on the cluster:
$ hawq stop cluster -M fast $ hawq stop cluster -M immediate
hawq stop masterto stop the master only. If you cannot stop the master due to running transactions, try using
fastshutdown does not work, use
immediateshutdown with caution, as it will result in a crash-recovery run when the system is restarted.
$ hawq stop master -M fast $ hawq stop master -M immediate
If you have changed or want to reload server parameter settings on a HAWQ database where there are active connections, use the command:
$ hawq stop master -u -M fast
When stopping a segment or all segments, use
smartmode, which is the default. Using
immediatemode on segments will have no effect since segments are stateless.
$ hawq stop segment $ hawq stop allsegments
You should typically always use
hawq start clusteror
hawq restart clusterto start the cluster. If you do end up starting nodes individually with
hawq start standby|master|segment, make sure to always start the standby before the active master. Otherwise, the standby can become unsynchronized with the active master.