How to export and import MongoDB database completely from old server to new one?

General Discussion
  • Hello,

    My website https://pythonforum.ir is currently working on the current server fine, but I want to migrate it to another server (from Germany to Iran).
    I somehow reached success, but it's not complete I think.
    I use mongodump command to backup all databases of the old server (admin and nodebb). I make a zip archive file of /root/nodebb/ path to make backup of everything.
    Now I transfer them into the Iran server 185.18.215.223.
    When I use mongorestore command to restore /root/dump/ that contains two folders "admin" and "nodebb", it shows me that it is restored but I see that it's not done completely.

    For example, in admin panel of the old server, I see the logs of unique visitors and things like this, but in the new server I do not see that.
    Also I see almost none of the settings have been imported. Things like in http://pythonforum.ir/admin/settings/general are not imported (none of them), but my categories do exist in the new server.

    My old server expires in two days (17th September is the expiration date).

    Would you please help me how may I migrate it without any loss of data?

    Thanks in advance

  • How did you install NodeBB on the new server?

  • Hello,

    I installed it by https://docs.nodebb.org/installing/os/ubuntu/ link (fresh install).

  • Can you describe what steps you took after the clean install to restore your database? It's my guess that restoring over the fresh db from the clean install may be the source of your issues.

  • Hello,
    Thanks, I guess so, but I don't know my wrong.

    I disabled authorization in mongodb.conf in order to mongodb let me restore the file.
    It restored but I saw some duplicate key entry errors in the screen (if needed, I can remove nodebb database in the new server to see the errors).
    I use mongo command to switch to nodebb database and drop it completely, now when I use show dbs, I see admin, local,config.

    That's what I did to restore database.

  • @PitaJ said in How to export and import MongoDB database completely from old server to new one?:

    Can you describe what steps you took after the clean install to restore your database? It's my guess that restoring over the fresh db from the clean install may be the source of your issues.

    If you set my domain to Iran IP in your hosts file, you would see the differences.
    Also I should note that in my old server, requests are all set to 443, but in new server it just works with port 80 and I have not yet installed Let's Encrypt in the new server.

  • Please try dropping all dbs in your new mongo install. Then try the mongorestore process again. See if that works.

  • Hello,

    I dropped all dbs (nodebb, local, config) and the ran mongorestore dump/ and it restored without warning or errors, but I still have issue.

    Also when I restart mongod, it fails now and it cannot connect to database. I think I should re-install it because I did not find a solution to fix it (database not running now).

    My question: would it work if beside restoring by mongorestore, I copy all files of /var/lib/mongod/ from old server to new one?


Suggested Topics


  • Server Performance

    General Discussion
    0 Votes
    5 Posts
    698 Views

    @Pummelchen Those are great metrics! Thanks for sharing 🙂

    Our standard is 500k views per month, but it is a very conservative limit. Also keep in mind depending on forum usage, there would be fewer actual page loads, and more relatively lightweight calls to /api, so in theory, you could handle even more traffic.

  • New User Login Error

    General Discussion
    0 Votes
    8 Posts
    2k Views

    @frissdiegurke said:

    seems similar to the bug https://github.com/NodeBB/NodeBB/issues/3489 so you may just need to update your dependencies (rm -rf node_modules && npm cache clean && npm i).

    That worked, thanks!

  • 0 Votes
    4 Posts
    2k Views

    @misdigest If they are not compatible with your version of NodeBB then you can either downgrade NodeBB, not use the plugin or try and upgrade the plugin yourself. You could also ask the developer of the plugin if they will upgrade it for better compatibility.

    Usually the errors will give you some information on what is causing the problem.

    at Object.Soundcloud.init [as method] (/root/misdigestbb/misdigestbb/node_modules/nodebb-plugin-sso-soundcloud/library.js:26:66)

    Suggests that the nodebb-plugin-sso-soundcloud plugin is causing one problem

  • 0 Votes
    1 Posts
    547 Views

    The facts put forward in this blog are quite interesting. But can they completely replace the use of biometric identification. Also, what new level of safety and security can the integration of smart card with biometrics bring?

  • 0 Votes
    3 Posts
    1k Views

    I would like to see that plugin too.