生活随笔
收集整理的這篇文章主要介紹了
GreenPlum 数据库启动关闭及数据库状态检查
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
本篇文章主要記錄GreenPlum數據庫的啟動、關閉及狀態查詢。GreenPlum數據庫提供gpstart和gpstop腳本來啟動和關閉數據庫,可以通過—help參數來查看這些腳本的幫助信息。
view source
| 01 | [gpadmin@mdw master]$ gpstart --help |
| 03 | Starts a Greenplum Database system. |
| 04 | ***************************************************** |
| 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 |
| 12 | ***************************************************** |
| 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 |
| 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 | ***************************************************** |
| 31 | ***************************************************** |
| 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. |
| 42 | ??The directory to write the log file. Defaults to ~/gpAdminLogs. |
| 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. |
| 52 | ??Run in quiet mode. Command output is not displayed on the screen, |
| 53 | ??but is still written to the log file. |
| 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 |
| 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 | ***************************************************** |
| 75 | ***************************************************** |
| 76 | Start a Greenplum Database system: |
| 78 | Start a Greenplum Database system in restricted mode |
| 79 | (only allow superuser connections): |
| 81 | Start the Greenplum master instance only and connect in utility mode: |
| 83 | PGOPTIONS='-c gp_session_role=utility' psql |
| 84 | Display the online help for the gpstart utility: |
| 86 | ***************************************************** |
| 88 | ***************************************************** |
常用的啟動參數有以下幾個參數:
-a,該模式不需要在啟動過程中輸入Y進行確認,將直接啟動數據庫。
-m,只啟動Master節點,不啟動Segment節點,通常在維護的時候使用。
-y,只啟動Master的primary節點,不啟動standby節點。
如下為GreenPlum數據庫的啟動過程。
view source
| 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腳本來查看數據庫的狀態信息,該命令的幫助信息如下:
view source
| 001 | [gpadmin@mdw master]$ gpstate --help |
| 002 | \COMMAND NAME: gpstate |
| 003 | Shows the status of a running Greenplum Database system. |
| 004 | ***************************************************** |
| 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 | ***************************************************** |
| 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, |
| 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 |
| 027 | ***************************************************** |
| 029 | ***************************************************** |
| 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 |
| 057 | -l <logfile_directory> |
| 058 | ??The directory to write the log file. Defaults to ~/gpAdminLogs. |
| 060 | ???Optional. List the mirror segment instances in the system, |
| 061 | ??their current role, and synchronization status. |
| 063 | ??List the port numbers used throughout the Greenplum Database |
| 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. |
| 070 | ??Optional. Checks segment status in the system catalog on |
| 071 | ??the master host. Does not poll the segments for status. |
| 073 | ??Optional. Displays detailed status information for the |
| 074 | ??Greenplum Database system. |
| 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 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 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 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 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 | ***************************************************** |
| 139 | ***************************************************** |
| 140 | Show detailed status information of a Greenplum Database system: |
| 142 | Do a quick check for down segments in the master host system catalog: |
| 144 | Show information about mirror segment instances: |
| 146 | Show information about the standby master configuration: |
| 148 | Display the Greenplum software version information: |
| 150 | ***************************************************** |
| 152 | ***************************************************** |
常用的參數如下:
-s,詳細信息。
-m,Mirror信息。
-f,Master的Standby信息。
-e,Segment的Mirror信息。
-i,版本信息。
如下為數據庫啟動狀態通過gpstate –s查詢的數據庫狀態信息。
view source
| 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... |
| 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命令的幫助信息。
view source
| 001 | [gpadmin@mdw master]$ gpstop --help |
| 003 | Stops or restarts a Greenplum Database system. |
| 004 | ***************************************************** |
| 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>] |
| 012 | gpstop -u [-d <master_data_directory>] [-l <logfile_directory>] |
| 015 | gpstop -? | -h | --help |
| 016 | ***************************************************** |
| 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 |
| 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 | ***************************************************** |
| 039 | ***************************************************** |
| 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. |
| 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. |
| 067 | ?Run in quiet mode. Command output is not displayed on the |
| 068 | ?screen, but is still written to the log file. |
| 070 | ?Restart after shutdown is complete. |
| 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. |
| 090 | ?Displays detailed status, progress and error messages output |
| 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 | ***************************************************** |
| 100 | ***************************************************** |
| 101 | Stop a Greenplum Database system in smart mode: |
| 103 | Stop a Greenplum Database system in fast mode: |
| 105 | Stop all segment instances and then restart the system: |
| 107 | Stop a master instance that was started in maintenance mode: |
| 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: |
| 113 | ***************************************************** |
| 115 | ***************************************************** |
常用的參數如下:
-a,不需要輸入Y確認是否關閉,將直接關閉數據庫。
-m,只關閉Master節點。
-r,重啟數據庫。
-u,加載參數文件,使修改的參數生效。
-M,設置關閉數據庫的級別,有三種級別,fast、immediate和smart,gpstop –M fast,所有連接將中斷并且回滾。gpstop –M immediate,強制關閉數據庫,這種方式是不一致的關閉模式,不建議使用。Immediate smart,這是默認的關閉級別,所有連接的會話會收到關閉警告,不允許新鏈接訪問數據庫。下面是默認級別關閉GreenPlum數據庫的相關信息。
view source
| 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/ | 信春哥,系統穩,閉眼上線不回滾!
轉載于:https://www.cnblogs.com/xibuhaohao/p/11131117.html
總結
以上是生活随笔為你收集整理的GreenPlum 数据库启动关闭及数据库状态检查的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。