/whi_mongodb_server

database server of mongodb

Primary LanguageCMakeApache License 2.0Apache-2.0

whi_mongodb_server

database server of MongoDB

Dependency

pip3 install rospkg
pip3 install pymongo

Install MongoDB on Jetson nano

  1. Go to the official download website. In the "MongoDB Community Server Download" section, select version "3.6.23", platform "Ubuntu 16.04 ARM 64", package "tgz": image

    NOTE: if your Ubuntu is later than 18.04, please select version 7.0.6. Meanwhile, replace the following contents that are related to the selected package

  2. Extract files with the following command:

    tar -zxvf mongodb-linux-aarch64-ubuntu1604-3.6.23.tgz
    
  3. Add the MongoDB's path to environment by editing bashrc:

    nano ~/.bashrc
    

    Add the following contents. Please do replace <path_of_extracted> with your extracted path:

    # mongodb
    export MONGODB_HOME=<path_of_extracted>/mongodb-linux-aarch64-ubuntu1604-3.6.23
    export PATH=$MONGODB_HOME/bin:$PATH
    

    Then, source the bash with command:

    source ~/.bashrc
    
  4. Create a path for recording db data. Please do replace with yours:

    mkdir -p /<yours>/mongodb/data
    mkdir /<yours>/mongodb/logs
    
  5. Create configure file for MongoDB

    nano /<yours>/mongodb/mongod.conf
    

    Write the following contents:

    storage:
      dbPath: /<yours>/mongodb/data
     journal:
       enabled: true
    
    systemLog:
      destination: file
      logAppend: true
      path: /<yours>/mongodb/logs/mongod.log
    
    net:
      port: 27017
      bindIp: 0.0.0.0
    

    ctrl-o to save, and ctrl-x to quit

  6. Launching the server and a client Open a terminal for the server:

    mongod --dbpath /<yours>/mongodb/data/ --logpath /<yours>/mongodb/logs/mongod.log –fork
    

    image

    Open another terminal for the client:

    mongo --host 127.0.0.1 --port 27017
    

    image