log

Viewing the system operation log is the basic method to diagnose cluster failures.

1. MatrixDB Log

MatrixDB has two types of logs:

  • Cluster Management Log
  • Query operation log

1.1 Cluster Management Log

The default directory of cluster management logs is $HOME/gpAdminLogs. Different tools have different log files in the directory, such as: gpstart_20210701.log, gpstop_20210701.log, etc.

The log file naming rules are: {administrative tool name}_{date}.log, as shown below:

gpconfig_20210723.log
gpstart_20210701.log
gpstart_20210708.log
gpstop_20210701.log
gpstop_20210723.log
......

The log format is: date + time + tool name + host name + user name + log level + log content. like:

20210708:17:29:32:001644 gpstart:mdw:mxadmin-[INFO]:-Greenplum Catalog Version: '302012031'
20210708:17:29:32:001644 gpstart:mdw:mxadmin-[WARNING]:-postmaster.pid file exists on Master, checking if recovery startup required
......

The log levels are divided into INFO, WARNING, FATAL, etc.

  • INFO is normal output
  • WARNING encountered an exception during execution, but it can still continue to execute
  • FATAL encountered a serious error, the whole process could not be carried out, and had to stop

Therefore, when the tool execution fails, it can be diagnosed by viewing the WARNING and FATAL records of the corresponding log.

1.2 Query the operation log

The query operation log is located in the log directory under the master and segment node data directory. The file name format is gpdb-{date}_{time}.csv, such as:

gpdb-2021-07-01_164653.csv
gpdb-2021-07-01_164655.csv
gpdb-2021-07-02_000000.csv
......

This log is a PostgreSQL log and can be used to locate the following problems:

  • Query execution error
  • Node failure

The file content includes the date, time, user name, process number, connection ID, log level and specific error information of the log generation.

The following log content is the error log of the user trying to connect to a non-existent database:

2021-07-26 10:21:34.692106 CST,"mxadmin","postgggg",p10188,th-1455884160,"[local]",,2021-07-26 10:21:34 CST,0,con14,,seg-1,,,,sx1,"FATAL","3D000","database ""postgggg"" does not exist",,,,,,,0,,"postinit.c",1024,

The meanings of each field of the log are as follows:

Log content Meaning
2021-07-26 10:21:34.692106 CST Log time
mxadmin Contacted username
postgggg Connected database name
p10188 Connected process number
th-1455884160 Thread number
[local] Connection method is local connection
con14 Connection number
seg-1 Node Number
FATAL Log Level
database "postgggg" does not exist Error message

2. MatrixGate log

The log of MatrixGate is also in the gpAdminLogs directory, and the file name is matrixgate.{date}_{time}.log, as shown below:

matrixgate.2021-07-26_134717.log

Log formats are similar to other management tools:

20210726:13:47:17 matrixgate:mxadmin:mdw:010889-[INFO]:-Connected to MatrixDB, version PostgreSQL 12 (MatrixDB 4.1.0-community) (Greenplum Database 7.0.0+dev.16905.gc6dbf4f14d build commit:c6dbf4f14d4452a414198fd45d507819803fffb2) on x86_64-pc-linux-gnu, compiled by gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5), 64-bit compiled on Jul 14 2021 08:56:13
20210726:13:47:17 matrixgate:mxadmin:mdw:010889-[INFO]:-[Writer.Stream] Initialized with 100ms load interval and 10 prepared insert
20210726:13:47:17 matrixgate:mxadmin:mdw:010889-[INFO]:-[Writer.Stream] Started, listening on :12120
20210726:13:47:17 matrixgate:mxadmin:mdw:010889-[INFO]:-[Trans.Plain] Started, parallel level 8
20210726:13:47:17 matrixgate:mxadmin:mdw:010889-[INFO]:-[Source.HTTP] http listening on :8086

MatrixGate log can also be viewed using the mxgate log command:

[mxadmin@mdw gpAdminLogs]$ mxgate log
**********************************************************
 __  __       _        _       ____       _
|  \/  | __ _| |_ _ __(_)_  __/ ___| __ _| |_ ___
| |\/| |/ _` | __| '__| \ \/ / |  _ / _` | __/ _ \
| |  | | (_| | |_| |  | |>  <| |_| | (_| | ||  __/
|_|  |_|\__,_|\__|_|  |_/_/\_\\____|\__,_|\__\___|
  Version: 4.0.3
  Your Copy is Licensed to: yMatrix.cn; 2022-01-14; any
**********************************************************
==> [pid:10889] matrixgate.2021-07-26_134717.log <==
20210726:13:47:17 matrixgate:mxadmin:mdw:010889-[INFO]:-Connected to MatrixDB, version PostgreSQL 12 (MatrixDB 4.1.0-community) (Greenplum Database 7.0.0+dev.16905.gc6dbf4f14d build commit:c6dbf4f14d4452a414198fd45d507819803fffb2) on x86_64-pc-linux-gnu, compiled by gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5), 64-bit compiled on Jul 14 2021 08:56:13
20210726:13:47:17 matrixgate:mxadmin:mdw:010889-[INFO]:-[Writer.Stream] Initialized with 100ms load interval and 10 prepared insert
20210726:13:47:17 matrixgate:mxadmin:mdw:010889-[INFO]:-[Writer.Stream] Started, listening on :12120
20210726:13:47:17 matrixgate:mxadmin:mdw:010889-[INFO]:-[Trans.Plain] Started, parallel level 8
20210726:13:47:17 matrixgate:mxadmin:mdw:010889-[INFO]:-[Source.HTTP] http listening on :8086

The prerequisite for viewing logs using the mxgate log command is that the mxgate process must be running, and the log contents seen are also generated by the running process.