mxpacklogs

This document introduces the log collection and packaging tools mxpacklogs.

1 Description

  • Function
    • mxpacklogs tool supports one-click acquisition and packaging of all logs in distributed clusters.
    • Supports the collection of log information from the current to the first 3 days of the execution command.
  • limit
    • The log collected by each server is temporarily stored under /tmp, and an error will be reported if the disk is full.
    • In the extreme case where all nodes in the cluster are down, you need to obtain log information by specifying --hosts and --base-data-dirs.

2 Command line parameter information

The following is a detailed command line parameter information:

Parameter name Description
--base-data-dirs All basic data directories in the database
--hosts Collects the logs of the hosts of the Segment, separating each host with a comma
--config configuration file. Default is $HOME/.mxctl.yaml
-h / --dbhost Database server host, default 127.0.0.1
-p / --dbport Database server port, default 5432
--debug Turn on debug log output
--help Print Help Information
--host The host that installs the supervisor/mxgate service, default 127.0.0.1
--mode Output format, support api/cli, default api
-W / --password Database user password
--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 Verification mode - Trial run
--verbose Turn on detailed log output
-v / --version Display tool version

3 Examples

mxpacklogs can be executed on a master node (Master) or non-Master. The details are as follows:

  • Execute on Master, it is recommended to use mxadmin users; if you use other users, you need to configure pg_hba trust.
  • Remote execution on non-Masters requires the following conditions:
    • Both the database server and the server that executes this command need to install a new version of MatrixDB (4.8.0 and above);
    • Just connect to Master by specifying relevant parameters.

Based on the above description, we recommend the following three ways of using it. In the example, mdw is Master and sdw is non-Master:

  1. Run the mxpacklogs command directly to indicate that the default current host is Master, and it will connect to the database to obtain all Segment logs.

    [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. Execute the following command on either server to specify the connection information to access Master, thereby achieving all Segment log acquisition (the same result as 1).

    [<username>@<server name> ~]$ 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

    Notes!
    1 and 2 both obtain information through the connection to the master, so the cluster master needs to be in a healthy state.

  3. Execute the following command on either server to collect only log information under the specified host (required) and data directory (optional).

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

    This command indicates that the log information of sdw1, sdw2 is collected, and the base-data-dirs of both machines are /mxdata_20221229075012.

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

    This command indicates that the log information of sdw1, sdw2 is collected, and the base-data-dirs of these two machines is different, one is /mxdata_20221229075012 and the other is /data1/mxdata_20221229075012.

Notes!
For more information about log content, please see Log.