Skip to main content
Version: V1.2.0

Primary and standby overview

Primary and standby is seekdb's high availability model: you deploy read-only standby instances 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.

This topic covers capabilities, use cases, and limitations.

Overview​

Primary and standby uses a one primary, one standby or cascaded standby topology: the primary (PRIMARY) is read/write; standbys (STANDBY) are read-only. Standbys pull logs over the network from the primary (or an upstream standby), replay them, and stay in sync. For maintenance or failure, you use lossless switchover or lossy failover to promote a standby to the new primary.

Core characteristics:

  • Build standby anytime, asynchronously: A standby can be built from the primary asynchronously at any time; it does not need to be deployed together with the primary.
  • Online recovery over the network: The standby pulls baseline data and incremental logs from the primary over the network.
  • Maximum performance mode: Replication is asynchronous for maximum performance.
  • Role changes: Lossless switchover between primary and standby, and lossy failover when the primary is down (ACTIVATE STANDBY).
  • Cascading: Limited support for one primary and multiple standbys.

Use cases​

  • Planned downtime: Before upgrade, migration, or maintenance on the primary, run a lossless switchover so the standby serves traffic, then work on the old primary; you can switch back or keep the new topology.
  • Primary failure: After the primary is confirmed unrecoverable, run lossy failover (ACTIVATE STANDBY) on a standby to promote it. Point application connection strings to the new primary (data not yet replicated to the standby may be lost).
  • Read offload: Standbys are read-only; you can send some query traffic to them to reduce primary load. Allow for replication lag; use for workloads that do not need the latest data.
  • Cascaded standby: On top of an existing primary and standby, build another standby from the current standby for a primary–standby–standby chain across sites.

How it works​

  • Node role: Each instance is PRIMARY or STANDBY at startup. The primary is read/write; standbys are read-only. Roles are set by startup parameters and changed at runtime with SQL.
  • Standby build: After startup the standby creates an empty log stream, pulls baseline data (schema, metadata, and a data snapshot) from upstream, then continuously pulls and replays incremental logs until it matches upstream and serves read-only queries.
  • Log replication: Replication to standbys is asynchronous; applied logs are replayed on the standby immediately. The primary does not track standbys; standbys pull using configured upstream addresses.
  • Sync positions: System views expose log sync position and readable position to estimate lag. After a standby restarts, if the sync position was not persisted, the readable position can move backward.

Limitations and considerations​

  • Connections and applications: After a switch, applications must point to the new primary's host and port. seekdb does not provide transparent failover without changing connection strings.

  • Data source: Standbys only pull from a network upstream. Restore from archive or other offline sources, controlled replay, and pause/resume are not supported.

  • Replication mode: Only maximum performance (async) is supported, not maximum protection, maximum availability, or other synchronous or strong consistency modes.

  • Reads on standby: Queries see data up to the current replay position. If the sync position is not persisted, after a crash and restart reads may temporarily appear to go backward relative to before the restart.

  • During standby_restore:

    • Do not change primary identity, address, or similar primary metadata during standby_restore, or the build may fail.
    • If the primary or standby crashes, the primary is in a bad state, or the standby disk is full, standby_restore fails. You must intervene and rebuild or retry.
    • If DDL on the primary causes overlap between DDL and baseline ranges, standby_restore may fail. Resolve from the error message or retry.
  • One primary, multiple standbys: Limited support: after one standby becomes the new primary, the others cannot use it as their new primary in the same way.

ParameterDescriptionTypeDefaultRecommendedHow it applies
rpc_portNetwork portint2882None; assign ports to fit your environmentSet at deploy; avoid changing dynamically
enable_rpc_serviceEnables network RPC serviceBOOLfalsetrueTakes effect after restart
log_restore_sourceStandby upstream (primary or another standby); required for standbysstring: ip:rpc_port""NoneDynamic
log_disk_sizeUpper bound for redo log disk usage.
  • 0: kernel picks a value with a resource-saving bias.
  • Non-zero: fixed cap.
int0memory_limit/memory_limit_percentage * 3Dynamic
log_disk_utilization_thresholdThreshold (percent) to trigger redo recycling.
  • 0: recycle redo logs as aggressively as possible.
  • Non-zero: recycle only when usage exceeds this fraction of log_disk_size, implying only a small portion of logs is recycled.
int""80Dynamic