ob_admin is an O&M tool for OceanBase Database. This topic describes the installation procedure and features of ob_admin.
Installation procedure
Install ob_admin by using YUM commands
You can use YUM commands to directly install OceanBase Utils and then use ob_admin.
Install OceanBase Utils by using YUM commands.
yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo yum install oceanbase-ce-utilsAfter the installation is completed, you can use the features of ob_admin.
To view the help description of dumpsst, run the following command:
ob_admin dumpsst -h
Install ob_admin by using the ob_utils installation package
You can install OceanBase Utils and then use ob_admin.
Search for
OceanBase Utilsin the OceanBase Download Center and then download the required version to your local server.Run the following command in the file directory to install OceanBase Utils.
rpm -ivh oceanbase-ce-utils-<version>If you only need
ob_admin, run therpm2cpiocommand to obtainob_admin.rpm2cpio oceanbase-ce-utils-<version> | cpio -idmv ./usr/bin/ob_admin cp usr/bin/ob_admin /usr/local/binAfter the installation is completed, you can use the features of ob_admin.
To view the help description of dumpsst, run the following command:
ob_admin dumpsst -h
Build ob_admin by compiling the source code
You can compile the source code of OceanBase Database to build ob_error.
Clone the open-source code of OceanBase Database to your local server.
git clone https://github.com/oceanbase/oceanbaseCompile ob_admin in the following modes:
Debug mode
bash build.sh debug --init cd build_debug make ob_admin cp tools/ob_admin/src/ob_admin /usr/local/binBy default, after you compile
ob_admin, you can find the compiled files in theDEBUG_BUILD_DIR/tools/ob_admin/src/ob_admindirectory.DEBUG_BUILD_DIRindicates the compilation directory, which isbuild_debugin this example.Release mode
bash build.sh release --init cd build_release make ob_admin cp tools/ob_admin/src/ob_admin /usr/local/binBy default, after you compile
ob_admin, you can find the compiled files in theRELEASE_BUILD_DIR/tools/ob_admin/src/ob_admindirectory.RELEASE_BUILD_DIRRindicates the compilation directory, which isbuild_releasein this example.
After the installation is completed, you can use the features of ob_admin.
To view the help description of dumpsst, run the following command:
ob_admin dumpsst -h
FAQ
If the libmariadb.so.3 dynamic library is missing when you use ob_admin, perform the following operations to resolve the issue.
Here is an example of an issue:
$ ob_admin dumpsst -h ob_admin: error while loading shared libraries: libmariadb.so.3: cannot open shared object file: No such file or directoryThe
libmariadb.so.3dynamic library is built in OceanBase Database. You can use thefindcommand to find its path.In this example, the installation path of OceanBase Database is
/home/admin/observer.$ find / -name libmariadb.so.3 /home/admin/observer/lib/libmariadb.so.3Set the
LD_LIBRARY_PATHenvironment variable to specify the dynamic library search path.$ export LD_LIBRARY_PATH=/home/admin/observer/libNow you can use the features of ob_admin.
$ ob_admin dumpsst -h
Features
ob_admin provides the slog_tool, log_tool, dumpsst, and dump_backup features to troubleshoot issues such as data inconsistency, data loss, and data errors. The following sections describe these features respectively.
slog_tool
slog_tool displays the content of slog files. The command syntax is as follows:
$./ob_admin slog_tool -f ../store/slog/1
Note
The path in the slog_tool command must begin with a period (.) or slash (/).
Clogs
A clog file contains many types of logs. As the predominant log type, OB_LOG_SUBMIT indicates the logs committed by modules other than the clog module, including the clogs committed by the transaction module.
Notice
Only the files generated during operation of observer processes can be stored in the clog directory. Therefore, do not use ob_admin in the clog directory.
log_tool
You can use log_tool to perform the following operations:
- Provide content of the
dump clogfiles. - Measure the proportion of each module in the clog files.
- Search for logs by a specified field.
For more information, see clog_tool.
dumpsst
dumpsst displays the content in block_file, such as superblocks, macroblocks, macroblock meta, SSTables, and SSTable meta. Generally, you can use it to trace online issues and locate data issues. For more information, see dumpsst.
dump_backup
dump_backup parses the data content for physical backup. For more information, see dump_backup.
Note
ob_admin specifies the log printing level by using the OB_ADMIN_LOG_LEVEL environment variable, which can be set to DEBUG, TRACE, INFO, WARNING, or ERROR.