This article will introduce the obdiag configuration file.
Description
For clusters deployed using obd, it is recommended to use the obd obdiag command to quickly use the diagnostic function. In this case, there is no need to configure the obdiag configuration file.
Prerequisites
Please make sure obdiag is installed, see Install obdiag for details.
Configuration instructions
There are two paths to the obdiag configuration file. One is the user-side configuration file, which supports custom paths. One is the system configuration file for obdiag's own use, which generally does not need to be modified. These two configuration files are introduced below.
User-side configuration file
The user-side configuration file can be quickly generated or directly edited through the obdiag config <option> command. The default path of the file is ~/.obdiag/config.yml, and its template file is located at ~/.obdiag/example.
obdiag config -h <db_host> -u <sys_user> [-p password] [-P port]
The configuration items are described as follows:
Parameter name |
Whether it is required |
Description |
|---|---|---|
| db_host | Yes | The connection address of the OceanBase cluster sys tenant. |
| sys_user | Yes | The connection user of the OceanBase cluster sys tenant. To avoid permission problems, it is recommended to use root@sys. When connecting through OBProxy, you need to include the cluster name (such as root@sys#obtest). |
| -p password | No | OceanBase cluster sys tenant connection password, default is empty. |
| -P port | No | OceanBase cluster sys tenant port, default is 2881. |
Example:
# Example: non-empty password
obdiag config -hxx.xx.xx.xx -uroot@sys -p***** -P2881
# Example: empty password
obdiag config -hxx.xx.xx.xx -uroot@sys -P2881
# Example: connect via OBProxy
obdiag config -hxx.xx.xx.xx -uroot@sys#obtest -p***** -P2883
After executing obdiag config, an interactive input will appear. Please fill in the correct information.
# obdiag config -hxx.xx.xx.xx -uroot@sys -Pxxxx -p*****
2024-01-31 09:57:24,019 [INFO] Getting all the node information of the cluster, please wait a moment ...
Please enter the following configuration !!!
Enter your oceanbase host ssh username (default:''): test # SSH username for OceanBase hosts
Enter your oceanbase host ssh password (default:''): ********* # SSH password for OceanBase hosts
Enter your oceanbase host ssh_port (default:'22'): 22 # SSH port (default 22)
Enter your oceanbase install home_path (default:'/root/observer'): /home/admin/oceanbase # OceanBase installation home_path
Enter your need config obproxy [y/N] (default:'N'): y # Whether to include OBProxy in the diagnosis
Enter your obproxy server eg:'192.168.1.1;192.168.1.2;192.168.1.3' (default:''): xx.xx.xx.xx # OBProxy node IPs
Enter your obproxy host ssh username (default:''): test # SSH username for OBProxy nodes
Enter your obproxy host ssh password (default:''): ********* # SSH password for OBProxy nodes
Enter your obproxy host ssh port (default:'22'): 22 # SSH port for OBProxy nodes (default 22)
Enter your obproxy install home_path (default:'/root/obproxy'): /home/admin/obproxy # OBProxy installation directory
2024-01-31 09:59:23,109 [INFO] Node information has been rewritten to the configuration file /test/.obdiag/config.yml, and you can enjoy the journey !
```<main id="notice" type='explain'>
<h4>Description</h4>
<p>Use the <code>config</code> command to enter interactive mode and fill in the information as prompted. Please fill it in according to the actual situation. </p>
</main>
After the execution is completed, a new configuration will be generated in `~/.obdiag/config.yml`. If the original file already has content, the old configuration will be backed up to the `~/.obdiag/backup_conf` directory.
<main id="notice" type='explain'>
<h4>Description</h4>
<p>If you need to encrypt the configuration file to protect sensitive information, you can use <code>obdiag tool crypto_config</code> to encrypt config.yml; pass the decryption password through <code>--config_password</code> when executing each subcommand. See <a href="800.tool/801.crypto_config.md">Configuration File Encryption</a> for details. </p>
</main>
A complete configuration is as follows, divided into three parts, and these three parts can be configured as needed.
```yaml
# Part 1: OCP-related
ocp:
login:
url: http://xx.xx.xx.xxx:xx
user: ****
password: ******
# Part 2: obcluster-related
obcluster:
ob_cluster_name: test # Cluster name
db_host: xx.xx.xx.1 # Cluster connection address
db_port: 2881 # default 2881
tenant_sys: # sys tenant; use root@sys to avoid permission issues
user: root@sys # Default root@sys
password: ""
servers:
nodes:
- ip: xx.xx.xx.1
- ip: xx.xx.xx.2
- ip: xx.xx.xx.3
global:
ssh_username: **** # SSH login; use the same user as observer deployment
ssh_password: **** # Use empty string if passwordless or no password
# ssh_port: 22 # SSH port (default 22)
# ssh_key_file: "" # SSH key path; use either this or ssh_password
# ssh_type: remote # Deployment: remote or docker (not kube); default remote
# container_name: xxx # Required for docker ssh_type: observer container name
# Observer home_path, e.g. if binary is /root/observer/bin/observer
# set home_path to /root/observer
home_path: /root/observer
data_dir: /root/observer/store # data_dir: usually ${home_path}/store (same idea as obd)
redo_dir: /root/observer/store # redo_dir: usually ${home_path}/store (same idea as obd)
# Part 3: OBProxy-related
obproxy:
obproxy_cluster_name: obproxy
servers:
nodes:
- ip: xx.xx.xx.4
- ip: xx.xx.xx.5
- ip: xx.xx.xx.6
global:
ssh_username: **** # SSH login; use the same user as OBProxy deployment
ssh_password: **** # Use empty string if passwordless or no password
# ssh_port: 22 # SSH port (default 22)
# ssh_key_file: "" # SSH key path; use either this or ssh_password
# ssh_type: remote # OBProxy deployment: remote or docker; default remote
# container_name: xxx # Required for docker: OBProxy container name
# OBProxy home_path, e.g. binary at /root/obproxy/bin/obproxy
# set home_path to /root/obproxy
home_path: /root/obproxy
The configuration under global has a lower priority than the configuration under a specific node. If it is configured under the node, the specific configuration under the node will be used. If the node is not configured with specific information, the configuration under global will be used.
For example, the configuration of obcluster below has its own configuration under each IP. Then the items under global that are the same as those configured under IP will be the actual configuration under IP.
obcluster:
ob_cluster_name: test
db_host: xx.xx.xx.1
db_port: 2881 # default 2881
tenant_sys:
user: root@sys # default root@sys
password: ""
servers:
nodes:
- ip: xx.xx.xx.1
ssh_username: ****
ssh_password: ****1
home_path: /root/observer1
data_dir: /root/observer/store1
redo_dir: /root/observer/store1
- ip: xx.xx.xx.2
ssh_username: ****2
ssh_password: ****2
home_path: /root/observer2
data_dir: /root/observer/store2
redo_dir: /root/observer/store2
- ip: xx.xx.xx.3
ssh_username: ****3
ssh_password: ****3
home_path: /root/observer3
data_dir: /root/observer/store3
redo_dir: /root/observer/store3
global:
ssh_port: 22
```<main id="notice" type='explain'>
<h4>Description</h4>
<ul>
<li><p>obdiag supports configuring ipv6 addresses since V3.2.0, example <code> ip: "xxxx:xxxx:xxx:xxxx:xxxx:xxxx:xxx:xxxx" </code></p></li>
<li><p>For more configuration examples, please refer to the files in the <code>~/.obdiag/example</code> directory. </p></li>
<li><p>If your OB cluster is deployed in docker mode, the configuration file can refer to <code>~/.obdiag/example/docker_ob_cluster.yml</code></p></li>
<li><p>If your OB cluster is deployed through ob-operator (k8s), the configuration file can refer to <code>~/.obdiag/example/operator.yml</code></p></li>
</ul>
</main>
### Do not use user-side configuration file processing method
obdiag >= version 2.4.0 supports passing the user-side configuration file through the `--config` parameter, allowing users to use obdiag out of the box without a configuration file. This section will introduce how to pass configuration through `--config`.
<main id="notice" type='explain'>
<h4>Description</h4>
<ul>
<li> <code>--config</code>'s parameter transfer can be used in combination, with fixed styles: --config key1=value1 --config key2=value2. </li>
<li> The nodes list in the original ~/.obdiag/config.yml style configuration file can be used to list the information of the same node by appending [num] after nodes, such as: obcluster.servers.nodes[0]. </li>
<li> The hierarchical relationship of configuration files in the original ~/.obdiag/config.yml style is distinguished by <code>.</code>. </li></ul>
</main>
The complete configuration, passed via `--config`, looks like this:
```bash
--config ocp.login.url=http://xx.xx.xx.xxx:xx \
--config ocp.login.user=**** \
--config ocp.login.password=****** \
--config obcluster.ob_cluster_name=test \
--config obcluster.db_host=xx.xx.xx.1 \
--config obcluster.db_port=2881 \
--config obcluster.tenant_sys.user=root@sys \
--config obcluster.tenant_sys.password="" \
--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.ssh_username=**** \
--config obcluster.servers.global.ssh_password=**** \
--config obcluster.servers.global.ssh_port=22 \
--config obcluster.servers.global.home_path=/root/observer \
--config obcluster.servers.global.data_dir=/root/observer/store \
--config obcluster.servers.global.redo_dir=/root/observer/store \
--config obproxy.obproxy_cluster_name=obproxy \
--config obproxy.servers.nodes[0].ip=xx.xx.xx.4 \
--config obproxy.servers.nodes[1].ip=xx.xx.xx.5 \
--config obproxy.servers.nodes[2].ip=xx.xx.xx.6 \
--config obproxy.servers.global.ssh_username=**** \
--config obproxy.servers.global.ssh_password=**** \
--config obproxy.servers.global.ssh_port=22 \
--config obproxy.servers.global.home_path=/root/obproxy
If you need to use an ipv6 address in the configuration, the example is as follows:
--config obcluster.servers.nodes[0].ip="xxxx:xxxx:xxx:xxxx:xxxx:xxxx:xxx:xxxa"
Of course, in order to save some input, obdiag supports abbreviations for some contents. The abbreviations are as follows:
Abbreviation |
Full configuration |
|---|---|
db_host |
obcluster.db_host |
db_port |
obcluster.db_port |
tenant_sys.user |
obcluster.tenant_sys.user |
tenant_sys.password |
obcluster.tenant_sys.password |
ssh_username |
obcluster.servers.global.ssh_username |
ssh_password |
obcluster.servers.global.ssh_password |
ssh_port |
obcluster.servers.global.ssh_port |
home_path |
obcluster.servers.global.home_path |
obproxy_home_path |
obproxy.servers.global.home_path |
System configuration file (obdiag’s own configuration)
The configuration file is located at /opt/oceanbase-diagnostic-tool/conf/inner_config.yml.
obdiag:
basic:
config_path: ~/.obdiag/config.yml # User-side config file path
config_backup_dir: ~/.obdiag/backup_conf # Backup path when obdiag config rewrites config
file_number_limit: 50 # Max number of files returned per gather on one remote host
file_size_limit: 5G # Max total size of files returned per gather on one remote host
dis_rsa_algorithms: 0 # Disable RSA algorithms for SSH compatibility (0=off)
strict_host_key_checking: 0 # SSH host key checking policy
logger:
log_dir: ~/.obdiag/log # obdiag execution log directory
log_filename: obdiag.log # obdiag log file name
file_handler_log_level: DEBUG # Minimum log level written to file
log_level: INFO # obdiag log level
mode: obdiag
stdout_handler_log_level: INFO # Minimum log level printed to stdout
error_stream: sys.stdout # Error log stream (default sys.stdout)
silent: false # Silent mode
ssh_client:
remote_client_sudo: 0 # Use sudo for remote commands (0=no)
cmd_exec_timeout: 180 # Remote command timeout in seconds
analyze:
thread_nums: 3
check: # Inspection settings; usually leave as default
ignore_version: false # Ignore OceanBase version check
work_path: "~/.obdiag/check" # Inspection working directory
ssh_manager: # Since V4.2.0: SSH connection pool
max_connections_per_node: 5 # Max SSH connections per node
idle_timeout: 300 # Idle connection timeout (seconds)
report:
report_path: "./check_report/" # Inspection report output path
export_type: table # Inspection report export format
tasks_base_path: "~/.obdiag/check/tasks/" # Base directory of inspection tasks
gather:
scenes_base_path: "~/.obdiag/gather/tasks" # gather scenario task directory
redact_processing_num: 3
thread_nums: 3
rca:
result_path: "./obdiag_rca/" # RCA result output path
obdiag >= version 2.4.0 supports passing the system configuration of obdiag through the --inner_config parameter. This section will introduce how to pass configuration through --inner_config.
Description
- The parameter passing of
inner_configcan be superimposed, and the fixed style is: --inner_config key1=value1 --inner_config key2=value2. - The hierarchical relationship of configuration files in the original /opt/oceanbase-diagnostic-tool/conf/inner_config.yml style is distinguished by
..
An example of configuration passed through --inner_config is as follows:
# Limit file count and size
--inner_config obdiag.basic.file_number_limit=20
--inner_config obdiag.basic.file_size_limit=2G
# Disable RSA algorithms
--inner_config obdiag.basic.dis_rsa_algorithms=1
# Use markdown output when obdiag silent mode is on
--inner_config obdiag.logger.silent=true
--inner_config obdiag.logger.silent_type=md
