Two things you can try
Comment out https://github.com/NodeBB/NodeBB/blob/master/public/src/admin/admin.js#L47 Add a true to this if block so it doesn't logout the admin automatically https://github.com/NodeBB/NodeBB/blob/master/src/middleware/admin.js#L148Big size of nodebb.sessions in MongoDB
-
Hi. I have a little problem with MongoDB storage - my collection named "nodebb.sessions" grows too fast after only few month of live working
{
"name": "nodebb.sessions",
"count": 2821032,
"size": 687468454,
"avgObjSize": 243,
"storageSize": 304398336,
"totalIndexSize": 215842816,
"indexSizes": {
"id": 188940288,
"expires_1": 26902528
}
}
can I truncate it? or something else happened with forum? or its normal& thanks in advise. -
In mongo cli you can run
db.sessions.find().pretty()
and check the max age and expires values, see if there is anything wrong there. -
Thanks. here is output
.......
{
"_id" : "zudIEAcDN-TdO1EoY8ezdf_TEd6btx3a",
"session" : "{"cookie":{"originalMaxAge":1209600000,"expires":"2017-11-18T15:29:02.913Z","secure":true,"httpOnly":true,"path":"/"}}",
"expires" : ISODate("2017-11-18T15:29:02.913Z")
}
{
"_id" : "yoLR3qVOSjfv3_lEjza0FKKcgagQJ24P",
"session" : "{"cookie":{"originalMaxAge":1209600000,"expires":"2017-11-23T06:12:31.671Z","secure":true,"httpOnly":true,"path":"/"}}",
"expires" : ISODate("2017-11-23T06:12:31.671Z")
}
{
"_id" : "15-HQ7qqcI6mlu2I7w569qtteZm2fkIm",
"session" : "{"cookie":{"originalMaxAge":1209599999,"expires":"2017-11-30T12:25:04.445Z","secure":true,"httpOnly":true,"path":"/"}}",
"expires" : ISODate("2017-11-30T12:25:04.445Z")
}
.......
what do you think - is everything normal? -
Looks normal, the first entry should expire and get removed from the sessions collection in 2 days, you can check back and see if it was actually removed. Do you have a lot of traffic?
-
Thanks - I will check. Not a lot of traffic for now, but few days ago it was ddos attack on us - may it be the reason of my trouble?
-
That would certainly do it, you can remove all the sessions from that date by running a mongo query if you want.
-
Thanks a lot and for fast answer!
-
Everything good. session was sucsessfully deleted after expired. and NodeBB has good resistant to attacks like ddos under 1.5 million requests by day!