Pivotal Knowledge Base

Follow

HowTo - Put the database in maintenance mode

Environment

Pivotal Greenplum: All Versions

Goal

How do you put the database in "maintenance mode", for example required when you need to run gpcheckcat?

By "maintenance mode" here we mean: editing "pg_hba.conf" to limit connections and using restricted mode at the same time.

Solution

  • Enable local connections by gpadmin only. The IP address 172.28.8.250 is the default address responding to the master node mdw from servers within a DCA, please change it accordingly if it's not a DCA by pinging the master node locally from the master node itself (via its host name) to see what IP address is resolved to. In this example:
# mv -i $MASTER_DATA_DIRECTORY/pg_hba.conf $MASTER_DATA_DIRECTORY/pg_hba.conf.$(date +%Y%m%d)
# echo -e "local all gpadmin ident\nhost all gpadmin 127.0.0.1/28 trust\nhost all gpadmin 172.28.8.250/32 trust" > $MASTER_DATA_DIRECTORY/pg_hba.conf
# gpstop -u
  • Check if the database is in restricted mode:
# pgrep -fl silent
  • If it is in restricted mode, you will see "-c superuser_reserved_connections=" in the postmaster command string (max_connections is set to 250 by default on master).
  • Otherwise restart the database in restricted mode:
# gpstop -M fast
# gpstart -R
  • Remember to restore the original pg_hba.conf and restart the db in normal mode at the end of the activity.

Comments

Powered by Zendesk