Since V4.0.0, obdiag supports verifying the connection status of the cluster configured in the configuration file through the obdiag tool config_check command. This article will introduce the specific usage.
Function introduction
This command is used to verify whether the database connection and SSH connection in the obdiag configuration file are normal, helping users quickly locate the node with failed connection.
Notes
- It is recommended to run configuration verification before executing other obdiag commands to ensure that the connection is normal.
- This command will try to connect to all nodes in the configuration file, which may take some time.
- If using SSH key authentication, make sure the key file path is correct and permissions are set correctly.
Command introduction
You can configure the -h option after the command to view command help:
obdiag tool config_check -h
The output is as follows:
Usage: obdiag tool config_check [options]
Options:
-c CONFIG config file path
--config_password=CONFIG_PASSWORD
config password
-h, --help Show help and exit.
-v, --verbose Activate verbose output.
The options are explained below:
Option name |
Is it required |
Data type |
Default value |
Description |
|---|---|---|---|---|
| -c | No | string | ~/.obdiag/config.yml |
Configuration file path. |
| --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. |
Usage example
Verify default configuration file
obdiag tool config_check
Output example (connection successful):
Config Check Result:
+-------------------+------------------+---------+
| Check Item | Target | Status |
+===================+==================+=========+
| DB Connection | xx.xx.xx.xx:2881 | Success |
+-------------------+------------------+---------+
| SSH Connection | xx.xx.xx.xx | Success |
+-------------------+------------------+---------+
| SSH Connection | xx.xx.xx.yy | Success |
+-------------------+------------------+---------+
| SSH Connection | xx.xx.xx.zz | Success |
+-------------------+------------------+---------+
All checks passed!
Example output (connection failed):
Config Check Result:
+-------------------+------------------+---------+---------------------------+
| Check Item | Target | Status | Error |
+===================+==================+=========+===========================+
| DB Connection | xx.xx.xx.xx:2881 | Failed | Connection refused |
+-------------------+------------------+---------+---------------------------+
| SSH Connection | xx.xx.xx.xx | Success | |
+-------------------+------------------+---------+---------------------------+
| SSH Connection | xx.xx.xx.yy | Failed | Authentication failed |
+-------------------+------------------+---------+---------------------------+
| SSH Connection | xx.xx.xx.zz | Success | |
+-------------------+------------------+---------+---------------------------+
Some checks failed! Please fix the configuration.
Verify the specified configuration file
obdiag tool config_check -c /path/to/config.yml
Verify encrypted configuration file
obdiag tool config_check -c ~/.obdiag/config.yml.encrypted --config_password=<your_secret_key>
Check item description
Check items |
Description |
|---|---|
| DB Connection | Check whether the database connection is normal, including db_host, db_port, tenant_sys.user, tenant_sys.password and other configurations. |
| SSH Connection | Check whether the SSH connection of each OBServer node is normal, including configurations such as ip, ssh_username, ssh_password or ssh_key_file. |
Common errors and solutions
Error Message |
Possible Cause |
Solution |
|---|---|---|
| Connection refused | The database service is not started or the port is wrong | Check whether the OBServer node is running normally and confirm that the port configuration is correct |
| Authentication failed | Wrong username or password | Check if the username and password in the configuration file are correct |
| Host unreachable | The network is unreachable | Check the network connection and confirm that the IP address is correct |
| Permission denied | SSH key permission issues | Check the key file permissions and make sure the permissions are 600 |
