This article applies to the scenario of independently deploying obdiag. Use the obdiag gather awr command to collect the AWR (Active Workload Repository) report of the OceanBase cluster with one click.
If it is a cluster deployed by obd, you can directly collect information on the selected cluster through the obd side diagnostic command group.
Description
AWR report collection relies on Enterprise Edition OCP. Please fill in the OCP login information (ocp.login.url, ocp.login.user, ocp.login.password) in the obdiag user configuration before use, and ensure that OCP can manage the OceanBase cluster to be diagnosed.
Instructions for use
obdiag gather awr [options]
The options are explained below:
Option name |
Is it required |
Data type |
Default value |
Description |
|---|---|---|---|---|
| --cluster_name | No | string | Default is empty | Cluster name in OCP, used to specify the cluster to collect AWR. |
| --cluster_id | No | string | Default is empty | Cluster ID in OCP, used alternatively or in conjunction with the --cluster_name option. |
| --from | No | string | Default is empty | AWR reporting time range starting point, format: yyyy-mm-dd hh:mm:ss. |
| --to | No | string | Default is empty | AWR report time range end point, format: yyyy-mm-dd hh:mm:ss. |
| --since | No | string | 30m |
The time range relative to the current time, format: <n><m|h|d>, where n represents the time number to be entered, m represents minutes, h represents hours, and d represents days, such as 1h represents the last hour. |
| --store_dir | No | string | Current directory | Local path to store results. |
| -c | No | string | ~/.obdiag/config.yml |
Configuration file path. |
| --inner_config | No | string | Default is empty | obdiag Self-configuration, format: --inner_config key=value. |
| --config | No | string | Default is empty | Cluster/OCP configuration, format: --config key1=value1 --config key2=value2. See obdiag configuration for details. |
| --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. For details, see Configuration File Encryption. |
Prerequisites
- Obdiag has been installed and user-side configuration has been completed.
- The OCP login information (
ocp.login.url,ocp.login.user,ocp.login.password) has been correctly filled in the configuration file. - OCP has managed the OceanBase cluster to be collected AWR, and the cluster can be accessed normally in OCP.
Usage example
Method 1: Use with configuration file (recommended)
After ensuring that OCP and obcluster information have been configured in ~/.obdiag/config.yml, execute:
# Collect last 30 minutes of AWR (default)
obdiag gather awr
# Collect last 1 hour of AWR
obdiag gather awr --since 1h
# Specify time range
obdiag gather awr --from "2024-01-15 10:00:00" --to "2024-01-15 11:00:00"
# Set cluster name in OCP and output directory
obdiag gather awr --cluster_name my_ob_cluster --store_dir ./awr_reports
Method 2: Pass configuration through --config (out-of-the-box)
When the default configuration file is not used, OCP and cluster information can be passed through --config (must include OCP login information and cluster identification):
obdiag gather awr --since 1h \
--config ocp.login.url=http://ocp.example.com:8080 \
--config ocp.login.user=admin \
--config ocp.login.password=****** \
--config db_host=xx.xx.xx.xx \
--config db_port=2881 \
--config tenant_sys.user=root@sys \
--config tenant_sys.password=****** \
--config obcluster.servers.global.ssh_username=admin \
--config obcluster.servers.global.ssh_password=****** \
--config obcluster.servers.global.home_path=/home/admin/oceanbase
Result description
After the command is successfully executed, a collection package (such as obdiag_gather_pack_yyyyMMddHHmmss) will be generated in the directory specified by --store_dir, which contains the AWR report file pulled from OCP, which can be used for performance analysis and troubleshooting.
FAQ
- Error message OCP connection failed: Please check whether the
ocp.login.url,ocp.login.user,ocp.login.passwordin the configuration are correct, and whether the current network can access OCP. - Error message indicating cluster not found: Please confirm that
--cluster_nameor--cluster_idis consistent with the cluster managed in OCP; if there is only one cluster in the configuration, you do not need to specify it, obdiag will use the cluster information in the configuration.
