After you configure a strongly synchronized downstream standby for the primary tenant, you can set the primary tenant to maximum availability or maximum protection mode.
Limitations and considerations
You can set the protection mode only for the primary tenant.
If the primary tenant is in maximum performance mode, you must configure a strongly synchronized downstream before switching to maximum availability or maximum protection. For details, see Set the strongly synchronized downstream.
If the tenant is already in maximum protection or maximum availability mode, you can switch directly to maximum performance.
Cascading standby tenants cannot be configured as the strongly synchronized downstream.
When switching from maximum performance or maximum availability to maximum protection, the synchronization SCN of the strongly synchronized standby and that of the primary must differ by no more than 5 seconds (in time).
Run the following statements to compare primary and standby
SYNC_SCNvalues. The absolute difference must be less than5,000,000,000nanoseconds (theSYNC_SCNfield is in nanoseconds).System tenant
obclient(root@sys)[(none)]> SELECT SYNC_SCN FROM oceanbase.DBA_OB_TENANTS WHERE TENANT_ID = tenant_id;User tenant
MySQL-compatible modeOracle-compatible modeIn MySQL-compatible mode, execute the following statement:
obclient(root@mysql)[(none)]> SELECT SYNC_SCN FROM oceanbase.DBA_OB_TENANTS;In Oracle-compatible mode, execute the following statement:
obclient(sys@oracle001)[SYS]> SELECT SYNC_SCN FROM SYS.DBA_OB_TENANTS;
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 protection mode for the primary tenant.
The statement is as follows:
ALTER SYSTEM SET STANDBY TENANT TO {MAXIMIZE PERFORMANCE} | {MAXIMIZE AVAILABILITY} | {MAXIMIZE PROTECTION} [TENANT = tenant_name];Here,
tenant_nameis used by the system tenant to name the primary tenant whose protection mode you are changing.Here are some examples:
Set the protection mode of the primary tenant named
mysqlto the maximum availability mode.obclient(root@sys)[(none)]> ALTER SYSTEM SET STANDBY TENANT TO MAXIMIZE AVAILABILITY TENANT = mysql;Set the protection mode of the current user tenant to the maximum availability mode.
obclient> ALTER SYSTEM SET STANDBY TENANT TO MAXIMIZE AVAILABILITY;
After the protection mode is set, you can query the
DBA_OB_TENANTSview to confirm whether the protection mode is set.System tenant
obclient(root@sys)[oceanbase]> SELECT TENANT_NAME, PROTECTION_MODE, PROTECTION_LEVEL FROM oceanbase.DBA_OB_TENANTS WHERE TENANT_NAME = 'mysql';User tenant
MySQL-compatible modeOracle-compatible modeIn MySQL-compatible mode, execute the following statement:
obclient(root@mysql)[oceanbase]> SELECT TENANT_NAME, PROTECTION_MODE, PROTECTION_LEVEL FROM oceanbase.DBA_OB_TENANTS;In Oracle-compatible mode, execute the following statement:
obclient(sys@oracle001)[SYS]> SELECT TENANT_NAME, PROTECTION_MODE, PROTECTION_LEVEL FROM SYS.DBA_OB_TENANTS;
Here is an example of the query result:
+-------------+----------------------+----------------------+ | TENANT_NAME | PROTECTION_MODE | PROTECTION_LEVEL | +-------------+----------------------+----------------------+ | mysql | MAXIMUM AVAILABILITY | MAXIMUM AVAILABILITY | +-------------+----------------------+----------------------+ 1 row in set
Best practices
By default, both the primary and standby tenants are in the maximum performance mode. In this mode, the standby tenant can pull logs by using log archiving or network to achieve physical synchronization. In this case, you do not need to consider the deployment mode, operating system, or specifications of the primary and standby tenants. However, in maximum protection or maximum availability mode, the primary must track standby apply progress: logs are acknowledged to the client only after they are persisted on the standby—effectively an extra majority for the primary. To limit the impact on primary workloads when using these modes, ensure the following:
The primary and standby tenants are deployed in the same city. Ensure that the network latency is sufficient and the bandwidth is large enough.
Primary and standby deployments must stay homogeneous so CPU or memory shortages on the standby do not throttle log apply.
Under strong synchronization, keep standby resources greater than or equal to the primary's when you scale: scale out the standby before the primary; scale in the primary before the standby.
