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
    • All logs of the specified server are summarized on the host that currently executes the mxpacklogs command and are temporarily stored in the form of *.tar.gz package under /tmp. mxpacklogs will automatically select the disk with the largest remaining space that the user can read and write to store these packages.
    • 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 Optional. The data directory in the database meta information is accessed by default. This parameter is only required if the database is not accessible. It can be provided to the mxdata_xxxx directory level, and the subsequent mxpacklogs will be automatically filled. For example: mxpacklogs --base-data-dirs /data/mxdata_20230324145536
--hosts --host means that the logs of all hosts in the cluster are collected by default. --hosts can collect logs of hosts of a specific segment to avoid excessive space and time overhead. For example: mxpacklogs --hosts sdw1,sdw2 or mxpacklogs --hosts sdw1 --hosts sdw2
-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, api or cli, default "api"
-W / --password Database user password
--path The matrixdb installation path on the supervisor host, default "/opt/ymatrix/matrixdb5"
--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 new versions of YMatrix (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>@<servername> ~]$ 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.