How to Put the Database in the Maintenance Mode
search cancel

How to Put the Database in the Maintenance Mode

book

Article ID: 295855

calendar_today

Updated On:

Products

VMware Tanzu Greenplum

Issue/Introduction

This article explains how to put the database in "maintenance mode". It can be required when there is a need to run gpcheckcat

By "maintenance mode" it means, editing "pg_hba.conf" to limit connections and using restricted mode at the same time.


Environment


Resolution

  • 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.


    Additional Information

    + Environment:

    Pivotal Greenplum all versions