mxpacklogs

This document describes the log collection and packaging tool mxpacklogs.

1 Overview

  • Features

    • The mxpacklogs tool supports one-click collection and packaging of logs from all nodes in a distributed cluster.
    • It collects log data from the current moment back to the previous three days.
  • Usage

    • On Master host
      • Run as user mxadmin is recommended. If another user is used, configure pg_hba trust accordingly.
    • On non-Master host
      • Both the database server and the execution host must have the latest version of YMatrix (4.8.0 or later) installed. Connect to the Master by specifying required parameters.
  • Notes

    • Logs from all specified hosts are aggregated on the host where mxpacklogs is executed, temporarily stored under *.tar.gz as a /tmp package.
    • mxpacklogs automatically selects the disk with the largest available space that the user can read and write to store the *.tar.gz package.
    • In extreme cases where all cluster nodes are down, use the --hosts and --base-data-dirs options to retrieve log information.

2 Tool Usage

In the following examples, mdw refers to the Master host, and sdw refers to a non-Master host.

  1. Collect logs from all hosts

    • Default: current host is Master
     [mxadmin@mdw ~]$ mxpacklogs
    • Specify connection information to access the Master
     [<username>@sdw ~]$ mxpacklogs --dbhost 172.31.33.128 --dbport 5432 --username mxadmin --password 123
  2. Collect logs from specific hosts

    • This command collects logs from sdw1 and sdw2. Both machines have their base-data-dirs set to /mxdata_20221229075012.
     [<username>@sdw ~]$ mxpacklogs --hosts sdw1,sdw2 --base-data-dirs /mxdata_20221229075012
    • This command collects logs from sdw1 and sdw2. The base-data-dirs of sdw1 is /mxdata_20221229075012, and the base-data-dirs of sdw2 is /data1/mxdata_20221229075013.
     [<username>@sdw ~]$ mxpacklogs --hosts sdw1,sdw2 --base-data-dirs /mxdata_20221229075012,/data1/mxdata_20221229075013

3 Detailed Parameter Information

Parameter Default Value Description
--base-data-dirs Data directory from database catalog Optional. Required only when the database is inaccessible. Provide path up to the mxdata_xxxx level. Format: mxpacklogs --base-data-dirs /data/mxdata_20230324145536
--hosts Logs from all hosts in the cluster Use -- hosts to collect logs from specific Segment hosts, reducing disk and time overhead. Format: mxpacklogs --hosts sdw1,sdw2 or mxpacklogs --hosts sdw1 --hosts sdw2
-h / --dbhost 127.0.0.1 Database server host
-p / --dbport 5432 Database server port
--debug Not applicable Enable debug-level log output
--help Not applicable Print help message
--host 127.0.0.1 Host running supervisor/mxgate service
--mode api Output format: api or cli
-W / --password NULL Password for database user
--port 4617 Supervisor server port
-U / --username mxadmin Database username
--validate Not applicable Validation mode – dry run
--verbose Not applicable Enable verbose log output
-v / --version Not applicable Display tool version
--path /opt/ymatrix/matrixdb[x] MatrixDB installation path on supervisor host; [x] is the database version number, e.g., matrixdb5, matrixdb6

Note!
For more information about logs, see Logs.