Multiple Zopes in Zenoss 4.2.x

From Zenoss Wiki
This is the approved revision of this page, as well as being the most recent.
Jump to: navigation, search

Before following this guide please tune zope especially the python-check-interval.

  • This write up is for Red Hat/Cent OS 6
  • All commands should be run as the zenoss user

1. Stop Zope

zopectl stop

2. You will need to create new directories under /opt/zenoss/var/ called zope plus the zope instance starting with 1. Create the amount of directories depending on the number of zope processes you will spin up. In this example I am going to start 2 zope processes.

mkdir -p /opt/zenoss/var/zope1

mkdir -p /opt/zenoss/var/zope2

3. Create new zope.conf under new directories

for i in {1..2}; do echo -e "%include /opt/zenoss/etc/zope.conf\nclienthome /opt/zenoss/var/zope$i\nport-base 100" > /opt/zenoss/var/zope$i/zope.conf; done

4. Backup zopectl and runzope

cp /opt/zenoss/bin/zopectl /opt/zenoss/bin/zopectl.bak

cp /opt/zenoss/bin/runzope /opt/zenoss/bin/runzope.bak

5. Create new zopectl and runzope

echo -e '#!/bin/sh\nPYTHON="/opt/zenoss/bin/python"\nINSTANCE_HOME="/opt/zenoss"\nexport INSTANCE_HOME PYTHON\nZDCTL="/opt/zenoss/zopehome/zopectl"\nZOPES=2\nfor i in $(seq 1 $ZOPES); do\n ##Setup enviornment to start zope\n clienthome="$INSTANCE_HOME/var/zope$i"\n cfg="$clienthome/zope.conf"\n CONFIG_FILE=$cfg\n export CONFIG_FILE\n ##Start Zope\n "$PYTHON" "$ZDCTL" -C "$cfg" "$@"\ndone' > /opt/zenoss/bin/zopectl

echo -e '#!/bin/sh\nCONFIG_FILE="${CONFIG_FILE:-/opt/zenoss/etc/zope.conf}"\nZOPE_RUN="/opt/zenoss/zopehome/runzope"\nexec "$ZOPE_RUN" -C "$CONFIG_FILE" "$@"' > /opt/zenoss/bin/runzope

chmod +x /opt/zenoss/bin/runzope

chmod +x /opt/zenoss/bin/zopectl

6. Start your new Zope instances

zopectl start

Since the port-base in each of your new zope.conf is 100 and 101 your new zope instances will run on port 8180 and 8181.