Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Resource Synchronization between Mongodb and Redis

73 views
Skip to first unread message

mehdi.al...@gmail.com

unread,
Aug 15, 2021, 2:48:25 AM8/15/21
to Sentilo
Hi Dear Sentilo Team 

We are using sentilo 1.9 and web deployed sentilo in docker.  four containers , one for sentilo-server , second one for redis, third one for mongodb and last one for tomcat. 

I works fine and every things are good.
Default configs of Redis for  snap shutting  is accepted 


save 900 1
save 300 10
save 60 10000
#   after 900 sec (15 min) if at least 1 key changed
#   after 300 sec (5 min) if at least 10 keys changed
#   after 60 sec if at least 10000 keys changed

so Redis dumps its memory on disk. 

For some tests I deleted the dump file of Redis and restart redis server, then I tried to publish some observations to the sensor which is created before.  This  sensor is exist in mongodb and I can see it on the web dashboard,  it means I have this sensor but sentilo does not find it in the redis and finally,  sentilo reject the request with the following message: 


{"code":404,"message":"Events associated with resources [ss1] have been rejected. See the error details to know about what went wrong in each case","errorDetails":["Sensor [ss1] not found on Sentilo (404.1)."]} 



I checked  SynchronizationServiceImpl  class in  sentilo-catalog-web code. My assumption was the resource synchronization service sync the mongodb and redis but,  in practice it does not happen and it just sync the new resources (e.g. new sensors). 

The question will be remain is that,  if for any reason lost redis data, you can not publish observations to the sensors which are created before. 

Do you have any comment ?

Thank you 
Mehdi

Sentilo IO

unread,
Sep 13, 2021, 8:40:59 AM9/13/21
to Sentilo
Hi Mehdi,

Your assumption is right, if you start from a Redis from scratch from the Catalog point of view the sensors are sychronized. 
You could check it in the "sychronized" sensor's field, which stores this setting in mongo DB.
If it's necessary to force the sychronization you could update the MongoDB, executing this sentence through a console:
 db.sensor.update({},{$unset:{synchronized:""}},{multi:true});
After that, the sychronization process will run and the Redis will be updated with de Catalog data.

Regards.
Sentilo Team.

mehdi.al...@gmail.com

unread,
Sep 16, 2021, 4:55:05 AM9/16/21
to Sentilo
Thank you for the response 
I will test it 

Reply all
Reply to author
Forward
0 new messages