This topic describes two methods for installing oblogminer: using the YUM command and using an installation package. You can choose the method that suits your needs.
Note
This topic describes how to install the Community Edition of oblogminer. The Enterprise Edition of oblogminer is automatically installed when you deploy the Enterprise Edition of OceanBase Database (oceanbase/bin).
Install by using the YUM command
You can install OceanBase Database by using the YUM command to install the OceanBase Database tool package (OceanBase Utils). When you install OceanBase Database by using the YUM command, oblogminer is installed in the /usr/bin/ directory.
Add the image source.
[admin@test001 ~]$ sudo yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repoInstall OceanBase Utils.
[admin@test001 ~]$ sudo yum install oceanbase-ce-utilsView the help information of oblogminer.
After the installation is completed, you can execute the following command to view the help information of oblogminer.
[admin@test001 ~]$ oblogminer -h
Install by using the OceanBase Utils installation package
You can install oblogminer by installing OceanBase Utils.
Go to OceanBase Download Center, search for OceanBase Utils, and download the required version.
In the directory where OceanBase Utils is stored, execute the following command to install OceanBase Utils.
[admin@test001 ~]$ sudo rpm -ivh oceanbase-ce-utils-<version>.rpmIf you only need to use oblogminer, you can execute the following rpm2cpio command to obtain oblogminer.
[admin@test001 ~]$ rpm2cpio oceanbase-ce-utils-<version> | cpio -idmv ./usr/bin/oblogminerAfter you execute the rpm2cpio command, you can execute the following command to copy
oblogminerto the/usr/local/bindirectory.[admin@test001 ~]$ sudo cp usr/bin/oblogminer /usr/local/binView the help information of oblogminer.
After the installation is completed, you can execute the following command to view the help information of oblogminer.
[admin@test001 ~]$ oblogminer -h
Compile from source code
You can also compile oblogminer by using the source code of OceanBase Database.
Clone the open-source code of OceanBase Database to your local server.
[admin@test001 ~]$ git clone https://github.com/oceanbase/oceanbase.gitIn the code directory, execute the following command to switch to the 4.2.x branch.
[admin@test001 oceanbase]$ git checkout 4.2.xCompile oblogminer in the required mode.
Debug mode
Execute the build.sh script and specify the debug mode.
[admin@test001 oceanbase]$ bash build.sh debug --initGo to the compilation directory.
[admin@test001 oceanbase]$ cd build_debugCompile oblogminer.
[admin@test001 build_debug]$ make oblogminerCopy the compiled output to the
/usr/local/bindirectory.[admin@test001 build_debug]$ sudo cp src/logservice/logminer/oblogminer /usr/local/binBy default, the compiled output of oblogminer is stored in the
<DEBUG_BUILD_DIR>/src/logservice/logminerdirectory. In this directory,<DEBUG_BUILD_DIR>indicates the compilation directory, which isbuild_debugin the debug mode.Release mode
Execute the build.sh script and specify the release mode.
[admin@test001 oceanbase]$ bash build.sh release --initGo to the compilation directory.
[admin@test001 oceanbase]$ cd build_releaseCompile oblogminer.
[admin@test001 build_release]$ make oblogminerCopy the compiled output to the
/usr/local/bindirectory.[admin@test001 build_release]$ sudo cp src/logservice/logminer/oblogminer /usr/local/binBy default, the compiled output of oblogminer is stored in the
<DEBUG_BUILD_DIR>/src/logservice/logminerdirectory. In this directory,<DEBUG_BUILD_DIR>indicates the compilation directory, which isbuild_releasein the release mode.
View the help information of oblogminer.
After the compilation is completed, you can execute the following command to view the help information of oblogminer.
[admin@test001 ~]$ oblogminer -h
FAQ
When you use oblogminer, if the libmariadb.so.3 dynamic library is missing, an error similar to the following is returned:
oblogminer: error while loading shared libraries: libmariadb.so.3: cannot open shared object file: No such file or directory
OceanBase Database provides the libmariadb.so.3 dynamic library. You can run the find command to find the path of the libmariadb.so.3 dynamic library and specify the dynamic library search path in the environment variable. The specific operation is as follows:
Run the find command to find the path of the
libmariadb.so.3dynamic library.[admin@test001 ~]$ find / -name libmariadb.so.3If the
libmariadb.so.3dynamic library exists in the environment, the path of the dynamic library is returned, as shown in the following example:/home/admin/observer/lib/libmariadb.so.3Specify the dynamic library search path in the
LD_LIBRARY_PATHenvironment variable.[admin@test001 ~]$ export LD_LIBRARY_PATH=/home/admin/observer/lib
After you complete the preceding steps, you can run oblogminer commands. For more information about oblogminer commands, see Command-line parameters.
