Oh, thanks a lot for your helping. 🙂
UNSOLVED Mongodb not working
Hello. Yesterday I updated my NodeBB from 1.18.0 to .3 and restarted the computer it runs on (Ubuntu 20.04 ish, regular laptop home hosted) and when I boot it back up I realize the mongodb service won’t start no matter what. I couldn’t figure this out, and NodeBB doesn’t start of course if database isn’t running.
I looked around and realized that it wasn’t loading the confit file or something, because there error was that it couldn’t find a database at this path because it was hosted in a different path. (It thought it was in default db folder but I set config to a different
Anyway I can get it to work if I open a terminal and
sudo mongodb -dbpath my/correct/path
But I would rather not keep it in a terminal window and instead have it be a service
@dunlix So you updated NodeBB only? No other system updates that may have touched mongodb, correct? Cuz, if so, then this just seems bizarre - why, oh why, would a NodeBB update/grade have anything to do with mongodb? Mongodb should still start regardless, independent, of any NodeBB changes. It is not like they are joined at the hip. One uses your pkg manager to update, whilst the other is.... other... depending on how you do it.
If sudo is working for you, and assuming that you are otherwise utilizing systemd to launch mongodb, I suggest you either 1) examine the mongodb service file and tweak to point to correct path, or 2) relocate that mongodb data dir to where mongodb expects to find it. Then go from there.
Hope this helps. But, like I said, unless you also ran some system wide updates, this seems rather bizarre.
Good luck and have fun! o/
realized that it wasn’t loading the confit file or something, because there error was that it couldn’t find a database at this path
This needs to be investigated further. Logs??
@gotwf I agree I’m the sense that this problem really isn’t a bug with NodeBB unless it messed with systemctl or something (I don’t even have NodeBB running as a service)
Of course I would rather mongo not be in console window because of clutter, security, etc.
The problem really is that Systemctl or services or whatever fail to try to start mongo with proper path and it doesn’t work ofc. But I don’t know how to fix this, even though it’s probably s simple fix.
Also I didn’t run any updates other than NodeBB until after this problem started
@gotwf also I can get logs later if you tell me where to find them
I guess they will say the same thing that the path is invalid
@dunlix Cannot speak for Ubuntu but on CentOS they are thus:
[root@forums mongodb]# pwd /var/log/mongodb [root@forums mongodb]# ll total 11533 -rw-r----- 1 mongod mongod 11753544 Sep 22 20:39 mongod.log
Similarly, I expect your mongo.conf to be located under /etc:
[root@forums ~]# ll /etc/mongod.conf
I expect same on Ubuntu but one never knows. Especially since your data dir appears to be in an atypical location.
In any event, you should be able to scout mongod.conf for parameters such as system log and data dir paths.
[root@forums ~]# grep -i dbpath /etc/mongod.conf dbPath: /var/lib/mongo
Then edit your nodebb config.json as appropriate.
Seems like maybe, just maybe, your nodebb update/grade may have somehow overwritten your config.json?
Have fun and good luck! o/
@gotwf I know my NodeBB config wasn’t changed or anything because I actually checked in case I overwrote it.
If all comes to loss then I could just move the db to its default location that it wants
@dunlix Would not it be simpler to just tweak your nodebb config.js to point to the correct mongod datadir?
@gotwf doesn’t NodeBB only connect to mongo through local host and default port? I didn’t think the data dir. is even a part of the NodeBB.config
@dunlix Uh, duh!! Apologies for the brain fart on that one. !Aye, caramba!!