By default, the primary tenant uses maximum performance protection mode. To switch it to maximum protection or maximum availability, you must first configure a strongly synchronized downstream for the primary tenant.
Limitations and considerations
The standby tenant you designate as the strongly synchronized downstream must be a network-based physical standby.
Only one strongly synchronized downstream standby tenant is supported.
Either the primary or the standby tenant can configure the strongly synchronized downstream. Usually there is no need to set it on the standby; in a switchover scenario, if you want the pair to remain strongly synchronized, you can set the standby's downstream to the original primary before that standby becomes the new primary.
Configuring only the strongly synchronized downstream, without changing the protection mode, does not by itself enable strong synchronization.
Procedure
Log in as an administrator to the primary tenant, or to the
systenant of the cluster where the primary tenant resides.Note
In MySQL-compatible mode, the administrator user is
root. In Oracle-compatible mode, the administrator user isSYS.The following is a connection example. Use values that match your environment.
obclient -h10.xx.xx.xx -P2883 -uroot@sys#obdemo -p***** -AExecute the following statement to set the strongly synchronized downstream for the primary tenant.
The statement is as follows:
ALTER SYSTEM SET SYNC_STANDBY_DEST = 'SERVICE=ip_list NET_TIMEOUT=int_value HEALTH_CHECK_TIME=time USER=user_name@standby_tenant_name PASSWORD=password' [TENANT = tenant_name];The parameters are described as follows:
ip_list: The IP address and SQL port number of the OBServer node where the downstream tenant's replicas are located. The default SQL port number is 2881. Separate multiple IP addresses with commas (,).Note
After this is set, if load balancing or disaster recovery causes the standby's
ip_listto change, the primary tenant detects changes to the system log stream location on the standby within seconds and updates automatically. You do not need to editip_listmanually.NET_TIMEOUT: In maximum availability mode, the longest time the primary waits for the strongly synchronized standby to finish syncing a log. If sync still is not complete when this timeout elapses, the primary automatically falls back to asynchronous synchronization. In other protection modes this parameter has no effect. Unit: seconds. Default30(30 seconds). Valid range: [10, 1200].HEALTH_CHECK_TIME: In maximum availability mode, the window during which the primary checks whether the standby stays in sync. If the standby remains in sync throughout this period, the primary automatically returns to strong synchronization. In other protection modes this parameter has no effect. Unit: seconds. Default60s. Valid range: [0s, +∞).user_name@standby_tenant_name:standby_tenant_nameis the downstream standby tenant name.user_nameis the view-access user created as described in Create an empty standby tenant (for example,rep_user).password: Password of that view-access user, as set in Create an empty standby tenant.tenant_name: When you run the command from the system tenant, this specifies the primary tenant on which the operation is performed.
Here are some examples:
From the system tenant, set the strongly synchronized downstream standby
standby_tenantfor primary tenantmysql.obclient(root@sys)[(none)]> ALTER SYSTEM SET SYNC_STANDBY_DEST = 'SERVICE=6.xx.xxx.xxx:2881 NET_TIMEOUT=20 HEALTH_CHECK_TIME=40s USER=rep_user@standby_tenant PASSWORD=xxxxxx' TENANT = mysql;From the primary tenant, set the strongly synchronized downstream standby
standby_tenantfor this tenant.obclient> ALTER SYSTEM SET SYNC_STANDBY_DEST = 'SERVICE=6.xx.xxx.xxx:2881 NET_TIMEOUT=20 HEALTH_CHECK_TIME=40s USER=rep_user@standby_tenant PASSWORD=xxxxxx';
After a successful change, use
CDB_OB_SYNC_STANDBY_DEST(in the system tenant) orDBA_OB_SYNC_STANDBY_DEST(in a user tenant) to inspect the strongly synchronized downstream configuration.From the system tenant, query the strongly synchronized downstream for a given tenant.
obclient(root@sys)[(none)]> SELECT * FROM oceanbase.CDB_OB_SYNC_STANDBY_DEST WHERE TENANT_ID = tenant_id\GFrom a user tenant, query this tenant's strongly synchronized standby downstream.
MySQL-compatible modeOracle-compatible modeIn MySQL-compatible mode, use:
obclient(root@mysql)[(none)]> SELECT * FROM oceanbase.DBA_OB_SYNC_STANDBY_DEST\GIn Oracle-compatible mode, use:
obclient(sys@oracle001)[SYS]> SELECT * FROM SYS.DBA_OB_SYNC_STANDBY_DEST\G
Example result when queried from the system tenant:
*************************** 1. row *************************** TENANT_ID: 1002 DEST_ID: 0 VALUE: IP_LIST=6.xx.xxx.xxx:2881+2882,USER=rep_user@standby_tenant,PASSWORD=CFE754BE186DE38E5A98A964323C91206567A05704397DA148183F10E7E21D78,TENANT_ID=1002,CLUSTER_ID=10002,COMPATIBILITY_MODE=MYSQL,IS_ENCRYPTED=true,net_timeout=20000000,health_check_time=40000000 1 row in set
What to do next
After the strongly synchronized downstream is configured for the primary tenant, you may need to do the following:
Clear the strongly synchronized downstream
Under maximum performance, you can clear the configured downstream directly. Examples:
From the system tenant, clear the downstream for primary tenant
mysql:obclient(root@sys)[(none)]> ALTER SYSTEM SET SYNC_STANDBY_DEST = '' TENANT = mysql;From the primary tenant, clear this tenant's downstream:
obclient> ALTER SYSTEM SET SYNC_STANDBY_DEST = '';
Change the strongly synchronized downstream
You can change the login name (
user_name), password (password), tenant endpoints (ip_list), standby tenant name (standby_tenant_name), and sync timeout (NET_TIMEOUT). The pair (standby_tenant_name,ip_list) uniquely identifies one standby. Under maximum protection or maximum availability you must not changestandby_tenant_name, but you may changeuser_name,password, andip_listbecause they do not change which standby is targeted. Under maximum performance, all of these fields may be changed.You cannot change a single attribute in isolation: resend the full
SYNC_STANDBY_DESTstring each time. The syntax is the same as for the initial set.
Note: After a strongly synchronized downstream is configured, if the primary is in maximum protection or maximum availability and you need to point strong sync at a different standby, do the following:
- Follow Set the protection mode and switch the tenant to maximum performance.
- Use the commands under Clear the strongly synchronized downstream in this topic to clear the existing downstream.
- Follow this topic again to configure the new strongly synchronized downstream.
- Follow Set the protection mode to set maximum protection or maximum availability again.
