Difference between revisions of "Aggregates Regeneration"

From Kolmisoft Wiki
Jump to navigationJump to search
Line 13: Line 13:
<br><br>
<br><br>


There are two ways to regenerate aggregates:
Please note that:
* If you have several servers solution, you only need to to this on one server - '''MAIN database server.'''
* Aggregates regeneration '''takes system resources''', so if you regenerate for long period, it it best to do this in off-peak hours.


* For complete period
* For selected period
<br><br>
<br><br>


'''Please note that if you have several servers solution, you only need to to this on one server - MAIN database server.'''
There are two ways to regenerate aggregates: '''for complete period''' (for all calls that are stored in calls table) and '''for selected period'''.
 
<br><br>


==For complete period==
==For complete period==
Line 40: Line 42:
  [root@mor ~]# service mor_aggregates start
  [root@mor ~]# service mor_aggregates start


6. Start /usr/local/mor/mor_aggregates_control script, which will regenerate aggregates
6. Launch screen
[root@mor ~]# screen
 
7. Start /usr/local/mor/mor_aggregates_control script, which will regenerate aggregates
  [root@mor ~]# /usr/local/mor/mor_aggregates_control
  [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
8. 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
  tail -f /var/log/mor/mor_aggregates_control.log
9. Exit screen
[root@mor ~]# exit





Revision as of 12:52, 27 July 2015


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)



Please note that:

  • If you have several servers solution, you only need to to this on one server - MAIN database server.
  • Aggregates regeneration takes system resources, so if you regenerate for long period, it it best to do this in off-peak hours.



There are two ways to regenerate aggregates: for complete period (for all calls that are stored in calls table) and for selected period.



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. Launch screen

[root@mor ~]# screen

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

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

8. 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

9. Exit screen

[root@mor ~]# exit




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.