Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

NDN Serves Files From MongoDB


NDN-MONGO-FILESERVER tool-bundle is part of iViSA project, containing the following tools:

  1. ndn-mongo-fileserver
  2. chunker
  3. stats-collector


Take the following steps to install this tool-bundle.


Install the latest versions of the following packages (to checkout to a specific release use $ git checkout <release-name>):

  • ndn-cxx

  • NFD

  • MongoDB

  • Mongo Driver

    $ sudo apt-get install libmongoc-1.0-0
    $ sudo apt-get install libbson-1.0
    $ sudo apt-get install cmake libssl-dev libsasl2-dev
    $ git clone
    $ cd mongo-c-driver && git checkout 1.15.1
    $ python build/ > VERSION_CURRENT
    $ mkdir cmake-build
    $ cd cmake-build
    $ make
    $ sudo make install
    $ cd ~ && git clone
    $ cd mongo-cxx-driver && git checkout r3.4.0
    $ cd build
    $ make
    $ sudo make install

Install the following tools for video encoding and packaging:

Build Steps

To configure, compile, and install this tool-bundle, type the following commands in repository's root directory:

  $ ./waf configure
  $ ./waf
  $ sudo ./waf install

Quick test

Here is a quick test to make sure that the tool-bundle is installed properly:

  1. Run MongoDB service:

    $ sudo systemctl start mongod.service
  2. Chunk a content and populate the DB. The following command breaks the input file into 1kB chunks with version 1. Name of each chunk follows this pattern: /ndn/test/<segment-number>)

    $ chunker /ndn/test -i ~/ndn-mongo-fileserver/ -s 1000 -e 1
  3. Run NFD and then run fileserver to serve the available contents in the DB. The following command runs the fileserver, and asks it to answer all Interests whose name start with /ndn/test):

     $ ndn-mongo-fileserver /ndn/test
  4. Open segment-fetcher.html in browser and ask for /ndn/test/

If no error occurred during any step you can safely quit the fileserver and be sure that the tool-bundle works properly.


To learn how to watch the published videos in a modern browser visit ndn-video-frontend.

Serve videos via NDN testbed

After setting up the NDN fileserver you might want to serve your videos via NDN testbed. To do this, take the following steps:

  1. Get a valid certificate from the NDN testbed and set it up on your server. Given your certificate name is /ndn/my/cert.

  2. Encode, package, and chunk your video(s). To do this, first update base in file to your cert (e.g., /ndn/my/cert/video), and then run the following command:

    $ (cd ~/ndn-mongo-fileserver/scripts/video && bash <absolute-address-of-your-video>)

    This command populates the MongoDB with video chunks and at the end generate an HTML page for the video that will be used in step 4.

  3. Connect the NFD on your server to one of the testbed hubs (you might want to choose the closest hub to your server). To do this you can run the following command:

     $ bash ~/ndn-mongo-fileserver/scripts/main/ /ndn/my/cert udp with-stats

    This command connects the the NFD instance on your server to hub via UDP tunnel and collects the statistical information of the video streaming service whenever anyone watches your videos. You can find the stats under ~/.chunks-log directory.

  4. Set up a webserver and use ndn-video-frontend as your website resources with the following modifications:

    • Update BASEPREFIX in app.js to your cert name (e.g., /ndn/my/cert).

    • Then simply copy the generated HTML file (from step 2) under your webserver directory (e.g., /var/www/html/my-website) and add a link to this HTML file in index.html (look at ndn-video-frontend to see a template).

Reporting Bugs

To report any bugs or features use the project's issue tracker.


ndn-mongo-fileserver is an open source project licensed under the GPL version 3. See for more information.


You can cite this project in your publications if it helps your research. Here is an example BibTeX entry:

  title={NDN Serves Files From MongoDB},
  author={Ghasemi, Chavoosh and others},