Quick Start
Simulate Time Series Scenarios
Standard Cluster Deployment
Data Modeling
Connecting to The database
Data Writing
Data Migration
Data Query
Scene Application Examples
Federal Query
Maintenance and Monitoring
Global Maintenance
Partition Maintenance
Backup and Restore
Cluster Expansion
Monitoring
Performance Tuning
Troubleshooting
Reference Guide
Tool Guide
Data Type
Storage Engine
Execution Engine
Configuration Parameters
SQL Reference
FAQ
This document describes the log collection and packaging tool mxpacklogs.
Features
mxpacklogs tool supports one-click collection and packaging of logs from all nodes in a distributed cluster.Limitations
mxpacklogs command is executed. These logs are temporarily stored under the *.tar.gz directory as a /tmp package. mxpacklogs automatically selects the disk with the largest available free space that the user has read and write permissions for storing these packages.--hosts and --base-data-dirs options to retrieve log information.The following table lists the detailed command-line options:
| Option | Description |
|---|---|
--base-data-dirs |
Optional. By default, the tool reads data directories from database metadata. Only specify this when the database is inaccessible. Provide up to the mxdata_xxxx directory level; mxpacklogs will auto-complete the rest. Example: mxpacklogs --base-data-dirs /data/mxdata_20230324145536 |
--hosts |
--host: Collects logs from all hosts in the cluster by default. Use -- hosts to collect logs only from specific Segment hosts, reducing disk and time overhead. Examples: 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 |
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: api or cli. Default: "api" |
-W / --password |
Database user password |
--path |
MatrixDB installation path on supervisor host. Default: "/opt/ymatrix/matrixdb5" |
--port |
Supervisor server port. Default: "4617" |
-U / --username |
Database username. Default: "mxadmin" |
--validate |
Validation mode – dry run |
--verbose |
Enable verbose log output |
-v / --version |
Show tool version |
mxpacklogs can be executed on either the Master node or a non-Master node. Details:
mxadmin user. If another user is used, configure pg_hba trust accordingly.Based on the above, we recommend the following three usage scenarios. In the examples below, mdw is the Master and sdw is a non-Master host:
Run mxpacklogs 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
Run the following command on any host, specifying connection details to the Master, to collect logs from all Segments (same result as example 1).
[<user>@<hostname> ~]$ 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 both require connecting to the Master. Therefore, the cluster's Master must be in a healthy state.
[<user>@sdw ~]$ mxpacklogs --hosts sdw1,sdw2 --base-data-dirs /mxdata_20221229075012
This command collects logs from sdw1 and sdw2, assuming both hosts have their base-data-dirs set to /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 logs, see Log.