Skip to main content
Version: V1.3.0

Create a standby instance

This topic explains three ways to create a seekdb standby quickly with obd.

Concepts​

Primary and standby is seekdb's high availability model: you deploy read-only standbys that replicate from the primary. When the primary is unavailable, planned or unplanned, a standby can take over. You get lossless switchover (RPO = 0) and lossy failover (RPO > 0), which limits downtime and data loss.

The primary (PRIMARY) is the business database users create. It supports full database capabilities: queries, DML, DDL, and so on. The standby instance (STANDBY) only provides disaster recovery and read-only access.

Prerequisites​

  • The seekdb primary is V1.2.0 or later and is managed by obd.

    seekdb instances deployed by obd are managed by obd by default. If the primary was not deployed with obd, you can register it with obd:

    obd seekdb takeover <seekdb_name>
  • The primary must be running. Use obd seekdb display to check status.

  • For a quick trial the primary needs at least 1 CPU, 1 GB memory, and 3 GB log disk. For production, use at least 1 CPU and 4 GB memory on the primary.

Procedure​

The following three scenarios are covered.

  • Scenario 1: One primary, one standby

    You have two instances, seekdb_A and seekdb_B: seekdb_A is primary and seekdb_B is its standby.

  • Scenario 2: One primary, two standbys

    You have seekdb_A, seekdb_B, and seekdb_C: seekdb_A is primary; seekdb_B and seekdb_C are both standbys of seekdb_A.

  • Scenario 3: Cascaded primary and standby

    You have seekdb_A, seekdb_B, and seekdb_C: seekdb_A is primary, seekdb_B is standby for seekdb_A, and seekdb_C is standby for seekdb_B.

  1. Create the standby

    Run the command below to start the interactive flow. Configure the standby and select the primary deployment name. For details, see Deploy seekdb with obd, Standby mode.

    obd seekdb install --standby
  2. View primary and standby topology

    obd seekdb display seekdb_B -g

    -g prints primary/standby topology. Example output:

    Get local repositories and plugins ok
    Open ssh connection ok
    Connect to seekdb xxx.xxx.xxx.72:2881 ok
    Wait for seekdb init ok
    +---------------------------------+
    | seekdb |
    +----------------+---------+------+
    | ip | version | port |
    +----------------+---------+------+
    | xxx.xxx.xxx.72 | 1.2.0.0 | 2881 |
    +----------------+---------+------+
    obclient -hxxx.xxx.xxx.72 -P2881 -uroot -p'' -Doceanbase -A

    Cluster Topology:

    seekdb_A
    └── seekdb_B
  3. Verify replication

    Log in to the standby and run:

    MySQL [(oceanbase)]> select * from __all_virtual_server_stat\G

    Example output:

    *************************** 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: xxx.xxx.xxx.72:3882
    sync_scn: 1774427027950470000
    readable_scn: 1774427027950470000