This topic describes how to use obd to create a standby instance of the database named seekdb.
Concepts
The primary/standby architecture is a high-availability solution provided by seekdb. It synchronizes data from the primary instance to the standby instance, which is a read-only instance. When the primary instance is unavailable due to planned or unplanned reasons, the standby instance can take over the service to minimize service downtime and reduce potential data loss.
The primary instance (PRIMARY) is a business instance created by the user and supports complete database capabilities, including queries, DML, and DDL operations. The standby instance (STANDBY) only provides disaster recovery and read-only capabilities.
Prerequisites
The primary instance of seekdb must be of V1.2.0 or later and managed by obd.
The default primary instance of seekdb is managed by obd. If the primary instance of seekdb is not managed by obd, you can use obd to take over the corresponding instance. For more information, see the Take over the instance section in Use obd to take over an instance.
The primary instance must be running. You can execute the
obd seekdb displaycommand to check the status of the primary instance of seekdb.For a simple experience, the primary instance must have at least 1C1GB memory and 3GB of log disk space. For long-term use, we recommend that the primary instance have at least 1C4GB memory.
Procedure
This section describes how to create a standby instance in three scenarios.
Scenario 1: One primary instance and one standby instance
In this scenario, two instances of the
seekdbtype exist:seekdb_Ais the primary instance, andseekdb_Bis the standby instance ofseekdb_A.Scenario 2: One primary instance and two standby instances
In this scenario, three instances of the
seekdbtype exist:seekdb_Ais the primary instance, andseekdb_Bandseekdb_Care the standby instances ofseekdb_A.Scenario 3: Cascading primary and standby instances
In this scenario, three instances of the
seekdbtype exist:seekdb_Ais the primary instance,seekdb_Bis the standby instance ofseekdb_A, andseekdb_Cis the standby instance ofseekdb_B.
Create a standby instance
Execute the following command to create a standby instance. This command starts an interactive deployment process. In the interactive deployment process, configure the information of the
seekdbstandby instance and select the deployment name of the primary instance. For more information about how to execute this command, see the Interactive deployment of seekdb section in Deploy seekdb.obd seekdb install --standbyView the primary-standby relationship of the seekdb instance
obd seekdb display seekdb_B -gThe
-gparameter displays the primary-standby instance topology. The output is as follows:Get local repositories and plugins ok Open ssh connection ok Connect to seekdb 10.10.10.1:2881 ok Wait for seekdb init ok +--------------------------------+ | seekdb | +---------------+---------+------+ | ip | version | port | +---------------+---------+------+ | 10.10.10.1 | 1.2.0.0 | 2881 | +---------------+---------+------+ obclient -h10.10.10.1 -P2881 -uroot -p'********' -Doceanbase -A Cluster Topology: seekdb_A └── seekdb_BVerify the synchronization
Log in to the standby instance and execute the following command to view the synchronization status.
MySQL [(oceanbase)]> select * from __all_virtual_server_stat\GThe output is as follows:
*************************** 1. row *************************** svr_ip: 127.0.0.1 svr_port: 2882 sql_port: 2881 rpc_port: 2882 cpu_capacity: 8 cpu_capacity_max: 8 cpu_assigned: 2 cpu_assigned_max: 2 mem_capacity: 1073741824 mem_assigned: 1073741824 data_disk_capacity: 150403547136 data_disk_in_use: 31457280 data_disk_health_status: NORMAL data_disk_abnormal_time: 0 log_disk_capacity: 3221225472 log_disk_assigned: 3221225472 log_disk_in_use: 134217728 rpc_cert_expire_time: 2089754466000000 rpc_tls_enabled: 1 memory_limit: 1073741824 data_disk_allocated: 21474836480 data_disk_assigned: NULL start_service_time: 1774423270740291 create_time: 1774423267357315 role: STANDBY switchover_status: NORMAL log_restore_source: 10.10.10.1:2882 sync_scn: 1774427027950470000 readable_scn: 1774427027950470000
Create a standby instance
seekdb_Bfor the primary instanceseekdb_AAfter you execute this command, an interactive deployment process starts. In the interactive deployment process, configure the information of the
seekdb_Bstandby instance and select the deployment name of the primary instance. For more information about how to execute this command, see the Interactive deployment of seekdb section in Deploy seekdb.obd seekdb install --standbyRepeat the previous operation to create a standby instance
seekdb_Cfor the primary instanceseekdb_A.View the primary-standby relationship of the seekdb instance
Execute the following command to view the primary-standby relationship of the seekdb instance. Here, the
seekdb_Binstance is used as an example.obd seekdb display seekdb_B -gThe
-gparameter displays the primary-standby instance topology. The output is as follows:Get local repositories and plugins ok Open ssh connection ok Connect to seekdb 10.10.10.1:2881 ok Wait for seekdb init ok +--------------------------------+ | seekdb | +---------------+---------+------+ | ip | version | port | +---------------+---------+------+ | 10.10.10.1 | 1.2.0.0 | 2881 | +---------------+---------+------+ obclient -h10.10.10.1 -P2881 -uroot -p'********' -Doceanbase -A Cluster Topology: seekdb_A ├── seekdb_B └── seekdb_CVerify the synchronization
Log in to the standby instance and execute the following command to view the synchronization status.
MySQL [(oceanbase)]> select * from __all_virtual_server_stat\GThe output is as follows: For more information, see View the synchronization status of an instance in the seekdb documentation.
*************************** 1. row *************************** svr_ip: 127.0.0.1 svr_port: 2882 sql_port: 2881 rpc_port: 2882 cpu_capacity: 8 cpu_capacity_max: 8 cpu_assigned: 2 cpu_assigned_max: 2 mem_capacity: 1073741824 mem_assigned: 1073741824 data_disk_capacity: 150403547136 data_disk_in_use: 31457280 data_disk_health_status: NORMAL data_disk_abnormal_time: 0 log_disk_capacity: 3221225472 log_disk_assigned: 3221225472 log_disk_in_use: 134217728 rpc_cert_expire_time: 2089754466000000 rpc_tls_enabled: 1 memory_limit: 1073741824 data_disk_allocated: 21474836480 data_disk_assigned: NULL start_service_time: 1774423270740291 create_time: 1774423267357315 role: STANDBY switchover_status: NORMAL log_restore_source: 10.10.10.1:2882 sync_scn: 1774427027950470000 readable_scn: 1774427027950470000
Create a standby instance
seekdb_Bfor the primary instanceseekdb_AAfter you execute this command, an interactive deployment process starts. In the interactive deployment process, configure the information of the
seekdb_Bstandby instance and select the deployment name of the primary instance. For more information about how to execute this command, see the Interactive deployment of seekdb section in Deploy seekdb.obd seekdb install --standbyRepeat the previous operation to create a standby instance
seekdb_Cfor the instanceseekdb_B.View the primary-standby relationship of the seekdb instance
Execute the following command to view the primary-standby relationship of the seekdb instance. Here, the
seekdb_Binstance is used as an example.obd seekdb display seekdb_B -gThe
-gparameter displays the primary-standby instance topology. The output is as follows:Get local repositories and plugins ok Open ssh connection ok Connect to seekdb 10.10.10.1:2881 ok Wait for seekdb init ok +--------------------------------+ | seekdb | +---------------+---------+------+ | ip | version | port | +---------------+---------+------+ | 10.10.10.1 | 1.2.0.0 | 2881 | +---------------+---------+------+ obclient -h10.10.10.1 -P2881 -uroot -p'********' -Doceanbase -A Cluster Topology: seekdb_A └── seekdb_B └── seekdb_CVerify the synchronization
Log in to the standby instance and execute the following command to view the synchronization status.
MySQL [(oceanbase)]> select * from __all_virtual_server_stat\GOutput:
*************************** 1. row *************************** svr_ip: 127.0.0.1 svr_port: 2882 sql_port: 2881 rpc_port: 2882 cpu_capacity: 8 cpu_capacity_max: 8 cpu_assigned: 2 cpu_assigned_max: 2 mem_capacity: 1073741824 mem_assigned: 1073741824 data_disk_capacity: 150403547136 data_disk_in_use: 31457280 data_disk_health_status: NORMAL data_disk_abnormal_time: 0 log_disk_capacity: 3221225472 log_disk_assigned: 3221225472 log_disk_in_use: 134217728 rpc_cert_expire_time: 2089754466000000 rpc_tls_enabled: 1 memory_limit: 1073741824 data_disk_allocated: 21474836480 data_disk_assigned: NULL start_service_time: 1774423270740291 create_time: 1774423267357315 role: STANDBY switchover_status: NORMAL log_restore_source: 10.10.10.1:2882 sync_scn: 1774427027950470000 readable_scn: 1774427027950470000
References
For more information about seekdb, see seekdb documentation.
For more information about how to perform a primary-standby switch or decoupling by using the obd command, see Role switching and decoupling.
