Database high availability
This page is for database administrators and infrastructure teams in public bodies who must keep the database of an Exponential site available when a database machine fails. It answers what Exponential does on its own, what it leaves to the database engine, and what switching to a standby database involves. The references are 9 Databases and Database support.
Contents
What Exponential does and does not do
Exponential connects to one database server per site, named in site.ini [DatabaseSettings] Server. It has:
| Feature | Setting | Engines |
|---|---|---|
| Retries when the first connection fails | [DatabaseSettings] ConnectRetries (shipped 0) | MySQL, PostgreSQL, SQLite |
| Reads sent to replicas | UseSlaveServer with SlaveServerArray[] (shipped disabled) | MySQL and MariaDB only |
| A descriptor over several listeners, failover, retries | ezoracle.ini [ConnectionSettings] Hosts[], Failover, RetryCount | Oracle |
It has no built-in automatic failover for PostgreSQL, MariaDB or MySQL: if the server named in Server fails, the
site cannot reach its database until that address works again. Database availability is therefore the job of the
database platform: its replication, a virtual IP or DNS name that moves to the standby, or a proxy in front of the
database. Choose what your database team already runs.
Per engine
| Engine | Availability options | Notes |
|---|---|---|
| 1. SQLite 3 | none of its own | one host; no replication; recover from backups (9.2) |
| 2. PostgreSQL | its own replication and point-in-time recovery | set up with the PostgreSQL documentation |
| 3. MongoDB | see the vendor's documentation | read the MongoDB limits first |
| 4. MariaDB, 6. MySQL | the server's replication; Exponential can read from replicas | Read replicas |
| 5. Oracle | [ConnectionSettings] failover over several listeners, DRCP, retries | every feature is off by default (9.6) |
For a public body with a continuity duty, SQLite is the wrong engine once the duty asks for a standby database; plan the move to a database server (Changing the database engine).
Switching to a standby database
When the platform has no moving address and you switch by hand, the change on the Exponential side is one setting. The database steps (promoting the standby) follow your engine's documentation.
Put the site into maintenance, so nobody writes during the switch:
php bin/php/maintenance.php on --message="Switching database" --until=30m --allow-root-userPromote the standby with the database's own tools.
Change
Server(andPortif needed) insettings/override/site.ini.append.php,[DatabaseSettings]; with a cluster, also the cluster's database settings andCLUSTER_STORAGE_HOST.Clear the INI cache and make the engine read the new value:
php bin/php/ezcache.php --clear-tag=ini --allow-root-user ./console exp:velocity deploy --allow-root-userUnder PHP-FPM without Velocity, reload the PHP-FPM that serves the site.
Check the site, then end maintenance:
php bin/php/maintenance.php off --allow-root-user
A DNS name or virtual address that the database team moves makes step 3 unnecessary, and is the better design.
Testing it
A standby that was never switched to is a hope. Test the switch on a test environment (Environments for development, test and production), measure how long it takes, and record the time with your recovery objectives. After a real switch, check content published just before the failure: replication lag can lose the last writes.
Checklist
- To do: The engine supports the continuity duty (not SQLite when a standby is required).
- To do: The database team runs replication and owns the promotion procedure.
- To do: The site reaches the database through an address that can move, or the manual switch is documented.
- To do:
ConnectRetriesis decided. - To do: The switch was tested and its time recorded.
Related pages
- Availability index of this folder
- Choosing a database in the official order
- Backups per database engine
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.