Starting and Stopping Greenplum Database
A newer version of this documentation is available. Use the version menu above to view the most up-to-date release of the Greenplum 6.x documentation.
Starting and Stopping Greenplum Database
In a Greenplum Database 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 Greenplum Database system is distributed across many machines, the process for starting and stopping a Greenplum Database system is different than the process for starting and stopping a regular PostgreSQL DBMS.
Use the gpstart and gpstop utilities to start and stop Greenplum Database, respectively. These utilities are located in the $GPHOME/bin directory on your Greenplum Database master host.
Issuing a kill -9 or kill -11 can introduce database corruption and prevent root cause analysis from being performed.
For information about gpstart and gpstop, see the Greenplum Database Utility Guide.
Starting Greenplum Database
Start an initialized Greenplum Database system by running the gpstart utility on the master instance.
$ gpstart
Restarting Greenplum Database
Stop the Greenplum Database system and then restart it.
$ gpstop -r
Reloading Configuration File Changes Only
Reload changes to Greenplum Database configuration files without interrupting the system.
$ gpstop -u
Starting the Master in Maintenance Mode
Start only the master to perform maintenance or administrative tasks without affecting data on the segments.
Stopping Greenplum Database
Stopping Client Processes
Greenplum Database launches a new backend process for each client connection. A Greenplum Database user with SUPERUSER privileges can cancel and terminate these client backend processes.
Canceling a backend process with the pg_cancel_backend() function ends a specific queued or active client query. Terminating a backend process with the pg_terminate_backend() function terminates a client connection to a database.
- pg_cancel_backend( pid int4 )
- pg_cancel_backend( pid int4, msg text )
- pg_terminate_backend( pid int4 )
- pg_terminate_backend( pid int4, msg text )
If you provide a msg, Greenplum Database includes the text in the cancel message returned to the client. msg is limited to 128 bytes; Greenplum Database truncates anything longer.
The pg_cancel_backend() and pg_terminate_backend() functions return true if successful, and false otherwise.
=# SELECT usename, pid, waiting, state, query, datname FROM pg_stat_activity;
Sample partial query output:
usename | pid | waiting | state | query | datname ---------+----------+---------+--------+------------------------+--------- sammy | 31861 | f | idle | SELECT * FROM testtbl; | testdb billy | 31905 | t | active | SELECT * FROM topten; | testdb
Use the output to identify the process id (pid) of the query or client connection.
For example, to cancel the waiting query identified in the sample output above and include 'Admin canceled long-running query.' as the message returned to the client:
=# SELECT pg_cancel_backend(31905 ,'Admin canceled long-running query.'); ERROR: canceling statement due to user request: "Admin canceled long-running query."