2

OpenX info: OpenX v2.8.7 running under Apache 2.2.19, PHP 5.3.6 and MySQL 5.1.56-log.

I'm having some troubles with a distributed OpenX installation.

I have an architecture based on one MASTER server with global database and administration interface and some SLAVE servers (for now one) with a local database that serve the banners.

The MySQL replication of the MASTER is working fine (as every change in the master is replicated onto the slave) and the maintenance scripts (maintenance.php for the MASTER and maintenance-distributed.php for the SLAVE) look like are working well (no bad debug traces). The system was configured following the OpenX documentation for distributed systems.

These are the cronjobs that runs the maintenance scripts:

MASTER

5 * * * * /usr/local/bin/php /var/www/scripts/maintenance/maintenance.php www.mydomine.com

SLAVE

10,25,40,55 * * * * /usr/local/bin/php /var/www/scripts/maintenance/maintenance-distributed.php www.mydomine.php

The problem is that the impression summary are not being calculated and showed on the admin interface (on the MASTER server), I've been debugging and I end up with the next result:

  1. The banners are being served OK
  2. The slave server is logging the impressions OK
  3. The slave server is sending the data back to the MASTER OK
  4. The master is getting the data from the server (the tables ox_data_bkt_* are full)
  5. The master is not summarizing the data on the administration interface

This is a example query from the MASTER database:

select interval_start, sum(count) from ox_data_bkt_m group by interval_start;

The result contains all the impressions logged and sended from the SLAVE to the MASTER.

+---------------------+------------+
| interval_start      | sum(count) |
+---------------------+------------+
| 2011-06-25 10:00:00 | 1883133 |
| 2011-06-25 11:00:00 | 2074979 |
| 2011-06-25 12:00:00 | 2239609 |
+---------------------+------------+
5 rows in set (0.00 sec)

But on the administration interface I got no impressions for that times....

Trying things we realized that the script scripts/maintenance/tool/republish.php actually fix the problem for the past stats, but the new ones still doesn't show up. We figure out that using the republish.php script after every maintenance cycle on the MASTER will get the right numbers, but i think this is a dirty fix and must be a real solution.

SubniC
  • 9,807
  • 4
  • 26
  • 33
  • SubniC - how did you get the republish script to work? I keep getting the following error: C:\apache\htdocs\scripts\maintenance\tools>C:\php\php.exe -f republish.php 'ads. ourdomain.ca' '2012-11-09 01:00:00' '2012-11-12 14:00:00' The end date passed into the republish.php script is not a valid operation interval end date. Please pass in the end date in '%Y-%M-%d %H:%m:%s' format. The republish.php script will NOT be run. – Brad Nov 19 '12 at 16:15
  • Hi Brad, try this way: php.exe -f republish.php ads.ourdomain.ca "2012-11-09 01:00:00" "2012-11-12 14:00:00" – SubniC Nov 19 '12 at 17:01

2 Answers2

4

In almost all cases where I've seen this happening, it turned out the clocks on the master and on the slave were running at different time zone settings, causing the master to look for raw stats that simply weren't there (yet).

  • Hi Erik, thanks for your answer, i have checked the timezone configuration for everything (system, PHP and MySQL) and it is the same among both server... Now i'm running some test, i think the problem can be a sync problem between the maintenance of the server. I'll let you know. – SubniC Jun 27 '11 at 09:18
1

The problem is fixed, it was a problem with the timing of the maintenance scripts.

The maintenance-distributed.php have to be called on the slave nodes BEFORE the maintenance.php is called on the MASTER node, BUT maintenance-distributed.php have to be called once the last hour of statistics is already gone... just an example to make it clear:

I get impressions in the slave server from 00:00:00 to 00:59:59 the I run maintenance-distributed.php at 01:01:00 on the slave server and the data are sent back to the MASTER node, now, say for example at 01:05:00 I can run maintenance.php on the MASTER node.

These are the new cronjobs:

MASTER

5 * * * * /usr/local/bin/php /var/www/scripts/maintenance/maintenance.php www.mydomine.com

SLAVE

1,10,25,40,55 * * * * /usr/local/bin/php /var/www/scripts/maintenance/maintenance-distributed.php www.mydomine.php
SubniC
  • 9,807
  • 4
  • 26
  • 33