NewWork mode: your Claude Code or Codex on work calls, answering from your project's codeSkip to content
Middle+80 views

Что такое репликация базы данных и какие у неё особенности?

Practice

AI answer

Replication is the maintenance of data copies across multiple database nodes. Usually, changes are written to a primary node and propagated to replicas; some systems also support a multi-master setup.

Main approaches:

  • Synchronous replication confirms a write after it has been applied on the replicas: data is more consistent, but writes may be slower and depend on node availability.
  • Asynchronous replication confirms a write sooner: it is usually faster, but replication lag and loss of the latest changes in the event of a failure are possible.

Replication is used to improve availability, distribute read traffic, and support disaster recovery. It does not replace backups. When designing a system, consider replication latency and lag, failover to a standby node, write conflicts, and data consistency. For example, after writing to the primary database, a read from a lagging replica may temporarily return an old value.