Trying to switch MeshCentral from MongoDB to NeDB



  • I posted an issues on their github to see if they have a way to handle this.

    https://github.com/Ylianst/MeshCentral/issues/246

    Obviously, I can reinstall.

    This entire thing is a test system, but this database issue could be important, so I asked.



  • So I resintalled Mongo using this method to get the repo on the system.

    4.0.9 installed. but it will not start.

    [[email protected] ~]# systemctl start mongod
    Job for mongod.service failed because the control process exited with error code.
    See "systemctl status mongod.service" and "journalctl -xe" for details.
    
    [[email protected] ~]# journalctl -u mongod.service
    >skip reboots, and multiple attempts...<
    May 25 14:21:45 mc.bundystl.com systemd[1]: Starting MongoDB Database Server...
    May 25 14:21:45 mc.bundystl.com mongod[7823]: about to fork child process, waiting until server is ready for connections.
    May 25 14:21:45 mc.bundystl.com mongod[7823]: forked process: 7825
    May 25 14:21:45 mc.bundystl.com mongod[7823]: ERROR: child process failed, exited with error number 1
    May 25 14:21:45 mc.bundystl.com mongod[7823]: To see additional information in this output, start without the "--fork" option.
    May 25 14:21:45 mc.bundystl.com systemd[1]: mongod.service: Control process exited, code=exited, status=1/FAILURE
    May 25 14:21:45 mc.bundystl.com systemd[1]: mongod.service: Failed with result 'exit-code'.
    May 25 14:21:45 mc.bundystl.com systemd[1]: Failed to start MongoDB Database Server.
    


  • manually executed mongod pointing the DB folder to the meshcentral dat afolder and it all started up

    mongod --dbpath /opt/meshcentral/meshcentral-data/
    

    Then restarted the meshcentral service

    systemctl start meshcentral
    

    But it is like a brand new instance. 😞



  • Found my data.. Mongo on Fedora 29 put the database in /var/lib/mongodb



  • Exported, cleaned up references to mongo and all better. No Mongo.

    Export the database (this uses the running database, so I had to have Mongo fixed)

    cd /opt/meshcentral
    node node_modules/meshcentral --dbexport"
    

    Go in the config file and remove the "mongodb" line(s) in settings

    nano /opt/meshcentral/meshcentral-data/config.json
    

    Restart meshcentral

    systemctl restart meshcentral
    # or
    /opt/meshcentral/mcstop
    /opt/meshcentral/mcstart
    

    Import the database

    cd /opt/meshcentral
    node node_modules/meshcentral --dbimport"
    

    Restart meshcentral

    systemctl restart meshcentral
    # or
    /opt/meshcentral/mcstop
    /opt/meshcentral/mcstart