Barryrowe / mongo-arm

This is a distribution of the MongoDB binaries built for the ARM architecture. Specifically these were built to run MongoDB on a Raspberry Pi.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NOTE August 24th, 2016: I was informed today that the JIRA ticket listed below in the last note has been resolved, and that official 64-bit ARM support will be coming in v3.4. It looks like you can find current binaries in the comments of the JIRA ticket here It does appear that only a 64-bit version is available (and my only ever be available) so take this into account if you're targeting a platform that is only 32-bit.

NOTE January 7th, 2015: I have not been actively working on this project, and realize the binaries are quite old (v2.1.1). I started this as a proof of concept, and have stopped work on the project it supported. The MongoDB team is working on ARM support, but it relies on several large core-unit refactors or re-writes. You can view the status on their JIRA ticket here: MongoDB Support for ARM JIRA Ticket

MongoDB for ARM

This is a distribution of the MongoDB binaries built for the ARM architecture. Specifically these were built to run MongoDB on a Raspberry Pi. This was tested and built using a Model B Pi running Raspbian Wheezy 3.6.11+ Available for Download Here

I can only take credit for compiling these instructions in one place, and providing a compiled set of binaries. These binaries and instructions are based on information from the following links:

Compiling MongoDB

Building MongoDB on the Raspberry Pi - mongopi

Setting Up MongoDB as A Service

Issues

  • The mongo shell causes Segmentation Fault errors when running "show dbs;" and sometimes when querying collections. NOTE: the pymongo driver is tested and works well against this installation process. It appears only the shell has this issue.

Installation Steps:

  1. Download binaries

    #Clone this repository
    git clone https://github.com/Barryrowe/mongo-arm.git
  2. Create the mongo user

    sudo useradd mongo
    sudo passwd mongo
  3. Copy the mongo binaries to the desired install location

    #example:
    cp -R binaries/2.1.1 /opt/mongo
  4. Change the ownership of the installed mongo binaries so they are owned by the mongo user

    chown -R mongo:mongo /path/to/installed/binaries
  5. Creat the /data/db directory for MongoDB's data storage

    sudo mkdir /data
    sudo mkdir /data/db
  6. Change the ownership of the /data/db directory so it is owned by the mongo user

    sudo chown mongo:mongo /data/db

Set As Service Steps (Debian)

  1. Copy config/mongodb to the init.d location

    sudo cp config/mongodb /etc/init.d/mongodb
  2. Update /etc/init.d/mongodb to point to your install path from step 3

    A. Line 50 will need to be modified to point to the mongos executable from your install path in step 3.

    B. If you created a user with name other than "mongo" in step 2 you will need to update Line 95 with the user you configured.

  3. Update the permissions for the mongodb init.d file so it can be executed

    sudo chmod 755 /etc/init.d/mongodb
  4. Copy the config/mongod.conf file to /etc/mongod.conf

    sudo cp config/mongod.conf /etc/mongod.conf
  5. Register the mongodb service

    sudo update-rc.d mongodb defaults
  6. Startup the service

    sudo service mongodb start

Managing MongoDB After Install and Setting as Service

Once installed and configured, you can use these commands to manage the mongodb service you've setup.

#start the service
sudo service mongodb start

#check the service status
service mongodb status

#stop the service
sudo service mongodb stop

If your mongodb service won't start you might just get output like this:

....] Starting database: mongod/etc/init.d/mongodb: 131: ulimit: Illegal option -u
numactl: 
daemuser: mongo
pidfile: /var/run/mongod.pid
daem: /opt/mongo/bin/mongod
daemopts: -- --config /etc/mongod.conf
. failed

NOTE: In this case, make sure to check the /data/db/ directory for a file mongod.lock. If mongodb isn't stopped cleanly, the mongod process can leave this lock file in place preventing the service from properly starting. Usually you can just remove the file and mongodb will start normally

#remove mongod.lock file after unclean shutdown
sudo rm /data/db/mongod.lock

About

This is a distribution of the MongoDB binaries built for the ARM architecture. Specifically these were built to run MongoDB on a Raspberry Pi.

License:MIT License


Languages

Language:C++ 98.0%Language:C 1.2%Language:Shell 0.7%Language:Objective-C 0.1%