Skip to content

Clustering Support

Lorenzo Natali edited this page May 16, 2017 · 7 revisions

We added support to run the printing-plugin on a geoserver cluster.

To configure it, run the web container (Tomcat) with a JVM option to set a shared folder for the generated PDFs; the folder has to be shared by all the cluster nodes, so that generated pdfs can be reached by any node . The option is MAPFISH_PDF_FOLDER (eg. -DMAPFISH_PDF_FOLDER=/opt/mapfish/pdfs).

Moreover, the plugin needs to be configured for clustering too; to do it do the following steps:

  • extract the applicationContext.xml file from the printing-*.jar file contained in the GeoServer printing plugin package
  • edit the extracted applicationContext.xml and:
    • add two new properties (cluster and tempdir) to the initParameters section of the printingWrapper bean
    • add support for property placeholder, with the following setting at the top of the file:
    <context:property-placeholder></context:property-placeholder>
    ...
    <property name="initParameters">
      <props>
        <prop key="config">config.yaml</prop>
        <prop key="cluster">true</prop>
        <prop key="tempdir">${MAPFISH_PDF_FOLDER}</prop>
      </props>
    </property>
  • zip back the updated applicationContext.xml into the printing-*.jar file and put the new file inside the GeoServer WEB-INF/lib folder (restarting GeoServer as needed)

With this new configuration, the created pdf is written in the shared folder together with the spec request used to generate it.

Example:

jar -xf gs-printing-2.10-SNAPSHOT.jar applicationContext.xml
vim applicationContext.xml
# add the props to the initParameters property...
jar -uf gs-printing-2.10-SNAPSHOT.jar applicationContext.xml