No data in Statistics pages

From Kolmisoft Wiki
Revision as of 06:21, 4 March 2019 by Edvardas (talk | contribs)
Jump to navigationJump to search

This applies since MOR X7.

Run following commands to fix it.
For MOR:

svn update /usr/src/mor

For M2:

svn update /usr/src/m2

Then:

service elasticsearch restart

Wait about one minute for Elastiscearh to start and then run command

elasticsearch resync


ES (ElasticSearch) is a tool that we use to show statistics in MOR.
ES Sync Status shows how accurate is ES data compared to MySQL data.
ES periodically fetches data from MySQL.
Since this action is not in real time, some miss match is possible when you have active calls.
This miss match should be only noticeable when checking newest calls.
Eventually all calls should be synchronized between ES and MySQL. Small percentage miss match is normal.

If not all calls are synchronized

Check ElasticSearch count:

elasticsearch count
[root@CentOS-68-64-minimal ~]# elasticsearch count
{
 "count" : 956528,
 "_shards" : {
   "total" : 5,
   "successful" : 5,
   "failed" : 0
 }

Then check how many calls are in database. ElasticSearch count and value from database should be almost the same:

mysql> select count(*) from calls;
+----------+
| count(*) |
+----------+
|  1056672 |
+----------+

If for some reason there is a mismatch, run:

curl -XPUT localhost:9200/_cluster/settings -d '{ "transient" : { "threadpool.bulk.queue_size" : 100 } }'
elasticsearch resync

Possible reason of mismatch: https://stackoverflow.com/questions/20683440/elasticsearch-gives-error-about-queue-size

Re-synchronize calls for specific period

If there are many calls in database, for example, 50 or 100 millions, re-synchronization might take few hours to become completed. If you are generating invoices, checking statistics for example, one month, 2 weeks etc then you can try to re-synchronize only this specific period. To do so, firstly, restart elasticsearch.

service elasticsearch restart

Make sure that all shards are loaded successfully.

elasticsearch count
{
 "count" : 956528,
 "_shards" : {
   "total" : 5,
   "successful" : 5,
   "failed" : 0
 }

Total must be the same as Successful. If it shows that:

elasticsearch count
{
 "count" : 956528,
 "_shards" : {
   "total" : 5,
   "successful" : 2,
   "failed" : 0
 }

Wait 10-15 minutes and re-check again. If it still shows that Successful shard quantity is lower than total, full re-sync must be done, as in the beginning of manual.
If all shards are loaded successfully, then write

elasticsearch resync interval "2018-12-01 00:00:00" "2018-12-31 23:59:59"

It will re-synchronize calls only for December.