Setting it up for an eZDFSFileHandler
These steps move an Exponential 6 site from one server's local files to a DFS cluster: files on an NFS mount, metadata in a database table. Do them on a copy first, and take a backup of the database and of var/ before you start.
1. Prepare the mount and the database
- Export a directory over NFS and mount it at the same path on every web server, for example /mnt/exponential-dfs, writable by the user PHP runs as.
- Create the metadata tables. For MySQL or MariaDB they are in kernel/sql/mysql/cluster_dfs_schema.sql (ezdfsfile and ezdfsfile_cache, InnoDB). The site's own database server can hold them; a busy site benefits from a separate one.
mysql -h db.example.com -u cluster -p cluster < kernel/sql/mysql/cluster_dfs_schema.sql
2. Clear the caches
Optional, but it keeps the amount of data to move small. On every server:
php bin/php/ezcache.php --clear-all --purge
3. Configure the handler
In the global override settings/override/file.ini.append.php, the same on every server:
[ClusteringSettings] FileHandler=eZDFSFileHandler [eZDFSClusteringSettings] MountPointPath=/mnt/exponential-dfs DBBackend=eZDFSFileHandlerMySQLiBackend DBHost=db.example.com DBPort=3306 DBName=cluster DBUser=cluster DBPassword=secret
For PostgreSQL install se7enxweb/ezpostgresqlcluster and use its eZDFSFileHandlerPostgresqlBackend; for Oracle, ezoracle and eZDFSFileHandlerOracleBackend. All keys are on Cluster configuration settings.
4. Move the existing files into the cluster
Once, from one server:
./console exp:clusterize --allow-root-user # the same script: php bin/php/clusterize.php # options: --skip-binary-files, --skip-media-files, --skip-images, -n (do not wait)
5. Serve the files through index_cluster.php
Give index_cluster.php its constants in config.php on every server:
./console exp:config:set CLUSTER_STORAGE_BACKEND dfsmysqli --apply ./console exp:config:set CLUSTER_STORAGE_HOST db.example.com --apply ./console exp:config:set CLUSTER_STORAGE_PORT 3306 --apply ./console exp:config:set CLUSTER_STORAGE_USER cluster --apply ./console exp:config:set CLUSTER_STORAGE_PASS --value="$CLUSTER_DB_PASS" --apply ./console exp:config:set CLUSTER_STORAGE_DB cluster --apply ./console exp:config:set CLUSTER_MOUNT_POINT_PATH /mnt/exponential-dfs --apply
For a backend that lives in an extension, CLUSTER_STORAGE_GATEWAY_PATH names its gateway file (for example the one of ezoracle). Then send image and binary file requests to the script instead of the disk. In the .htaccess made from .htaccess_root, replace the two rules that serve var/.../storage/images and var/.../cache/(texttoimage|public) directly (they end in - [L]):
RewriteRule ^var/([^/]+/)?storage/images(-versioned)?/.* /index_cluster.php [L] RewriteRule ^var/([^/]+/)?cache/(texttoimage|public)/.* /index_cluster.php [L]
6. Reload and check
- Clear the INI cache (php bin/php/ezcache.php --clear-tag=ini), reload PHP-FPM, restart Exponential Velocity if you use it.
- Open pages with images on every server; images must answer 200 from index_cluster.php.
- Check consistency: ./console exp:dfscleanup -S --allow-root-user and -B must report no differences.
Known issue
Each server keeps its own var/ directory. Do not share var/ itself over NFS: only the mount named in MountPointPath is shared, and the handler keeps the local copies in step with it.
Related pages
Contributors
- Ester Heylen
- Bertrand Dunogier Maintainer
- Jérôme Vieilledent Maintainer
- Ricardo Correia Maintainer
- Graham Brookins Updated Maintainer
Comments
Add a comment