سؤال

What are the best practices of packing Plone ZODB database regularly (e.g. weekly)?

  • Plone ZEO cluster and a single process Zope instance differ?

  • Using zeopack + cron

  • Using wget + some URL + cron + special Zope user

  • Other ways?

  • ZClockServer vs. cron?

I have found out that sometimes zeopack in fact does not pack the database if the command is run in cron. However, debugging this issue is little problematic as neither zeopack and ZODB do not report much about themselves. Any ideas what could cause such conditions?

هل كانت مفيدة؟

المحلول

This is dependent on how you configured your site, between 3 options:

  1. Stand-alone, using a Data.fs (the default). Your only option is to use a wget cron job, preferably with a dedicated Zope user whose only permission is to pack. This is because the Zope process is the only process that has access to the Data.fs.

  2. A ZEO setup. Now you can instruct the ZEO server to pack your Data.fs using a cron job (see What is the suggested way to cron-automate ZODB packs for a production Plone instance?).

  3. A RelStorage setup. RelStorage include it's own packing script; here's a buildout configuration to create it, you can then run this from a cron job:

    [buildout]
    packing-parts =
        relstorage-zodbpack-conf
        relstorage-zodbpack
    
    [relstorage-zodbpack-conf]
    recipe = collective.recipe.template
    input = inline:
        <relstorage>
            pack-gc true
            create-schema false
          <[yourdatabase]>
            [database connection info]
          </[yourdatabase]>
        </relstorage>
    output = ${buildout:directory}/etc/zodbpack.conf
    
    [relstorage-zodbpack]
    recipe = zc.recipe.egg:scripts
    eggs =
        RelStorage
    scripts = zodbpack
    initialization =
        config = '${buildout:directory}/etc/zodbpack.conf'
    arguments = config
    
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top