If you have a primary tenant or a standby tenant, you can create a standby tenant for the current tenant. OCP supports two scenarios: creating multiple standby tenants for a primary tenant (one-to-many) and creating standby tenants for a standby tenant (cascading).
Background information
OceanBase Database changed the product form of physical standby tenants to tenant-level primary and standby from V4.1.0. In this setup, the primary or standby role belongs to the tenant, which is either a primary tenant or a standby tenant. The cluster no longer has the concept of primary or standby roles but serves as a container for tenants. A primary tenant is a business tenant created by the user, supporting full database capabilities such as queries, DML, and DDL operations. A standby tenant, on the other hand, provides only disaster recovery and read-only services. A tenant-level physical standby solution consists of one primary tenant and multiple standby tenants.
Prerequisites
Make sure that the user logged in to OCP has the following privileges:
- The Cluster Maintenance resource privilege.
- The Overview menu privilege for tenants.
Tenant-level primary and standby features are supported only in OceanBase Database V4.2 and later.
The cluster to which the standby tenant belongs is in the running state.
A single-node cluster supports only one tenant by default. If you want to create a standby tenant in a single-node cluster, you must purchase the corresponding feature module and then import the license.
When creating a standby tenant of a version earlier than OceanBase Database V4.2.1.8, do not use the baseline backup data from 30 days ago to restore the physical standby tenant. This may cause abnormal functionality of the physical standby tenant, affecting tenant compactions.
Before you enable the arbitration service for the tenant, make sure that the following conditions are met:
The cluster to which the tenant belongs has added the arbitration service, and the arbitration service is in the RUNNING state.
The locality of the tenant to which the arbitration service is to be enabled is 2F (F: full-featured replicas) or 4F.
The remaining resources on the host where the arbitration service is located meet the resource requirements.
You can modify the resource requirements in the system parameters based on your business needs. For more information, see Modify system parameters.
ocp.arbitration.min.remain.disk.size: the minimum remaining size of the CLOG disk on the host where the arbitration service is enabled, in MB. The value is specified in the format of (a,b), where a and b are the values for 2F and 4F replicas respectively. The default value is [12,24].ocp.arbitration.max.cpu.used.percentage: the maximum CPU usage on the host where the arbitration service is enabled, in %. The default value is 90.ocp.arbitration.max.memory.used.percentage: the maximum memory usage on the host where the arbitration service is enabled, in %. The default value is 90.
If the cluster that hosts the primary tenant has enabled SSL encryption and the primary-standby synchronization mode is Network-based, the cluster that hosts the standby tenant must also enable SSL encryption, and the root certificate must be the same as that of the cluster that hosts the primary tenant.
Procedure
A new tenant can be created by using one of the four following methods:
Option 1: Log in to OCP, go to the Tenant page, and click Create Tenant in the upper-right corner.
Option 2: Log in to the OCP console and go to the Overview page. Click Create Tenant in the upper-right corner.
Method 3: Log in to the OCP console and go to the Overview page. In the left-side navigation pane, choose Tenant Management, and click Create Tenant in the upper-right corner.
Option 4: Log in to the OCP console and go to the Overview page. Click the More icon in the upper-right corner and choose Create Tenant.
The following steps are given as an example using Entrance 1.
Log in to the OCP console.
In the left-side navigation pane, click Tenant. The system displays the Tenants page.
On the Tenants page, click Create Tenant in the upper-right corner.
Fill in Basic Settings.
The following table lists the basic settings and their descriptions.
Configuration Description Tenant Type Select Standby Tenant. Note
When you create a standby tenant on the overview page of the specified tenant, you cannot select a tenant type. The default is standby tenant.
OCP Cluster of Primary Tenant Multi-cluster Mode: In multi-cluster mode, select the OCP to which the primary tenant belongs. Note
When you create a secondary tenant by using the Overview page of the specified tenant, you do not need to specify this parameter.
Cluster of Primary Tenant Select the cluster to which the primary tenant belongs. Note
When you create a backup tenant from the overview page of the specified tenant, the current cluster is selected by default, and cannot be changed.
Primary Tenant Select the primary tenant to which the standby tenant belongs. Note
When you create a standby tenant on the overview page of the specified tenant, the primary tenant is the current tenant by default and cannot be modified.
Cluster of Standby Tenant Select the cluster that the secondary tenant belongs to. Note
When you create a secondary tenant on the tenant management page of a specified cluster, the cluster defaults to the current cluster and cannot be modified.
Standby Tenant Name The standby tenant name must start with an English letter and end with an English letter or a number. It can contain English letters, numbers, and underscores. The length must be 2 to 32 characters. Service Name Optional. It's a new method of accessing databases in OceanBase. It can be considered an alias for a cluster name and tenant name, allowing applications to access the database through the service name. For more information, see Manage service names. - Must start with an English letter and can include English letters, numbers, and underscores. Must be 2 to 64 characters long.
- Must meet the following requirements to configure a service name for a tenant:
- OceanBase: V4.2.1.9, [V4.2.4.0, V4.3.0.0), [V4.3.3.0, +∞)
- OBProxy: [V4.3.1.0, +∞)
Note
If a primary tenant has already set the Service Name field, it will be automatically populated.
Primary/Standby Synchronization Method Network-based Synchronization and Archiving-based are supported. - Network-based Synchronization synchronizes the logs through the RPC network between the OBServer nodes. You can directly read the logs of the primary tenant by using the
ip + portaddress of the standby tenant. The system defaults to Network-based Synchronization as the primary/standby synchronization method. - Archiving-based synchronizes the logs through shared storage. The primary tenant writes the logs to the network disk or the Alibaba Cloud OSS storage, and the standby tenant reads the data from the shared storage. To use Archiving-based method, ensure that archiving is enabled for the current tenant. Otherwise, data cannot be synchronized based on the archiving. For more information about archiving in OCP, see Back up tenants immediately.
Note
If the primary/standby relationship already exists (such as in cascading or one-to-many mode), the existing primary/standby synchronization method is used by default and cannot be modified.
Load Type You can select a load type for a tenant to optimize database performance. You must select a load type based on your actual workload. The following table describes the supported load types. - Express OLTP: this load type is suitable for workloads such as core systems in trade and payment, and internet-based applications with high throughput. This load type does not apply to workloads involving foreign keys, stored procedures, long-running transactions, large transactions, complex joins, or complex subqueries.
Version restriction: OceanBase V4.2.5 or later supports this load type. - HTAP: this load type is suitable for workloads involving hybrid online analytical processing (OLAP) and online transaction processing (OLTP). This load type is generally used to gain instant insights from active operational data, fraud detection, and personalized recommendations.
Version restriction: OceanBase V4.2.5 or later supports this load type. - OLAP: this load type is suitable for real-time data warehouse analysis scenarios.
Version restriction: OceanBase V4.3.0 or later supports this load type. - Complex OLTP: this load type is suitable for workloads such as banking and insurance systems. These workloads typically involve complex joins, complex correlated subqueries, PL-written batch jobs, long-running transactions, and large transactions. Parallel execution is sometimes used for queries that run over a short time.
Version restriction: OceanBase V4.2.5 or later supports this load type. - OBKV: this load type is suitable for key-value workloads and wide-column workloads similar to HBase. These workloads typically have very high throughput and are sensitive to latency.
Version restriction: OceanBase V4.2.5 or later supports this load type.
Note
We recommend that you use the same load type as that of the cluster where the tenant resides.
Specify Restore Standby Tenant Settings and set backup set information. You can choose whether to set an independent storage directory for the standby tenant based on different scenarios.
Note
When Primary-standby Synchronization Mode is set to Based on the Network and the Redo logs of the primary tenant are complete, there is no need to configure Restore Standby Tenant Settings. You can also click Restore Standby Tenant Using Backup Sets to configure backup set information and restore the standby tenant using the backup set.
Set an independent storage directory
Applies to the scenarios where tenant backups have been performed without using the tenant backup feature of OCP, or where the external backup files of the primary tenant have been copied to a shared storage, and a tenant needs to be restored from these backup files.
Configuration Description Backup Set Storage Type Select the storage media for backup files. The value range is as follows: - File: local file storage, generally NFS.
- OSS: Alibaba Cloud OSS, which is supported by OceanBase Database V2.2.76 and later versions.
- COS: Tencent Cloud COS, which is supported by OceanBase Database V2.2.76 and later versions and before V4.0.0, or V4.2.1 and later versions.
- S3: supports storage media compatible with the AWS S3 protocol. The supported storage media includes the original AWS S3, HUAWEI Cloud OBS, ChinaNetCenter OBS, and Google GCS. This mode is supported by OceanBase Database V4.2.1-BP7 and later versions. For more information about storage media compatible with the AWS S3 protocol, see Overview of AWS S3 protocol.
Data Backup Directory Specify the directory where backup data is stored on the current media. Log Backup Directory Enter the log storage directory on the current media where the backup file is stored. Domain Fill in the domain name of the cloud storage of the backup set. - When Backup Set Storage Type is OSS, fill in the domain name of Alibaba Cloud storage. You can add a port number at the end of the domain name, such as:
oss.ap-shanghai.myqcloud.com:8080. - When Backup Set Storage Type is set to COS, fill in the domain name for objects in Tencent Cloud COS storage, such as:
cos.ap-beijing.myqcloud.com.
User When Backup Set Storage Type is set to OSS, enter the username of the Alibaba Cloud account that grants access to the storage endpoint. Resource Identity (APPID) When Backup Set Storage Type is set to COS, the APPID is the unique resource identifier at the user level that the developer has for accessing the COS service. You can obtain the APPID on the API Key Management page of the corresponding service. Project ID Displayed only when Backup Set Storage Type is set to COS. Enter the project ID that belongs to the developer, which can be obtained from the API key management page of the corresponding service. Access Key When Backup Set Storage Type is set to OSS or COS, provide the access key for the Alibaba Cloud or Tencent Cloud storage. No independent storage directory
If the tenant was backed up using the backup feature in OCP, you can choose not to set a standalone storage directory. In this case, the system will automatically fill in the relevant storage directory configuration information, which cannot be modified.
Configuration Description Storage Directory Specify the storage directory for the backup files on the current media. Domain Specify the domain name for accessing the cloud storage endpoint of a backup set. - When Backup Set Storage Type is OSS, specify the domain name for accessing the storage endpoint of backup files on Alibaba Cloud. You can add a port number after the domain name, for example:
oss.ap-shanghai.myqcloud.com:8080. - When Backup Set Storage Type is set to COS, specify the domain name for accessing objects in the Tencent Cloud COS bucket. For example,
cos.ap-beijing.myqcloud.com.
- When Backup Set Storage Type is OSS, specify the domain name for accessing the storage endpoint of backup files on Alibaba Cloud. You can add a port number after the domain name, for example:
Click Backup Set Verification. The system verifies the accessibility of the directory where the tenant tenant located in the cluster and whether there are any log missing between the maximum recoverable time of the backup set and the current tenant's time. If the verification fails, resolve the issue based on the message displayed.
Specify Standby Tenant Replica Settings.
The default system displays the configurable Zone list based on the Zone information of the selected cluster. You can click Delete in the operation column of a zone entry to remove the zone from the cluster, if you do not want to replicate data to the zone. The following table describes the required Zone information for each zone.
Configuration Description Replica Type Please select multiple all-purpose replicas to ensure the majority are of the all-purpose type. - All-Purpose Replica: Currently supports a regular replica with full data and features such as transaction logs, MemTables, and SSTables. It can quickly switch to the leader to provide services as needed.
- Read-Only Replica: Contains complete logs, MemTables, and SSTables. It does not participate in Paxos log voting as a member but acts as an observer, real-time catching up with Paxos members' logs and replaying them locally.
- Log Replica: Contains only logs with no MemTables or SSTables. It participates in log voting and provides log services, can help restore other replicas, but cannot take over as the leader to provide database services.
- Read-Only Columnar Replica: Does not participate in Paxos voting. All baseline data of user tables is stored in a columnar format and only supports read operations, suitable for TP-enhanced mixed workloads (near-real-time decision-making).
When you select the Read-Only Columnar Replica, the current OceanBase cluster must be associated with at least two OBProxy clusters. One of these must be a dedicated, V4.3.2+ OBProxy cluster for client requests related to the columnar replicas. The cluster must also have the following parameters configured:alter proxyconfig set route_target_replica_type='ColumnStore';alter proxyconfig set proxy_route_policy='TARGET_REPLICA_TYPE_FOLLOWER_ONLY';alter proxyconfig set init_sql='set @@ob_route_policy = COLUMN_STORE_ONLY';alter proxyconfig set obproxy_read_only=0;alter proxyconfig set obproxy_read_consistency=1;
Note
- When the cluster is a distributed cluster of V4.3.3 or later, Full-featured Replica, Read-only Replica, and Read-only Columnstore Replica are supported.
- When the cluster is a distributed cluster of V4.2.0 or later, but earlier than V4.3.3, Full-featured Replica and Read-only Replica are supported.
- When the cluster is a distributed cluster of V4.0.0 or later, but earlier than V4.2.0, only Full-featured Replica is supported.
- When the cluster is of V3.x, Full-featured Replica, Read-only Replica, and Log Replica are supported.
- Standalone clusters support only Full-featured Replica.
Unit Specifications OCP provides a set of unit specifications. Select one from the following options or click Add Specification at the bottom of the list to add a custom specification. For more information about unit specifications, see OCP unit specifications. Notice
- We recommend that you set the same unit specification and quantity for a full-featured replica. Different unit specifications and quantities may cause performance or stability issues.
- For tenants whose clusters are V4.0.0 or later, a CPU specification less than one CPU is not supported.
- The minimum value of the memory specification is limited by the cluster by default. You can adjust the limit by specifying the
__min_full_resource_pool_memoryparameter. For example, in V4.1.0, see the procedure in Modify a cluster parameter.
Units Specifies the number of units for the zone. The number of units cannot exceed the number of servers in the zone. - For clusters V4.0 and later, you cannot set the number of units at the zone level. The number of units must be the same for all zones (default value is 1).
- For clusters earlier than V4.0, you can set the number of units to different values for multiple zones.
Note
The number of units for a standalone server is by default set to 1 and cannot be modified.
Zone Priority Rankings Specifies whether to set the priority order for each tenant's zone. This priority order affects the primary zone for the sys tenant. - If not specified, the priority order defaults to the sys tenant's zone priority order.
- If "Zone Priority Sorting" is enabled and no zone priorities are configured, the priority is random.
- To configure zone priorities, you can select one or more zones from the left list box and add them to the right list box. The left list box displays all zones in the cluster. By default, zones selected first have a higher priority than those selected later. When multiple zones are selected simultaneously, they have the same priority. After a zone is moved to the right list box, you can drag it to adjust its position within the list box. Zones at the top of the list box have a higher priority than those below.
Note
In standalone mode, zone priority sorting is not displayed. Zone1 has the first priority by default.
Enable Arbitration Service Specifies whether to enable the arbitration service for the tenant. By default, this feature is disabled. Note
- The suggested replica specifications for standby tenants should align with those of the primary tenant.
- If the primary tenant's replica type is not configured as read-only columnar replicas, standby tenants also should not be configured as read-only columnar replicas.
Open the Parameter Configuration module and configure tenant parameters.
If you set a load type in the Basic Settings section, the system selects the corresponding parameter template by default.
You can select an item in the list that appears in the form of a series of start-up parameters, as shown in ①, and configure values for the items.
You can also click Select Parameter Template at step ② to select a parameter template. The system will automatically fill in the parameters and configurations of the selected template to this section. If you haven't created a tenant parameter template, you can click Create Tenant Template to create one for the tenant. For more information, see Manage tenant parameter templates.
The system provides four built-in templates that contain common parameter settings. You can apply the templates to initialize the cluster. Description of the built-in templates is as follows.
Template Description Default template for COMPLEX_OLTP The Complex OLTP template is applicable only for OceanBase Database V4.2.5 and later. Default HTAP parameter template Corresponds to the HTAP workload type and is only applicable to OceanBase Database V4.2.5 and later. OLAP Default Template Corresponds to the OLAP workload type and is available only in OceanBase Database V4.3.0 and later. Default parameter template for EXPRESS_OLTP Corresponds to the Express OLTP workload type. This template is only valid for OceanBase Database V4.2.5 and later.
Note
If your tenant mode is MySQL and the selected parameter template contains parameters defined only for Oracle, you need to manually delete these parameters after the template is populated.Click Submit.
The page displays Tenant creation task submitted., which indicates that the task has been successfully submitted. You can view the basic information of the task on this page.
- You can click the View Task Details button to view the detailed execution progress of the task for creating a tenant.
- You can also click Return to Tenants List to return to the tenant list page. On this page, you can view the creation status and task details of the created tenant, and delete a tenant that failed to be created.
Note
When the task status is Completed and the status of the new tenant is Running in the Members tab of the Cluster Management page, the tenant is created successfully.