Create a clusterΒΆ

A cluster is a configuration where several servers are used to serve the application in production.

Creating a cluster implies to separate the database and the application to make sure that the data is the same on all servers.

One possibility is to have the same database for all servers (integration, production). A single schema for static data is shared, whereas a dedicated main schema will be used for each server.

Deploying data from integration to production may be done by cloning the main integration schema.

For the next steps, it is important to know if your main goal is the scalability or the robustness of the application.

In general, scalability is more important, because the main cause of down time is too much traffic.

In this case, the first thing to do is to separate the services:

  • PostgreSQL / PostGIS
  • Print
  • WSGI application
  • MapServer / MapCache / Memcached

To have better DB performance, one can setup multiple Postgres servers in a master/slave configuration. To enable this feature on GeoMapFish, you must add this to your vars_<project>.yaml:

dbhost_slave: my_db_slave_hostname

Then, all the GET and OPTIONS requests will use one of the slave Postgres instances and the rest will use the master instance. It is assumed, here, that the views handling the GET and OPTIONS queries do not cause write operations to the database (not supported by slave instances). If it is not the case in your application (bad practice), add entries to db_chooser/master in your vars_<project>.yaml. For forcing the use of a slave for a POST/PUT/DELETE, add entries to the db_chooser/slave configuration.

To have more than one slave instance and to have an automatic election of a new master in case of failure, you must setup a high availability proxy (HAProxy, for example). This is out of the scope of this document. If you do not care about failover, you can use one DNS entry with multiple IP entries for the slaves.