Infrastructure
Add a read replica
Copy a database server continuously to another one that serves reads, and promote it if the primary fails.
-
1
Create the replica server
Create another database server with the same engine (MySQL or PostgreSQL), ideally with the same provider and region so the copy uses the private network. Anything already on it is moved aside.
-
2
Add it
Open the primary database server → Replicas, choose the new server under Add a read replica, and type its name to confirm. The primary gets a replication login for that server only and opens its database port to it; the replica takes a full copy and then follows every change.
-
3
Send reads to it
Once the replica shows Streaming, point read-only queries and reports at it. In Laravel, the Replicas tab shows the read and write hosts to put in config/database.php.
-
4
Watch the lag
Every five minutes the replica is checked and the tab shows how many seconds it’s behind. If it stops copying, the account’s owners are emailed with the reason.
-
5
Promote it
If the primary fails, open the replica → Replicas → Promote to a standalone server. It stops following the primary and accepts writes, keeping everything copied; then point your applications at it.
Still stuck? Email us, or send feedback from inside the app.