Because a Greenplum Database system is distributed across many machines, the process for starting and stopping a Greenplum Database DBMS is different than a regular PostgreSQL DBMS. With a regular PostgreSQL DBMS, you run a utility called pg_ctl, which starts, stops, or restarts the database server process (postgres). pg_ctl also takes care of tasks such as redirecting log output and properly detaching from the terminal and process group.
In a Greenplum Database DBMS, each database server instance (the master and all segments) must be started or stopped across all of the hosts in the system in such a way that they can all work together as a unified DBMS.
Greenplum provides similar functionality of the pg_ctl utility with the gpstart and gpstop utilities, which are located in $GPHOME/bin of your Greenplum Database master host installation.
Starting Greenplum Database
The database initialization process (gpinitsystem) will start your Greenplum Database system for you once it has completed successfully. However, there may be times when you will need to restart the system, for example to reset operational configuration parameters or to troubleshoot a failed segment.
Use the gpstart utility to start your Greenplum Database system. This utility starts all of the postgres database listener processes in the system (the master and all of the segment instances). gpstart is always run on the master host.
Each instance is started in parallel (up to 60 parallel processes by default).
To start Greenplum Database
Restarting Greenplum Database
The gpstop utility has a restart option that will restart the Greenplum Database system once a successful shutdown has completed.
To restart Greenplum Database
$ gpstop -r
Uploading Configuration File Changes Only
The gpstop utility has an option that will upload changes made to the pg_hba.conf configuration file and to runtime parameters in the master postgresql.conf file without interruption of service. Note that any active sessions will not pickup the changes until they reconnect to the database, and that many server configuration parameters require a full system restart (gpstop -r) to be activated. For more information, see “Server Configuration Parameters” on page 787.
To upload runtime configuration file changes without restarting
$ gpstop -u
Starting the Master in Maintenance Mode
There may be cases where you want to start only the master. This is called maintenance mode. In this mode, you can do things such as connect to a database on the master instance only in utility mode and edit settings in the system catalog, without affecting user data on the segment instances. See “System Catalog Reference” on page 844 for more information about the system catalog tables.
To start the master in utility mode
1. Run gpstart using the -m option:
$ gpstart -m
2. Connect to the master in utility mode to do catalog maintenance. For example:
$ PGOPTIONS='-c gp_session_role=utility' psql template1
3. After completing your administrative tasks, you must stop the master in utility mode before you can restart it again in production mode.
$ gpstop -m
Stopping Greenplum Database
Use the gpstop utility to stop or restart your Greenplum Database system. This utility stops all of the postgres processes in the system (the master and all of the segment instances). gpstop is always run on the master host.
Each instance is stopped in parallel (up to 60 parallel processes by default). By default the system will wait for any active transactions to finish before shutting down, and will not shutdown if the database has any active client connections.
To stop Greenplum Database
To stop Greenplum Database in fast mode
(all active transactions are interrupted and rolled back, all active client sessions are cancelled)
$ gpstop -M fast