Make sure mongo is running
Ahh fuck. That's what it was. I thought I set that up to automatically start.. Thanks!
Make sure your server has enough ram or setup some swap, it sounds like your OS is killing the mongodb process.
It has 8GM ram and 2GB swap, large enough I think?
@xidui Yeah that should be more than enough, my server (I have Redis though) has only 1,5 GB. What operating system are you using?
It's ubuntu 14.04.
By the way, what's your average CPU usage at peak time or the moment you restart your server? Every time I restart my server, it's a terrible thing, the server failed to response for about several minutes. During that time, nodebb, nginx and mongo eats up the CPU.
That's not normal at all. Could you do
./nodebb log after startup and after MongoDB crashes? Should be weird messages in there.
Ok, I will have a try next time. But I remember that there is no useful information.
@xidui are you using multiple processes with a reverse proxy?
I got mongodb installed. I had no issues with it, except when my server restarts, it won't start... but I know why, I have an NFS share to another (smaller, but bigger storage) server for storage and it tries to start without the mount... something for me to look into.
But other than that, I had no issue, where mongodb would stop randomly.
@Adam-Poniatowski You may need a file
[Unit] Description=High-performance, schema-free document-oriented database After=network.target [Service] User=mongodb ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf [Install] WantedBy=multi-user.target
For Ubuntu 16.10... as Ubuntu no longer uses Upstart
@julian Thanks for that I use centos 7 though, but luckily they both use systemd, so that is fine with me.
I will try this out, hopefully it won't do the same thing as what it currently does... fails to start, because the nfs share is not mounted yet lol
Do you think I might need this:
RequiresMountsFor=/path/to/mount/ ? just in case... and my nodebb.service I just add: Requires=mongod.service ... or will this not automatically start?
systemctl enable mongod if you use Centos7.
It will link some scripts to the upstart dir.
@xidui I mainly use systemctl because mongodb has a systemvinit script, it generates one (mongod.service), which I have to disable and enable again (with the new mongod.service file) to make the symlink files and I can start it. the problem is, it starts up before my nfs mount...
Is there any way to convert a MongoDB database to Redis? Maybe that could fix it for @xidui.
@xidui they don't deal with it coz they don't have that issue. Check mongo logs if there is anything there.
@xidui just a friendly offer here. Maybe you want someone to host your Mongo database (PM me). Otherwise I suggest to scale horizontatally. Meaning to have a seperate machine for all your tasks.
@pichalite the only reason to use MongoDB is a financial one. Meaning that you cannot afford more RAM. However, considering you want to achieve the best UX you want to target the greatest speed possible. Therefore Redis should always be your first choice. Especially as it could be replaced by SSDB for example. A drop in replacement for Redis.