This topic describes how to switch the synchronization mode between primary and standby tenants by using obd. You can switch the synchronization mode between network-based and archive-based.
Prerequisites
The source tenant (primary or standby tenant) has been backed up and archived. For more information, see the Tenant backup section in Backup and restore.
Procedure
Assume that two clusters, clusterA and clusterB, exist. User tenant A_a is created in clusterA, and the standby tenant B_a is created in clusterB by using the network-based synchronization mode. This example shows how to switch the synchronization mode between A_a and B_a from network-based to archive-based.
Switch the synchronization mode.
obd cluster tenant switch-log-source clusterB B_a --type=LOCATION -a 'oss://oceanbase-test-bucket/backup/log?host=****.aliyun-inc.com&access_id=****&access_key=****&delete_mode=delete&checksum_type=md5'For more information about the command, see obd cluster tenant switch-log-source in Cluster commands.
The command output is as follows:
Get local repositories ok obshell program health check ok Check obshell version ok Get deployment connections ok source type check ok standby uri checking ok switching log resource ok Trace ID: 588ffb14-42ab-11f0-b3d9-00163e49531b If you want to view detailed obd logs, please run: obd display-trace 588ffb14-42ab-11f0-b3d9-00163e49531bView the tenant information.
obd cluster tenant show clusterB -t B_a -gThe output is as follows. The
primary_tenant_infofield shows the path of the archive log directory, indicating that the synchronization mode has been switched to archive-based.+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | tenant basic info | +-------------+-------------+--------------------+--------------+---------+---------+-------------+---------------------+---------------------+---------------+-------------+-------------+ | tenant_name | tenant_type | compatibility_mode | primary_zone | max_cpu | min_cpu | memory_size | max_iops | min_iops | log_disk_size | iops_weight | tenant_role | +-------------+-------------+--------------------+--------------+---------+---------+-------------+---------------------+---------------------+---------------+-------------+-------------+ | B_a | USER | MYSQL | RANDOM | 2.0 | 2.0 | 4G | 10000 | 10000 | 5G | 2 | STANDBY | +-------------+-------------+--------------------+--------------+---------+---------+-------------+---------------------+---------------------+---------------+-------------+-------------+ +-----------------------------------------------------------------------------------------------------------------------------------------------------------------+ | standby tenant standby info | +---------------------+---------------+-------------+----------------------------+----------+---------------+-------------------+------------------+--------------+ | standby_tenant_name | tenant_status | sync_status | sync_scn_timestamp | err_code | error_comment | switchover_status | switchover_epoch | log_mode | +---------------------+---------------+-------------+----------------------------+----------+---------------+-------------------+------------------+--------------+ | B_a | NORMAL | NORMAL | 2025-06-06 15:46:42.566389 | 0 | | NORMAL | 0 | NOARCHIVELOG | +---------------------+---------------+-------------+----------------------------+----------+---------------+-------------------+------------------+--------------+ +----------------------------------------------------------------------------------------------------------------------+ | standby tenant`s primary info | +---------------------+------------------------------------------------------------------------------------------------+ | standby_tenant_name | primary_tenant_info | +---------------------+------------------------------------------------------------------------------------------------+ | B_a | oss://oceanbase-test-bucket/backup/log?host=****.aliyun-inc.com&access_id=****&access_key=**** | +---------------------+------------------------------------------------------------------------------------------------+ query primary-standby relation ok primary-standby relation topology graph clusterA:A_a └── clusterB:B_a
Background information
If the primary tenant does not have complete logs but you want to use the network-based synchronization mode, you can first create a standby tenant by using archive-based synchronization. After the standby tenant is created, you can switch the synchronization mode between the primary and standby tenants to network-based. For more information about how to create a standby tenant by using archive-based synchronization, see Create a standby tenant.
Prerequisites
The logs of the standby tenant have been continuously synchronized with those of the primary tenant. The command is obd cluster tenant recover. For more information about the command, see obd cluster tenant recover in Cluster commands.
Procedure
Assume that two clusters, clusterA and clusterB, exist. User tenant A_a is created in clusterA, and the standby tenant B_a is created in clusterB by using archive-based synchronization. This example shows how to switch the synchronization mode between A_a and B_a from archive-based to network-based.
Switch the synchronization mode.
obd cluster tenant switch-log-source clusterB B_a --type=SERVICE -p *******For more information about the command, see obd cluster tenant switch-log-source in Cluster commands.
The command output is as follows:
Get local repositories ok obshell program health check ok Check obshell version ok Get deployment connections ok source type check ok Create standbyro user ok switching log resource ok Trace ID: 5b8a866e-42aa-11f0-8eff-00163e49531b If you want to view detailed obd logs, please run: obd display-trace 5b8a866e-42aa-11f0-8eff-00163e49531bView the tenant information.
obd cluster tenant show clusterB -t B_a -gThe output is as follows. The
primary_tenant_infofield shows the information of the primary tenant, indicating that the synchronization mode has been switched to network-based.+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | tenant basic info | +-------------+-------------+--------------------+--------------+---------+---------+-------------+---------------------+---------------------+---------------+-------------+-------------+ | tenant_name | tenant_type | compatibility_mode | primary_zone | max_cpu | min_cpu | memory_size | max_iops | min_iops | log_disk_size | iops_weight | tenant_role | +-------------+-------------+--------------------+--------------+---------+---------+-------------+---------------------+---------------------+---------------+-------------+-------------+ | B_a | USER | MYSQL | RANDOM | 2.0 | 2.0 | 4G | 10000 | 10000 | 5G | 2 | STANDBY | +-------------+-------------+--------------------+--------------+---------+---------+-------------+---------------------+---------------------+---------------+-------------+-------------+ +-----------------------------------------------------------------------------------------------------------------------------------------------------------------+ | standby tenant standby info | +---------------------+---------------+-------------+----------------------------+----------+---------------+-------------------+------------------+--------------+ | standby_tenant_name | tenant_status | sync_status | sync_scn_timestamp | err_code | error_comment | switchover_status | switchover_epoch | log_mode | +---------------------+---------------+-------------+----------------------------+----------+---------------+-------------------+------------------+--------------+ | B_a | NORMAL | NORMAL | 2025-06-06 15:46:42.566389 | 0 | | NORMAL | 0 | NOARCHIVELOG | +---------------------+---------------+-------------+----------------------------+----------+---------------+-------------------+------------------+--------------+ +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | standby tenant`s primary info | +---------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | standby_tenant_name | primary_tenant_info | +---------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | B_a | IP_LIST=10.10.10.1:2881;10.10.10.2:2881;10.10.10.3:2881,USER=standbyro@A_a,PASSWORD=******,TENANT_ID=1002,CLUSTER_ID=1694680744,COMPATIBILITY_MODE=MYSQL,IS_ENCRYPTED=false | +---------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ query primary-standby relation ok primary-standby relation topology graph clusterA:A_a └── clusterB:B_a
