Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

pypm install zc.zrs

How to install zc.zrs

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install zc.zrs
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
Windows (64-bit)
Mac OS X (10.5+)
Linux (32-bit)
Linux (64-bit)
2.4.4 Available View build log
ZPL 2.1
Lastest release
version 2.4.4 on Jan 9th, 2014

ZODB replicated storage (ZRS) provides database replication for ZODB. For each database, a primary storage and one or more secondary storages may be defined. The secondary storages will automatically replicate data from the primary storage.

Replication is superior to back-ups because as long as secondaries are running, secondary data is kept updated. In the event of a failure of a primary storage, just reconfigure a secondary to be the primary, and it can begin handling application requests.


  • Primary/secondary replication
  • Support for read-only secondary storages
  • Service registration and discovery with ZooKeeper


  • ZODB 3.9 or later.


ZRS is installed like any other Python package, by installing the zc.zrs package with easy_install, zc.buildout, pip, etc.

Using ZRS

ZRS provides two ZODB storage implementations: a primary storage and a secondary storage. Both storages are used with file storages.

  • The primary storage is a readable and writable storage.

  • The secondary storage is read-only.

    A secondary storage can be used by read-only application clients to reduce server load.

    Secondary storages replicate from primary storages, or other secondary storages.

Theoretically, ZRS storages can be used wherever a ZODB storage would be used. In practice, however, they're used in ZEO servers.

Configuration with ZConfig

If using an application, like a ZEO server or Zope, that uses ZConfig to configure ZODB storages, the configuration of a ZRS primary or secondary storage may be included in the configuration file as with any other storage e.g, to configure a primary storage, use something like:

%import zc.zrs

 replicate-to 5000

     path /path/to/data/file

Here is a line-by-line walk through:

%import zc.zrs

The import statement is necessary to load the ZConfig schema definitions for ZRS.


The zrs section defines a ZRS storage. A ZRS storage may be a primary storage or a secondary storage. A ZRS storage without a replicate-from option (as in the example above) is a primary storage.

replicate-to 5000

The replicate-to option specifies the replication address. Secondary storages will connect to this address to download replication data. This address can be a port number or a host name (interface name) and port number separated by a colon.

  path /path/to/data/file

A ZRS storage section must include a filestorage section specifying a file storage to contain the data.

Configuring a secondary storage is similar to configuring a primary storage:

%import zc.zrs

 replicate-from primary-host:5000
 replicate-to 5000
 keep-alive-delay 60

     path /path/to/secondary/data/file

For a secondary storage, a replicate-from option is used to specify the address to replicate data from.

Because primary and secondary storages are generally on separate machines, the host is usually specified in a replicate-from option.

A secondary storage can also specify a replicate-to option. If this option is used, other secondary storages can then replicate from the secondary, rather than replicating from the primary.

Secondary storages also support the following optional option:

keep-alive-delay SECONDS
In some network configurations, TCP connections are broken after extended periods of inactivity. This may even be done in a way that a client doesn't detect the disconnection. To prevent this, you can use the keep-alive-delay option to cause the secondary storage to send periodic no-operation messages to the server.


Primaries and secondaries can register with ZooKeeper, so Secondaries can find primaries to replicate from without needing to configure a specific address. See zk.test and zkconfig.test in the source directory for more details.


2.4.4 2013-08-17

Fixed packaging bug: component.xml was left out.

2.4.3 2013-08-15

Packaging update: allow installation without setuptools.

2.4.2 2013-05-27

Initial open-source release for ZODB 3.9 or later.

2.0.5 2013-05-27

Initial open-source release for ZODB 3.8.

Initial open-source release. Requires ZODB 3.9 or later.

Subscribe to package updates

Last updated Jan 9th, 2014

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.