This topic describes how to upgrade the Change Data Capture (CDC) library of OceanBase Database manually or by using the OceanBase CDC (obcdc) tool.
Background information
OceanBase Database of each version provides a corresponding CDC library for pulling incremental logs. The Store component of OceanBase Migration Service (OMS) Community Edition loads the CDC dynamic library to pull incremental data from OceanBase Database.
The following table lists the subdirectories in the /home/ds/lib64/reader directory of the Store component that are corresponding to OceanBase CDC libraries of different versions.
| CDC library directory | OceanBase Database version supported for upgrades |
|---|---|
| ob-ce-reader | Upgrades not supported |
| ob-ce-4.x-reader | OceanBase Database V4.0.0 to V4.2.1 |
| ob-ce-4.2.2-reader | OceanBase Database V4.2.2 to V4.3.0 |
| ob-ce-4.3-reader | OceanBase Database V4.3.0 to versions prior to V4.4.x |
| ob-ce-4.4-reader | OceanBase Database V4.4.x and later versions |
Upgrade the CDC library by using obcdc
Download the RPM package of obcdc from OceanBase Download Center.
Find the OB CDC panel, click the version number in the upper right corner, select the version of your database, and download the RPM package for the corresponding system architecture.
Load the RPM package to the container of OMS Community Edition, and run the CDC library update script.
Notice
Before you run the update script, back up the files in the
/home/ds/lib64/reader/ob-ce-xxx-readerdirectory.# Enter the container. sudo docker exec -it [Container name] bash # Run the CDC library update script. cd /root bash obcdc_update.sh [RPM package path] # Example bash obcdc_update.sh /home/ds/oceanbase-ce-cdc-4.2.1.10-110000022024112010.el7.x86_64.rpmUpgrade the CDC library as prompted.
obcdc first confirms with you whether the version of the CDC library is 4.x.
Enter y to proceed. Enter n to exit.
If you enter y, obcdc starts decompressing the RPM package.
obcdc starts upgrading the CDC library.
After the CDC library is upgraded, obcdc confirms with you whether to upgrade the CDC libraries for existing Store components.
Enter y to proceed. Enter n to end the upgrade process.
If you enter y, perform the following operations:
Enter all to upgrade CDC libraries in all
/home/ds/store/store{port}directories.Specify specific Store components as needed in the format of
store{port}. Separate them with commas (,), for example, store7100,store7101,store7102.Enter exit to end the upgrade process.
After you upgrade the CDC library for an existing Store component, restart the Store component to check whether its pullback timestamp is updated.
Manually upgrade the CDC library
Download the RPM package of obcdc from OceanBase Download Center.
Find the OB CDC panel, click the version number in the upper right corner, select the version of your database, and download the RPM package for the corresponding system architecture.
Run the following command to decompress the RPM package:
rpm2cpio oceanbase-ce-cdc-x.x.x.x-xxxx.el7.x86_64.rpm|cpio -idmu --quiet.Notice
OMS Community Edition supports only an el7 architecture.
After the decompression, the following files appear in the
./home/admin/oceanbase/lib64directory:libobcdc.so.x.x.x.x libobcdc.so.x -> libobcdc.so.x.x.x.x libobcdc.so -> libobcdc.so.xLog in to the container of OMS Community Edition and run the
cdcommand to go to the/home/ds/lib64/readerdirectory. Find the correspondingob-ce-xxx-readerdirectory based on the version of OceanBase Database.Back up the original files in the
ob-ce-xxx-readerdirectory.Copy the files in the
./home/admin/oceanbase/lib64directory extracted from the RPM package to theob-ce-xxx-readerdirectory.
Then, all new Store components will use the upgraded CDC library. If you want an existing Store component to use the upgraded CDC library, perform the following steps:
Go to the working directory
/home/ds/store/store{port}/lib64/readerof the Store component. The directory structure is consistent with that of/home/ds/lib64/reader.Copy the files in the
./home/admin/oceanbase/lib64directory extracted from the RPM package to the/home/ds/store/store{port}/lib64/reader/ob-ce-xxx-readerdirectory.Log in to the console of OMS Community Edition and pause the Store component. For more information, see Start and pause a store.
Run the following command to check whether the Store process has been stopped. If not, run the
kill -9command.ps -ef|grep store{port}In the console of OMS Community Edition, start the Store component.