Difference between revisions of "Aggregates Regeneration"
Line 64: | Line 64: | ||
will regenerate aggregates from 2015-01-01 00:00:00 till 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 " | 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" | /usr/local/mor/mor_aggregates_control "2015-01-01 00:00:00" | ||
Line 70: | Line 70: | ||
<br><br> | <br><br> | ||
===Freeing disk space=== | |||
Above mentioned aggregates regeneration procedure for selected period will not touch calls older than "DATE_FROM". So if you want to free-up disk space and only have aggregates for selected period, and all older aggregates data removed, please do the following: | |||
a) Complete 1) - 7) steps from [[Aggregates Regeneration#For complete period|For complete period]] | |||
b) Complete steps described in [[Aggregates Regeneration#For selected period|For selected period]] |
Revision as of 18:53, 6 October 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.
Freeing disk space
Above mentioned aggregates regeneration procedure for selected period will not touch calls older than "DATE_FROM". So if you want to free-up disk space and only have aggregates for selected period, and all older aggregates data removed, please do the following:
a) Complete 1) - 7) steps from For complete period
b) Complete steps described in For selected period