This article applies to the scenario of independently deploying obdiag. Use the obdiag analyze queue command to analyze the logs of the OceanBase cluster and generate a queue backlog analysis report based on the memory information printed in the logs.
If it is a cluster deployed by obd, you can directly analyze the selected cluster through the obd side diagnostic command group.
Instructions for use
obdiag analyze queue [options]
Use this command to analyze the logs of the OceanBase cluster online with one click, and analyze whether there is a queue backlog based on the queue information printed in the logs.
The options are explained below:
Option name |
Is it required |
Data type |
Default value |
Description |
|---|---|---|---|---|
| --tenant | Yes | string | Default is empty | Specify the tenant name to be analyzed. |
| --from | No | string | Default is empty | The start time of log collection, the format is: yyyy-mm-dd hh:mm:ss.
ExplanationIf the obdiag used is a version before V2.0.0, there is no need to add quotation marks when configuring this option, otherwise an error will be reported. V2.0.0 and later versions no longer limit whether to include quotes when configuring this option. |
| --to | No | string | Default is empty | The end time of log collection, the format is: yyyy-mm-dd hh:mm:ss.
ExplanationIf the obdiag used is a version before V2.0.0, there is no need to add quotation marks when configuring this option, otherwise an error will be reported. V2.0.0 and later versions no longer limit whether to include quotes when configuring this option. |
| --since | No | string | 30m |
Analyze the most recent period of time, the format is: <n><m|h|d>, for example, 30m means the last 30 minutes. |
| --store_dir | No | string | Defaults to the current path where the command is executed | The local path where the results are stored. |
| --temp_dir | No | string | /tmp |
The temporary file storage directory generated by the remote node during the log collection process. |
| --queue | No | int | Default is 50 | Threshold for queue backlog. |
| -c | No | string | ~/.obdiag/config.yml |
Configuration file path. |
| --inner_config | No | string | Default is empty | obdiag's own configuration. |
| --config | No | string | Default is empty | Configuration of the cluster to be diagnosed by obdiag, fixed style: --config key1=value1 --config key2=value2.
ExplanationParameters that support configuration through this option can be found in obdiag configuration. |
| --config_password | No | string | Default is empty | obdiag When using an encrypted configuration file, you need to pass in the corresponding password through this option.
ExplanationFor details, please see Configuration file encryption. |
Usage example
Method 1: Use without configuration file (out of the box)
- Online analysis log example:
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.2 \
--config obcluster.servers.global.ssh_username=test \
--config obcluster.servers.global.ssh_password=****** \
--config obcluster.servers.global.home_path=/home/admin/oceanbase
```* Quickly analyze the logs of the recent period:
```shell
# Online: queue backlog analysis on the last hour of logs from remotes
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.2 \
--config obcluster.servers.nodes[2].ip=xx.xx.xx.3 \
--config obcluster.servers.global.home_path=/home/admin/oceanbase
# Online: queue backlog analysis on the last hour of logs from remotes
# Provide sys tenant connection; obdiag resolves cluster node addresses
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
# Online: last 30 minutes queue backlog report
# Provide sys tenant connection; obdiag resolves cluster node addresses
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 with configuration file
You need to ensure that the login information of the node to be collected has been configured in the obdiag configuration file ~/.obdiag/config.yml. For related detailed configuration introduction, see obdiag configuration.
- Online analysis log example:
obdiag analyze queue --tenant=testA --from "2023-10-08 10:25:00" --to "2023-10-08 11:30:00"
```* Quickly analyze the logs of the recent period:
```shell
# Online: analyze the last hour of logs pulled from remote hosts
obdiag analyze queue --tenant=testA --since 1h
# Online: analyze last 30 minutes of logs from remotes
obdiag analyze queue --tenant=testA --since 30m
