zoukankan      html  css  js  c++  java
  • GreenPlum 数据库启动关闭及数据库状态检查

    本篇文章主要记录GreenPlum数据库的启动、关闭及状态查询。GreenPlum数据库提供gpstart和gpstop脚本来启动和关闭数据库,可以通过—help参数来查看这些脚本的帮助信息。

    01 [gpadmin@mdw master]$ gpstart --help
    02 COMMAND NAME: gpstart
    03 Starts a Greenplum Database system.
    04 *****************************************************
    05 SYNOPSIS
    06 *****************************************************
    07 gpstart [-d <master_data_directory>] [-B <parallel_processes>]
    08         [-R] [-m] [-y] [-a] [-t <timeout_seconds>]
    09         [-l logfile_directory] [-v | -q]
    10 gpstart -? | -h | --help
    11 gpstart --version
    12 *****************************************************
    13 DESCRIPTION
    14 *****************************************************
    15 The gpstart utility is used to start the Greenplum Database server
    16 processes. When you start a Greenplum Database system, you are
    17 actually starting several postgres database server listener processes
    18 at once (the master and all of the segment instances). The gpstart utility
    19 handles the startup of the individual instances. Each instance is started
    20 in parallel.
    21 The first time an administrator runs gpstart, the utility creates a hosts
    22 cache file named .gphostcache in the user's home directory. Subsequently,
    23 the utility uses this list of hosts to start the system more efficiently.
    24 If new hosts are added to the system, you must manually remove this file
    25 from the gpadmin user's home directory. The utility will create a new hosts
    26 cache file at the next startup.
    27 Before you can start a Greenplum Database system, you must have initialized
    28 the system using gpinitsystem first.
    29 *****************************************************
    30 OPTIONS
    31 *****************************************************
    32 -a (do not prompt)
    33   Do not prompt the user for confirmation.
    34 -B <parallel_processes>
    35   The number of segments to start in parallel. If not specified,
    36   the utility will start up to 64 parallel processes depending on
    37   how many segment instances it needs to start.
    38 -d <master_data_directory>
    39   Optional. The master host data directory. If not specified,
    40   the value set for $MASTER_DATA_DIRECTORY will be used.
    41 -l <logfile_directory>
    42   The directory to write the log file. Defaults to ~/gpAdminLogs.
    43 -m (master only)
    44   Optional. Starts the master instance only, which may be necessary
    45   for maintenance tasks. This mode only allows connections to the master
    46   in utility mode. For example:
    47   PGOPTIONS='-c gp_session_role=utility' psql
    48   Note that starting the system in master-only mode is only advisable
    49   under supervision of Greenplum support.  Improper use of this option
    50   may lead to a split-brain condition and possible data loss.
    51 -q (no screen output)
    52   Run in quiet mode. Command output is not displayed on the screen,
    53   but is still written to the log file.
    54 -R (restricted mode)
    55   Starts Greenplum Database in restricted mode (only database superusers
    56   are allowed to connect).
    57 -t | --timeout <number_of_seconds>
    58   Specifies a timeout in seconds to wait for a segment instance to
    59   start up. If a segment instance was shutdown abnormally (due to
    60   power failure or killing its postgres database listener process,
    61   for example), it may take longer to start up due to the database
    62   recovery and validation process. If not specified, the default timeout
    63   is 60 seconds.
    64 -v (verbose output)
    65   Displays detailed status, progress and error messages output by the utility.
    66 -y (do not start standby master)
    67   Optional. Do not start the standby master host. The default is to start
    68   the standby master host and synchronization process.
    69 -? | -h | --help (help)
    70   Displays the online help.
    71 --version (show utility version)
    72   Displays the version of this utility.
    73 *****************************************************
    74 EXAMPLES
    75 *****************************************************
    76 Start a Greenplum Database system:
    77 gpstart
    78 Start a Greenplum Database system in restricted mode
    79 (only allow superuser connections):
    80 gpstart -R
    81 Start the Greenplum master instance only and connect in utility mode:
    82 gpstart -m
    83 PGOPTIONS='-c gp_session_role=utility' psql
    84 Display the online help for the gpstart utility:
    85 gpstart -?
    86 *****************************************************
    87 SEE ALSO
    88 *****************************************************
    89 gpinitsystem, gpstop

    常用的启动参数有以下几个参数:

    -a,该模式不需要在启动过程中输入Y进行确认,将直接启动数据库。

    -m,只启动Master节点,不启动Segment节点,通常在维护的时候使用。

    -y,只启动Master的primary节点,不启动standby节点。

    如下为GreenPlum数据库的启动过程。

    01 [gpadmin@mdw gpdb]$ gpstart -a
    02 20160114:10:56:18:013983 gpstart:mdw:gpadmin-[INFO]:-Starting gpstart with args: -a
    03 20160114:10:56:18:013983 gpstart:mdw:gpadmin-[INFO]:-Gathering information and validating the environment...
    04 20160114:10:56:18:013983 gpstart:mdw:gpadmin-[INFO]:-Greenplum Binary Version: 'postgres (Greenplum Database) 4.3.6.2 build 1'
    05 20160114:10:56:18:013983 gpstart:mdw:gpadmin-[INFO]:-Greenplum Catalog Version: '201310150'
    06 20160114:10:56:18:013983 gpstart:mdw:gpadmin-[INFO]:-Starting Master instance in admin mode
    07 20160114:10:56:19:013983 gpstart:mdw:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information
    08 20160114:10:56:19:013983 gpstart:mdw:gpadmin-[INFO]:-Obtaining Segment details from master...
    09 20160114:10:56:19:013983 gpstart:mdw:gpadmin-[INFO]:-Setting new master era
    10 20160114:10:56:19:013983 gpstart:mdw:gpadmin-[INFO]:-Master Started...
    11 20160114:10:56:19:013983 gpstart:mdw:gpadmin-[INFO]:-Shutting down master
    12 20160114:10:56:21:013983 gpstart:mdw:gpadmin-[INFO]:-Commencing parallel segment instance startup, please wait
    13 20160114:10:56:23:013983 gpstart:mdw:gpadmin-[INFO]:-Process results...
    14 20160114:10:56:23:013983 gpstart:mdw:gpadmin-[INFO]:-----------------------------------------------------
    15 20160114:10:56:23:013983 gpstart:mdw:gpadmin-[INFO]:-   Successful segment starts      = 3
    16 20160114:10:56:23:013983 gpstart:mdw:gpadmin-[INFO]:-   Failed segment starts          = 0
    17 20160114:10:56:23:013983 gpstart:mdw:gpadmin-[INFO]:-   Skipped segment starts (segments are marked down in configuration)   = 0
    18 20160114:10:56:23:013983 gpstart:mdw:gpadmin-[INFO]:-----------------------------------------------------
    19 20160114:10:56:23:013983 gpstart:mdw:gpadmin-[INFO]:-
    20 20160114:10:56:23:013983 gpstart:mdw:gpadmin-[INFO]:-Successfully started 3 of 3 segment instances
    21 20160114:10:56:23:013983 gpstart:mdw:gpadmin-[INFO]:-----------------------------------------------------
    22 20160114:10:56:23:013983 gpstart:mdw:gpadmin-[INFO]:-Starting Master instance mdw directory /gpdb/gpdata/master/gpseg-1
    23 20160114:10:56:24:013983 gpstart:mdw:gpadmin-[INFO]:-Command pg_ctl reports Master mdw instance active
    24 20160114:10:56:24:013983 gpstart:mdw:gpadmin-[INFO]:-No standby master configured.  skipping...
    25 20160114:10:56:24:013983 gpstart:mdw:gpadmin-[INFO]:-Database successfully started

    可以通过gpstate脚本来查看数据库的状态信息,该命令的帮助信息如下:

    001 [gpadmin@mdw master]$ gpstate --help
    002 COMMAND NAME: gpstate
    003 Shows the status of a running Greenplum Database system.
    004 *****************************************************
    005 SYNOPSIS
    006 *****************************************************
    007 gpstate [-d <master_data_directory>] [-B <parallel_processes>]
    008         [-s | -b | -Q | -e] [-m | -c] [-p] [-i] [-f]
    009         [-v | -q] [-l <log_directory>]
    010 gpstate -? | -h | --help
    011 *****************************************************
    012 DESCRIPTION
    013 *****************************************************
    014 The gpstate utility displays information about a running
    015 Greenplum Database instance. There is additional information
    016 you may want to know about a Greenplum Database system, since
    017 it is comprised of multiple PostgreSQL database instances (segments)
    018 spanning multiple machines. The gpstate utility provides
    019 additional status information for a Greenplum Database system,
    020 such as:
    021 * Which segments are down.
    022 * Master and segment configuration information (hosts,
    023   data directories, etc.).
    024 * The ports used by the system.
    025 * A mapping of primary segments to their corresponding
    026   mirror segments.
    027 *****************************************************
    028 OPTIONS
    029 *****************************************************
    030 -b (brief status)
    031   Optional. Display a brief summary of the state of the
    032   Greenplum Database system. This is the default option.
    033 -B <parallel_processes>
    034   The number of segments to check in parallel. If not specified,
    035   the utility will start up to 60 parallel processes depending on
    036   how many segment instances it needs to check.
    037 -c (show primary to mirror mappings)
    038   Optional. Display mapping of primary segments to their
    039   corresponding mirror segments.
    040 -d <master_data_directory>
    041   Optional. The master data directory. If not specified, the
    042   value set for $MASTER_DATA_DIRECTORY will be used.
    043 -e (show segments with mirror status issues)
    044   Show details on primary/mirror segment pairs that have
    045   potential issues such as 1) the active segment is running in
    046   change tracking mode, meaning a segment is down 2) the active
    047   segment is in resynchronization mode, meaning it is catching
    048   up changes to the mirror 3) a segment is not in its preferred role,
    049   for example a segment that was a primary at system initialization
    050   time is now acting as a mirror, meaning you may have one or more
    051   segment hosts with unbalanced processing load.
    052 -f (show standby master details)
    053   Display details of the standby master host if configured.
    054 -i (show Greenplum Database version)
    055   Display the Greenplum Database software version information
    056   for each instance.
    057 -l <logfile_directory>
    058   The directory to write the log file. Defaults to ~/gpAdminLogs.
    059 -m (list mirrors)
    060    Optional. List the mirror segment instances in the system,
    061   their current role, and synchronization status.
    062 -p (show ports)
    063   List the port numbers used throughout the Greenplum Database
    064   system.
    065 -q (no screen output)
    066   Optional. Run in quiet mode. Except for warning messages, command
    067   output is not displayed on the screen. However, this information
    068   is still written to the log file.
    069 -Q (quick status)
    070   Optional. Checks segment status in the system catalog on
    071   the master host. Does not poll the segments for status.
    072 -s (detailed status)
    073   Optional. Displays detailed status information for the
    074   Greenplum Database system.
    075 -v (verbose output)
    076   Optional. Displays error messages and outputs detailed status
    077   and progress information.
    078 -? | -h | --help (help)
    079   Displays the online help.
    080 *****************************************************
    081 OUTPUT DEFINITIONS FOR DETAIL VIEW
    082 *****************************************************
    083 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    084 MASTER OUTPUT DATA
    085 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    086 * Master host - host name of the master
    087 * Master postgres process ID - PID of the master postgres database
    088                                listener process
    089 * Master data directory - file system location of the master data directory
    090 * Master port - port of the master database listener process
    091 * Master current role - dispatch = regular operating mode
    092                         utility = maintenance mode
    093 * Greenplum array configuration type - Standard = one NIC per host
    094                                        Multi-Home = multiple NICs per host
    095 * Greenplum initsystem version - version of Greenplum Database when
    096                                  system was first initialized
    097 * Greenplum current version - current version of Greenplum Database
    098 * Postgres version - version of PostgreSQL that Greenplum Database
    099                      is based on
    100 * Greenplum mirroring status - physical mirroring, SAN or none
    101 * Master standby - host name of the standby master
    102 * Standby master state - status of the standby master: active or passive
    103 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    104 SEGMENT OUTPUT DATA
    105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    106 * Hostname - system-configured host name
    107 * Address - network address host name (NIC name)
    108 * Datadir - file system location of segment data directory
    109 * Port - port number of segment postgres database listener process
    110 * Current Role - current role of a segment: Mirror or Primary
    111 * Preferred Role - role at system initialization time: Mirror or Primary
    112 * Mirror Status - status of a primary/mirror segment pair:
    113                 Synchronized = data is up to date on both
    114                 Resynchronizing = data is currently being copied from one to the other
    115                 Change Tracking = segment down and active segment is logging changes
    116 * Change tracking data size - when in Change Tracking mode, the size of the change
    117                             log file (may grow and shrink as compression is applied)
    118 * Estimated total data to synchronize - when in Resynchronization mode, the estimated
    119                                       size of data left to syncronize
    120 * Data synchronized - when in Resynchronization mode, the estimated size of data
    121                     that has already been syncronized
    122 * Estimated resync progress with mirror - when in Resynchronization mode, the
    123                                         estimated percentage of completion
    124 * Estimated resync end time - when in Resynchronization mode, the estimated
    125                             time to complete
    126 * File postmaster.pid - status of postmaster.pid lock file: Found or Missing
    127 * PID from postmaster.pid file - PID found in the postmaster.pid file
    128 * Lock files in /tmp - a segment port lock file for its postgres process is
    129                        created in /tmp (file is removed when a segment shuts down)
    130 * Active PID - active process ID of a segment
    131 * Master reports status as - segment status as reported in the system catalog:
    132                            Up or Down
    133 Database status - status of Greenplum Database to incoming requests:
    134                 Up, Down, or Suspended. A Suspended state means database
    135                 activity is temporarily paused while a segment transitions from
    136                 one state to another.
    137 *****************************************************
    138 EXAMPLES
    139 *****************************************************
    140 Show detailed status information of a Greenplum Database system:
    141    gpstate -s
    142 Do a quick check for down segments in the master host system catalog:
    143    gpstate -Q
    144 Show information about mirror segment instances:
    145    gpstate -m
    146 Show information about the standby master configuration:
    147    gpstate -f
    148 Display the Greenplum software version information:
    149    gpstate -i
    150 *****************************************************
    151 SEE ALSO
    152 *****************************************************
    153

    常用的参数如下:

    -s,详细信息。

    -m,Mirror信息。

    -f,Master的Standby信息。

    -e,Segment的Mirror信息。

    -i,版本信息。

    如下为数据库启动状态通过gpstate –s查询的数据库状态信息。

    01 [gpadmin@mdw gpdb]$ gpstate -s
    02 20160114:10:56:40:014082 gpstate:mdw:gpadmin-[INFO]:-Starting gpstate with args: -s
    03 20160114:10:56:40:014082 gpstate:mdw:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 4.3.6.2 build 1'
    04 20160114:10:56:40:014082 gpstate:mdw:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 8.2.15 (Greenplum Database 4.3.6.2 build 1) on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.4.2 compiled on Nov 12 2015 23:50:28'
    05 20160114:10:56:40:014082 gpstate:mdw:gpadmin-[INFO]:-Obtaining Segment details from master...
    06 20160114:10:56:40:014082 gpstate:mdw:gpadmin-[INFO]:-Gathering data from segments...
    07 .
    08 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-----------------------------------------------------
    09 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:--Master Configuration & Status
    10 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-----------------------------------------------------
    11 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-   Master host                    = mdw
    12 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-   Master postgres process ID     = 14042
    13 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-   Master data directory          = /gpdb/gpdata/master/gpseg-1
    14 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-   Master port                    = 5432
    15 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-   Master current role            = dispatch
    16 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-   Greenplum initsystem version   = 4.3.6.2 build 1
    17 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-   Greenplum current version      = PostgreSQL 8.2.15 (Greenplum Database 4.3.6.2 build 1) on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.4.2 compiled on Nov 12 2015 23:50:28
    18 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-   Postgres version               = 8.2.15
    19 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-   Master standby                 = No master standby configured
    20 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-----------------------------------------------------
    21 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-Segment Instance Status Report
    22 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-----------------------------------------------------
    23 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-   Segment Info
    24 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-      Hostname                          = sdw1
    25 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-      Address                           = sdw1
    26 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-      Datadir                           = /gpdb/gpdata/primary/gpseg0
    27 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-      Port                              = 40000
    28 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-   Status
    29 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-      PID                               = 17195
    30 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-      Configuration reports status as   = Up
    31 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-      Database status                   = Up
    32 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-----------------------------------------------------
    33 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-   Segment Info
    34 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-      Hostname                          = sdw2
    35 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-      Address                           = sdw2
    36 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-      Datadir                           = /gpdb/gpdata/primary/gpseg1
    37 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-      Port                              = 40000
    38 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-   Status
    39 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-      PID                               = 17111
    40 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-      Configuration reports status as   = Up
    41 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-      Database status                   = Up
    42 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-----------------------------------------------------
    43 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-   Segment Info
    44 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-      Hostname                          = sdw3
    45 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-      Address                           = sdw3
    46 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-      Datadir                           = /gpdb/gpdata/primary/gpseg2
    47 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-      Port                              = 40000
    48 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-   Status
    49 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-      PID                               = 23033
    50 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-      Configuration reports status as   = Up
    51 20160114:10:56:41:014082 gpstate:mdw:gpadmin-[INFO]:-      Database status                   = Up

    gpstop脚本用来关闭、重启、加载新修改的参数以至生效等功能,下面是gpstop命令的帮助信息。

    001 [gpadmin@mdw master]$ gpstop --help
    002 COMMAND NAME: gpstop
    003 Stops or restarts a Greenplum Database system.
    004 *****************************************************
    005 SYNOPSIS
    006 *****************************************************
    007 gpstop [-d <master_data_directory>] [-B <parallel_processes>]
    008        [-M smart | fast | immediate] [-t <timeout_seconds>]
    009        [-r] [-y] [-a] [-l <logfile_directory>] [-v | -q]
    010 gpstop -m [-d <master_data_directory>] [-y] [-l <logfile_directory>]
    011        [-v | -q]
    012 gpstop -u [-d <master_data_directory>] [-l <logfile_directory>]
    013           [-v | -q]
    014 gpstop --version
    015 gpstop -? | -h | --help
    016 *****************************************************
    017 DESCRIPTION
    018 *****************************************************
    019 The gpstop utility is used to stop the database servers that
    020 comprise a Greenplum Database system. When you stop a Greenplum
    021 Database system, you are actually stopping several postgres
    022 database server processes at once (the master and all of the
    023 segment instances). The gpstop utility handles the shutdown
    024 of the individual instances. Each instance is shutdown in parallel.
    025 By default, you are not allowed to shut down Greenplum Database
    026 if there are any client connections to the database. Use
    027 the -M fast option to roll back and terminate any connections
    028 before shutting down. If there are any transactions in progress,
    029 the default behavior is to wait for them to commit before
    030 shutting down. Use the -M fast option to roll back open
    031 transactions.
    032 With the -u option, the utility uploads changes made to the
    033 master pg_hba.conf file or to runtime configuration parameters
    034 in the master postgresql.conf file without interruption of
    035 service. Note that any active sessions will not pickup the
    036 changes until they reconnect to the database.
    037 *****************************************************
    038 OPTIONS
    039 *****************************************************
    040 -a (do not prompt)
    041  Do not prompt the user for confirmation.
    042 -B <parallel_processes>
    043  The number of segments to stop in parallel. If not specified,
    044  the utility will start up to 64 parallel processes depending
    045  on how many segment instances it needs to stop.
    046 -d <master_data_directory>
    047  Optional. The master host data directory. If not specified,
    048  the value set for $MASTER_DATA_DIRECTORY will be used.
    049 -l <logfile_directory>
    050  The directory to write the log file. Defaults to ~/gpAdminLogs.
    051 -m (master only)
    052  Optional. Shuts down a Greenplum master instance that was
    053  started in maintenance mode.
    054 -M fast (fast shutdown - rollback)
    055  Fast shut down. Any transactions in progress are interrupted  and rolled back.
    056 -M immediate (immediate shutdown - abort)
    057  Immediate shut down. Any transactions in progress are aborted. This
    058  shutdown mode is not recommended, and in some circumstances can cause
    059  database corruption requiring manual recovery.
    060  This mode kills all postgres processes without allowing the database
    061  server to complete transaction processing or clean up any temporary or
    062  in-process work files.
    063 -M smart (smart shutdown - warn)
    064   Smart shut down. If there are active connections, this command
    065  fails with a warning. This is the default shutdown mode.
    066 -q (no screen output)
    067  Run in quiet mode. Command output is not displayed on the
    068  screen, but is still written to the log file.
    069 -r (restart)
    070  Restart after shutdown is complete.
    071 -t <timeout_seconds>
    072  Specifies a timeout threshold (in seconds) to wait for a
    073  segment instance to shutdown. If a segment instance does not
    074  shutdown in the specified number of seconds, gpstop displays
    075  a message indicating that one or more segments are still in
    076  the process of shutting down and that you cannot restart
    077  Greenplum Database until the segment instance(s) are stopped.
    078  This option is useful in situations where gpstop is executed
    079  and there are very large transactions that need to rollback.
    080  These large transactions can take over a minute to rollback
    081  and surpass the default timeout period of 600 seconds.
    082 -u (reload pg_hba.conf and postgresql.conf files only)
    083  This option reloads the pg_hba.conf files of the master and
    084  segments and the runtime parameters of the postgresql.conf files
    085  but does not shutdown the Greenplum Database array. Use this
    086  option to make new configuration settings active after editing
    087  postgresql.conf or pg_hba.conf. Note that this only applies to
    088  configuration parameters that are designated as runtime parameters.
    089 -v (verbose output)
    090  Displays detailed status, progress and error messages output
    091  by the utility.
    092 --version (show utility version)
    093  Displays the version of this utility.
    094 -y (do not stop standby master)
    095  Do not stop the standby master process. The default is to stop  the standby master.
    096 -? | -h | --help (help)
    097  Displays the online help.
    098 *****************************************************
    099 EXAMPLES
    100 *****************************************************
    101 Stop a Greenplum Database system in smart mode:
    102   gpstop
    103 Stop a Greenplum Database system in fast mode:
    104   gpstop -M fast
    105 Stop all segment instances and then restart the system:
    106   gpstop -r
    107 Stop a master instance that was started in maintenance mode:
    108   gpstop -m
    109 Reload the postgresql.conf and pg_hba.conf files after
    110 making runtime configuration parameter changes but do not
    111 shutdown the Greenplum Database array:
    112   gpstop -u
    113 *****************************************************
    114 SEE ALSO
    115 *****************************************************
    116 gpstart

    常用的参数如下:

    -a,不需要输入Y确认是否关闭,将直接关闭数据库。

    -m,只关闭Master节点。

    -r,重启数据库。

    -u,加载参数文件,使修改的参数生效。

    -M,设置关闭数据库的级别,有三种级别,fast、immediate和smart,gpstop –M fast,所有连接将中断并且回滚。gpstop –M immediate,强制关闭数据库,这种方式是不一致的关闭模式,不建议使用。Immediate smart,这是默认的关闭级别,所有连接的会话会收到关闭警告,不允许新链接访问数据库。下面是默认级别关闭GreenPlum数据库的相关信息。

    01 [gpadmin@mdw gpdb]$ gpstop -a
    02 20160114:10:55:17:013853 gpstop:mdw:gpadmin-[INFO]:-Starting gpstop with args: -a
    03 20160114:10:55:17:013853 gpstop:mdw:gpadmin-[INFO]:-Gathering information and validating the environment...
    04 20160114:10:55:17:013853 gpstop:mdw:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information
    05 20160114:10:55:17:013853 gpstop:mdw:gpadmin-[INFO]:-Obtaining Segment details from master...
    06 20160114:10:55:17:013853 gpstop:mdw:gpadmin-[INFO]:-Greenplum Version: 'postgres (Greenplum Database) 4.3.6.2 build 1'
    07 20160114:10:55:17:013853 gpstop:mdw:gpadmin-[INFO]:-There are 0 connections to the database
    08 20160114:10:55:17:013853 gpstop:mdw:gpadmin-[INFO]:-Commencing Master instance shutdown with mode='smart'
    09 20160114:10:55:17:013853 gpstop:mdw:gpadmin-[INFO]:-Master host=mdw
    10 20160114:10:55:17:013853 gpstop:mdw:gpadmin-[INFO]:-Commencing Master instance shutdown with mode=smart
    11 20160114:10:55:17:013853 gpstop:mdw:gpadmin-[INFO]:-Master segment instance directory=/gpdb/gpdata/master/gpseg-1
    12 20160114:10:55:18:013853 gpstop:mdw:gpadmin-[INFO]:-Attempting forceful termination of any leftover master process
    13 20160114:10:55:18:013853 gpstop:mdw:gpadmin-[INFO]:-Terminating processes for segment /gpdb/gpdata/master/gpseg-1
    14 20160114:10:55:18:013853 gpstop:mdw:gpadmin-[INFO]:-No standby master host configured
    15 20160114:10:55:18:013853 gpstop:mdw:gpadmin-[INFO]:-Commencing parallel segment instance shutdown, please wait...
    16 20160114:10:55:18:013853 gpstop:mdw:gpadmin-[INFO]:-0.00% of jobs completed
    17 20160114:10:55:28:013853 gpstop:mdw:gpadmin-[INFO]:-100.00% of jobs completed
    18 20160114:10:55:28:013853 gpstop:mdw:gpadmin-[INFO]:-----------------------------------------------------
    19 20160114:10:55:28:013853 gpstop:mdw:gpadmin-[INFO]:-   Segments stopped successfully      = 3
    20 20160114:10:55:28:013853 gpstop:mdw:gpadmin-[INFO]:-   Segments with errors during stop   = 0
    21 20160114:10:55:28:013853 gpstop:mdw:gpadmin-[INFO]:-----------------------------------------------------
    22 20160114:10:55:28:013853 gpstop:mdw:gpadmin-[INFO]:-Successfully shutdown 3 of 3 segment instances
    23 20160114:10:55:28:013853 gpstop:mdw:gpadmin-[INFO]:-Database successfully shutdown with no errors reported
    24 20160114:10:55:28:013853 gpstop:mdw:gpadmin-[INFO]:-Cleaning up leftover gpmmon process
    25 20160114:10:55:28:013853 gpstop:mdw:gpadmin-[INFO]:-No leftover gpmmon process found
    26 20160114:10:55:28:013853 gpstop:mdw:gpadmin-[INFO]:-Cleaning up leftover gpsmon processes
    27 20160114:10:55:28:013853 gpstop:mdw:gpadmin-[INFO]:-No leftover gpsmon processes on some hosts. not attempting forceful termination on these hosts
    28 20160114:10:55:28:013853 gpstop:mdw:gpadmin-[INFO]:-Cleaning up leftover shared memory

    本文固定链接: http://www.dbdream.com.cn/2016/01/greenplum%e6%95%b0%e6%8d%ae%e5%ba%93%e5%90%af%e5%8a%a8%e5%85%b3%e9%97%ad%e5%8f%8a%e6%95%b0%e6%8d%ae%e5%ba%93%e7%8a%b6%e6%80%81%e6%a3%80%e6%9f%a5/ | 信春哥,系统稳,闭眼上线不回滚!

  • 相关阅读:
    感觉每天打开自己的博客园, 想编程的心情就多了起来~~~
    算法图解相关代码整理
    github cli
    What's WebFlux ? And how to use it ? 一股有咖喱味的WebFlux简介
    style
    gradle 1
    gradle打包可运行jar
    外面下着雨
    天晴朗 看花儿多多开放
    Full Stack Reactive with React and Spring WebFlux
  • 原文地址:https://www.cnblogs.com/xibuhaohao/p/11131117.html
Copyright © 2011-2022 走看看