Master Openx Server Not Processing Slave Statistics
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:
- The banners are being served OK
- The slave server is logging the impressions OK
- The slave server is sending the data back to the MASTER OK
- The master is getting the data from the server (the tables ox_data_bkt_* are full)
- The master is not summari开发者_如何转开发zing 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.
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).
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
精彩评论