Distributed statistics

The distributed statistics feature allows OpenX to scale by moving some of the load from the central database to web servers. If you are using OpenX with one web server it has to deal with all tasks on one machine. Using many web servers allows you to split delivery and admin/maintenance. When using distributed statistics, the delivery web servers log raw data (impressions/clicks, etc.) into a local MySQL database and migrate it periodically into the central database. MySQL replication is used to replicate data from the central database into the delivery web servers.

How to set up MySQL replication

It is relatively easy to set up replication using MySQL, but it is important that you read all of the replication documentation from the MySQL website before attempting configuration!

The following is a brief summary of how to enable replication using MySQL:

Admin box configuration

Delivery boxes configuration

The configuration file should match the admin one, but:

Maintenance

Upgrades

  1. Upload the code to main and delivery boxes.
  2. Switch off maintenance on main and delivery boxes.
  3. Change the (local) ADMIN:database password to an incorrect one in every delivery box config file, to enable permanent caching.
  4. Copy the config files to the new directory.
  5. Run upgrade on main box.
  6. Check that non-replicated delivery database tables are OK.
  7. Upgrade every delivery box to the new version:
    • Diff the new admin config file.
    • Update delivery server config file with any changes.
    • touch var/INSTALLED and remove var/UPGRADE on delivery boxes.
    • Ensure that permissions are correct.
    • Switch directories.
  8. Restore passwords on delivery boxes.
  9. Restore maintenance.