mongodb always down



  • Is there any fellow use mongodb to setup your site?

    My mongodb always down every several days. Is there any recommended way for mongo setup?

    @administrators
    Seems that currently Nodebb does not response to the fail of mongodb even I restarted mongo. I have to restart nodebb every time manually. That's an awful experience.



  • You can't use Redis?



  • @Jop-V.
    The site has run on mongo for long with 2G data in mongo. Can I transfer it to redis now? How to import the data?

    If I transfer to redis, is it possible that redis keeps down?



  • @xidui Oh, it sounded to me like you were just setting up your site.

    Is this very recent or has it always been like this?



  • @Jop-V.
    It always been like this.
    Actually, my site was served on phpbb, I migrated it to nodebb several months ago. Mongo always suffers a down every several days(about 1 week).



  • @xidui
    It seems impossible now to migrate back. :cry:


  • Admin

    Make sure your server has enough ram or setup some swap, it sounds like your OS is killing the mongodb process.



  • @baris
    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?



  • @Jop-V.
    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.



  • @Jop-V.
    Ok, I will have a try next time. But I remember that there is no useful information.


  • Global Moderator

    @xidui are you using multiple processes with a reverse proxy?



  • @PitaJ
    Yes, just followed this instruction
    and I opened 4 processes with nginx in front of them.



  • 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.


  • Admin

    @Adam-Poniatowski You may need a file /etc/systemd/system/mongod.service

          [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 :cry:



  • @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?



  • @Adam-Poniatowski
    Try 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.


Log in to reply
 

Looks like your connection to NodeBB was lost, please wait while we try to reconnect.