Skip to main content
Version: V1.3.0

Role switching and decouple

This topic explains how to change seekdb roles with obd and how to decouple a primary and standby pair.

Concepts​

Primary and standby is seekdb's high availability model. The primary (PRIMARY) is the business database; it supports full capabilities including queries, DML, and DDL. The standby instance (STANDBY) only provides disaster recovery and read-only access.

obd can change seekdb roles with commands.

  • Switchover

    Switchover is a planned role change. After switchover, the primary and the chosen standby swap roles with no data loss (RPO = 0). It usually finishes in seconds.

  • Failover

    Failover is used when the primary cannot be recovered. After failover, the standby becomes PRIMARY. If the standby had been replicating normally before the primary failed, data loss is typically on the order of hundreds of milliseconds. It usually finishes in seconds.

  • Decouple

    Decouple is a planned operation. After decouple, the standby is detached from the primary and its role becomes PRIMARY.

Switchover​

After switchover, topology stays consistent: standbys that were under the old primary move under the new primary; standbys under the old standby move under the new standby. Only the two switched nodes swap roles; other nodes keep their relative positions.

Prerequisites​

  • seekdb is V1.2.0 or later.

  • Primary and standbys are managed by the same obd and are online. Use obd seekdb display to verify.

Procedure​

  1. View primary and standby topology

    Example using seekdb_B:

    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:3881 ok
    Wait for seekdb init ok
    +---------------------------------+
    | seekdb |
    +----------------+---------+------+
    | ip | version | port |
    +----------------+---------+------+
    | xxx.xxx.xxx.72 | 1.2.0.0 | 3881 |
    +----------------+---------+------+
    obclient -hxxx.xxx.xxx.72 -P3881 -uroot -p'' -Doceanbase -A

    Cluster Topology:

    seekdb_A
    └── seekdb_B
    └── seekdb_C
  2. Run switchover on the standby

    obd seekdb switchover seekdb_B
  3. View topology again for the former standby

    obd seekdb display seekdb_B -g

    -g prints primary/standby topology. The tree should reflect the new roles.

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

    Cluster Topology:

    seekdb_B
    └── seekdb_A
    └── seekdb_C

Failover​

Use failover when the primary is unavailable and you need a standby to become primary. Failover only changes log files; it does not change data files.

Because seekdb has multiple log streams, failover picks a single SCN so the system is consistent: the minimum sync SCN across all log streams is used as the failover point. After failover, every log stream under that seekdb is rolled back to that SCN.

tip

With one primary and multiple standbys, after you failover one standby to primary, the other standbys cannot automatically attach to the new primary. You must decouple them or run failover on each to produce new primaries as needed.

Prerequisites​

  • seekdb is V1.2.0 or later.

  • Primary and standbys are managed by the same obd.

  • The primary is unavailable. Use obd seekdb display to verify.

  • The standby is online. Use obd seekdb display to verify.

Procedure​

  1. View primary and standby topology

    Example using seekdb_B:

    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:3881 ok
    Wait for seekdb init ok
    +---------------------------------+
    | seekdb |
    +----------------+---------+------+
    | ip | version | port |
    +----------------+---------+------+
    | xxx.xxx.xxx.72 | 1.2.0.0 | 3881 |
    +----------------+---------+------+
    obclient -hxxx.xxx.xxx.72 -P3881 -uroot -p'' -Doceanbase -A

    Cluster Topology:

    seekdb_A
    └── seekdb_B
    └── seekdb_C
  2. Run failover on the standby

    obd seekdb failover seekdb_B
  3. View topology again for the former standby

    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:3881 ok
    Wait for seekdb init ok
    +---------------------------------+
    | seekdb |
    +----------------+---------+------+
    | ip | version | port |
    +----------------+---------+------+
    | xxx.xxx.xxx.72 | 1.2.0.0 | 3881 |
    +----------------+---------+------+
    obclient -hxxx.xxx.xxx.72 -P3881 -uroot -p'' -Doceanbase -A

    Cluster Topology:

    seekdb_B
    └── seekdb_C

Decouple primary and standby​

The decouple command turns a standby into a standalone database unrelated to the former primary. This section describes how to run it.

Prerequisites​

  • seekdb is V1.2.0 or later.

  • Primary and standbys are managed by the same obd and are online. Use obd seekdb display to verify.

Procedure​

  1. View primary and standby topology

    Example using seekdb_B:

    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:3881 ok
    Wait for seekdb init ok
    +---------------------------------+
    | seekdb |
    +----------------+---------+------+
    | ip | version | port |
    +----------------+---------+------+
    | xxx.xxx.xxx.72 | 1.2.0.0 | 3881 |
    +----------------+---------+------+
    obclient -hxxx.xxx.xxx.72 -P3881 -uroot -p'' -Doceanbase -A

    Cluster Topology:

    seekdb_A
    └── seekdb_B
    └── seekdb_C
  2. Decouple the standby

    obd seekdb decouple seekdb_B
  3. View topology again for the former standby

    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:3881 ok
    Wait for seekdb init ok
    +---------------------------------+
    | seekdb |
    +----------------+---------+------+
    | ip | version | port |
    +----------------+---------+------+
    | xxx.xxx.xxx.72 | 1.2.0.0 | 3881 |
    +----------------+---------+------+
    obclient -hxxx.xxx.xxx.72 -P3881 -uroot -p'' -Doceanbase -A

    Cluster Topology:

    seekdb_B
    └── seekdb_C