If OceanBase Diagnostic Tool (obdiag) is independently deployed, you can run the obdiag analyze queue command to analyze logs of an OceanBase cluster and generate a queue backlog analysis report based on the queue information in the logs.
If your OceanBase cluster is deployed by using OceanBase Deployer (obd), you can run obdiag commands on obd to analyze the cluster. For more information about the commands, see obdiag commands.
Syntax
obdiag analyze queue [options]
You can run this command to analyze logs of an OceanBase cluster online and determine whether a queue backlog occurs based on the queue information in the logs.
The following table describes the options.
| Option | Required | Data type | Default value | Description |
|---|---|---|---|---|
| --tenant | Yes | string | Empty | The name of the tenant to analyze. |
| --from | No | string | Empty | The start time of log collection in the yyyy-mm-dd hh:mm:ss format. |
| --to | No | string | Empty | The end time of log collection in the yyyy-mm-dd hh:mm:ss format. |
| --since | No | string | Empty | The most recent period of time for log collection, in the <n> <m|h|d> format, where n specifies the time value, m represents "minute", h represents "hour", and d represents "day". For example, 30m specifies to analyze logs of the last 30 minutes. |
| --store_dir | No | string | The current path where the command is executed | The local path where the results are stored. |
| --temp_dir | No | string | /tmp |
The directory where temporary files generated by the remote node during log collection are stored. |
| --queue | No | int | 50 | The threshold for determining whether there is a queue backlog. |
| -c | No | string | ~/.obdiag/config.yml |
The path of the configuration file. |
| --inner_config | No | string | Empty | The configurations of obdiag. |
| --config | No | string | Empty | The configurations of the cluster diagnosed by obdiag, in the format of --config key1=value1 --config key2=value2.
NoteFor information about the parameters supported by this option, see Configure obdiag. |
Examples
Method 1: Use the command out-of-the-box without a configuration file
Analyze logs online
obdiag analyze queue --tenant=sys --from "2023-10-08 10:25:00" --to "2023-10-08 11:30:00" \ --config obcluster.servers.nodes[0].ip=xx.xx.xx.1 \ --config obcluster.servers.nodes[1].ip=xx.xx.xx.xx.2 \ --config obcluster.servers.global.ssh_username=test \ --config obcluster.servers.global.ssh_password=****** \ --config obcluster.servers.global.home_path=/home/admin/oceanbaseQuickly analyze logs of a recent period
# Analyze the logs of the last hour online. When you run this command, obdiag pulls the logs of the last hour from remote hosts to analyze queue backlogs. obdiag analyze queue --tenant=sys --since 1h \ --config obcluster.servers.nodes[0].ip=xx.xx.xx.1 \ --config obcluster.servers.nodes[1].ip=xx.xx.xx.xx.2 \ --config obcluster.servers.nodes[2].ip=xx.xx.xx.xx.3 \ --config obcluster.servers.global.home_path=/home/admin/oceanbase # Analyze the logs of the last hour online. When you run this command, obdiag pulls the logs of the last hour from remote hosts to analyze queue backlogs. # Specify the connection information of the sys tenant so that obdiag automatically obtains the IP addresses of all nodes in the cluster. obdiag analyze queue --tenant=sys --since 1h \ --config db_host=xx.xx.xx.xx \ --config db_port=xxxx \ --config tenant_sys.user=root@sys \ --config tenant_sys.password=*** \ --config obcluster.servers.global.ssh_username=test \ --config obcluster.servers.global.ssh_password=****** \ --config obcluster.servers.global.home_path=/home/admin/oceanbase # Analyze the logs of the last 30 minutes online and generate a queue backlog analysis report. # Specify the connection information of the sys tenant so that obdiag automatically obtains the IP addresses of all nodes in the cluster. obdiag analyze queue --tenant=sys --since 30m \ --config db_host=xx.xx.xx.xx \ --config db_port=xxxx \ --config tenant_sys.user=root@sys \ --config tenant_sys.password=*** \ --config obcluster.servers.global.ssh_username=test \ --config obcluster.servers.global.ssh_password=****** \ --config obcluster.servers.global.home_path=/home/admin/oceanbase
Method 2: Use the command with a configuration file
Before you use obdiag, make sure that you have configured the login information of the target nodes in the config.yml file in the ~/.obdiag directory. For more information, see Configure obdiag.
Analyze logs online
obdiag analyze queue --tenant=testA --from "2023-10-08 10:25:00" --to "2023-10-08 11:30:00"Quickly analyze logs of a recent period
# Analyze the logs of the last hour online. When you run this command, obdiag pulls and analyzes the logs of the last hour from remote hosts. obdiag analyze queue --tenant=testA --since 1h # Analyze the logs of the last 30 minutes online. When you run this command, obdiag pulls and analyzes the logs of the last 30 minutes from remote hosts. obdiag analyze queue --tenant=testA --since 30m