Aggregates Regeneration

From Kolmisoft Wiki
Revision as of 12:49, 27 July 2015 by Gilbertas (talk | contribs)
Jump to navigationJump to search


Description

Since MOR X5, aggregates internally are implemented completely different than previously. Now aggregates information is summarised in separate aggregates table, and GUI takes information from this table. This way aggregates are very fast now. However, sometimes aggregates table need to be re-generated, for example

  • Directions are added to new Destination Group, and we want aggregates to reflect this for past (already aggregated) data.
  • Provider is added to new Terminator, and we want aggregates to reflect this for past (already aggregated) data.
  • Other cases (Mysql failure, etc)



There are two ways to regenerate aggregates:

  • For complete period
  • For selected period



Please note that if you have several servers solution, you only need to to this on one server - MAIN database server.

For complete period

1. Stop mor_aggregates daemon

[root@mor ~]# service mor_aggregates stop

2. Connect to mysql

[root@mor ~]# mysql -u mor -pmor mor

3. Truncate and time_periods and aggregates tables

mysql> TRUNCATE TABLE time_periods;
mysql> TRUNCATE TABLE aggregates;

4. Exit mysql command line

mysql> quit

Bye

5. Start mor_aggregates daemon:

[root@mor ~]# service mor_aggregates start

6. Start /usr/local/mor/mor_aggregates_control script, which will regenerate aggregates

[root@mor ~]# /usr/local/mor/mor_aggregates_control

7. Wait while script exit. If there are many calls regeneration procedure can take place several hours. You can check progress in /var/log/mor/mor_aggregates_control.log

tail -f /var/log/mor/mor_aggregates_control.log




For selected period

To regenerate aggregates for selected period, you only need to launch /usr/local/mor/mor_aggregates_control script with arguments /usr/local/mor/mor_aggregates_control "DATE_FROM" "DATE_TILL" (NO other action like stopping/starting services, truncating tables are needed) For example,

/usr/local/mor/mor_aggregates_control "2015-01-01 00:00:00" "2015-01-21 16:00:00"

will regenerate aggregates from 2015-01-01 00:00:00 till 2015-01-21 16:00:00

You can also supply only "DATE FROM" aggregate, in which case aggregates will be regenerated from "DATE FROM" till current server date. For example:

/usr/local/mor/mor_aggregates_control "2015-01-01 00:00:00" 

will regenerate aggregates from "2015-01-01 00:00:00" till current server date.