Storage
A running site keeps its information in three places: the database, the var/ directory and the settings files. Knowing which is which tells you what to back up, what you may clear and what an update replaces.
| What | Where | Back it up? |
|---|---|---|
| Content: classes, objects, versions, the tree, users, roles, sections, URL aliases, orders | The database (MySQL or MariaDB, PostgreSQL, SQLite, MongoDB, or Oracle with the ezoracle extension) | Yes |
| Uploaded images and files | var/<site>/storage/ | Yes, together with the database |
| Caches | var/<site>/cache/ | No: they are rebuilt |
| Logs | var/log/, var/<site>/log/ | As your policy needs |
| Your settings | settings/override/, settings/siteaccess/, the settings/ of your extensions | Yes (keep passwords out of version control) |
| Designs and extensions | design/, extension/ | Yours, in version control; shipped ones come back with Composer |
Why files are not in the database
Images and other files are stored on the file system, and the database keeps only their names and properties. The web server can send a file directly, external tools can read or index it, and the database stays small enough to copy and back up quickly.
- Images go below storage/images/. The original upload is kept, and each size a template asks for (an image alias such as small, medium or large, defined in image.ini) is made from it the first time it is needed and stored beside it.
- Files (the binary file and media datatypes) go below storage/original/, in a directory per MIME group such as application/ or video/.
Where the directories are is set in site.ini [FileSettings]: VarDir (default var) and StorageDir (default storage, inside VarDir). A siteaccess with its own VarDir, for example var/site, keeps its files apart from the others.
Several web servers
When more than one web server runs the same site, they must share the files. file.ini [ClusteringSettings] FileHandler chooses how: eZFSFileHandler (the default, one server) or eZDFSFileHandler (a shared mount set in [eZDFSClusteringSettings] MountPointPath, with the file metadata in the database). The cluster entry point index_cluster.php then serves the stored files.
Back up the database and var/<site>/storage/ at the same moment, or they will not match after a restore. The Operating a site guide describes backups and repairs.
Contributors
- Balazs Halasy
- Geir Arne Waaler
- Graham Brookins Updated Maintainer
Comments
Add a comment