mxpacklogs

This document describes the log collection and packaging tool mxpacklogs.

1 Description

  • Features

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

    • Logs collected from each host are temporarily stored under /tmp. If the disk is full, an error occurs.
    • In extreme cases where all cluster nodes are down, use the --host and --path options to specify --hosts and --base-data-dirs for log retrieval.

2 Command-Line Options

The following table lists the command-line arguments:

Option Description
--base-data-dirs Base data directories for the database, separated by commas
--hosts Hosts from which to collect Segment logs, separated by commas
--config Configuration file. Default: $HOME/.mxctl.yaml
-h / --dbhost Database server host. Default: 127.0.0.1
-p / --dbport Database server port. Default: 5432
--debug Enable debug-level log output
--help Print help message
--host Host where supervisor/mxgate service is installed. Default: 127.0.0.1
--mode Output format: supports api or cli. Default: api
-W / --password Password for the database user
--path MatrixDB installation path on the supervisor host. Default: /usr/local/matrixdb
--port Supervisor server port. Default: 4617
-U / --username Database username. Default: mxadmin
--validate Validation mode – performs a dry run
--verbose Enable verbose log output
-v / --version Display tool version

3 Examples

mxpacklogs can be executed on the Master node or a non-Master node. Details:

  • When running on the Master, it is recommended to use the mxadmin user. If another user is used, configure pg_hba trust accordingly.
  • When running remotely on a non-Master node, the following conditions must be met:
    • Both the database server and the execution server must have MatrixDB version 4.8.0 or later installed.
    • Connect to the Master by specifying the appropriate parameters.

Based on the above, we recommend the following three usage methods. In the examples below, mdw is the Master and sdw is a non-Master host:

  1. Run the mxpacklogs command directly. This assumes the current host is the Master and connects to the database to collect logs from all Segments. ``

    [mxadmin@mdw ~]$ mxpacklogs
    [INFO]:-Preparing temp directory...
    [INFO]:-Starting transport server...
    [INFO]:-Gathering logs from 4 hosts...
    [INFO]:-Creating the tarball...
    [INFO]:-All logs packed to: /tmp/gather_logs_2143246856.tar.gz

    ``

  2. Run the following command on any host to specify connection details to the Master, enabling log collection from all Segments (same result as Example 1). ``

    [<user>@<host> ~]$ mxpacklogs --dbhost 172.31.33.128 --dbport 5432 --username mxadmin --password 123
    [INFO]:-Preparing temp directory...
    [INFO]:-Starting transport server...
    [INFO]:-Gathering logs from 4 hosts...
    [INFO]:-Creating the tarball...
    [INFO]:-All logs packed to: /tmp/gather_logs_340918649.tar.gz

    ``

Note!
Examples 1 and 2 retrieve information by connecting to the Master. Therefore, the cluster Master must be in a healthy state.

  1. Run the following command on any host to collect logs only from specified hosts (required) and optionally specific data directories. ``
    [<user>@sdw ~]$ mxpacklogs --hosts sdw1,sdw2 --base-data-dirs /mxdata_20221229075012

    ``

This command collects logs from sdw1 and sdw2, assuming both hosts use the same base-data-dirs, which is /mxdata_20221229075012.

[<user>@sdw ~]$ mxpacklogs --hosts sdw1,sdw2 --base-data-dirs /mxdata_20221229075012,/data1/mxdata_20221229075012

``

This command collects logs from sdw1 and sdw2, but their base-data-dirs differ: one is /mxdata_20221229075012, the other is /data1/mxdata_20221229075012.

Note!
For more information about log content, see Logs.