I use MongoDB as my database of choice as you can tell by my blog entries. Under current Raspberry Pi OSs, MongoDB is limited by 32 bit binaries. Databases are restricted to 2GB.
The Raspberry Pi 3 sports an ARMv7 processor that supports 64 bits. At this time (May 2016) there is no official OS support for 64 bits. Raspbian and Arch Linux are only available with 32 bit support. I expect that we WILL see 64 bit support sometime in the future 😉
While waiting, I looked around and found MongoDB 3.2.6 3.2.10 in the Arch Linux ARM aarch64 package repository. I also found out that the ODROID C2 single board computer supports aarch64. This SBC costs $40 and has better specs (for my DB purposes) than the R-Pi 3. It has a 4-core ARMv8 processor running at 2GHz, 2GB of RAM and gigabit ethernet. It also supports WAY fast eMMC Flash storage in addition to Micro SD. Android and Ubuntu are the officially supported OSs but Arch Linux ARM (64 bit) can be installed as well.
[UPDATE: 23 Mar 2017] If you prefer to use the default Ubuntu Linux for ODROID C2 as opposed to Arch, you can now install official MongoDB 3.4. See this blog post.
I purchased an ODROID C2 to see if I could get 64 bit MongoDB running. Shipping from South Korea was surprisingly quick and I was soon loading Arch Linux and installing MongoDB 3.2.6 3.2.9 and associated tools. I am very happy with the result! I have an external USB drive that holds my DBs. The drive is one I purchased for R-Pi, the Western Digital PiDrive. I am now able to have large databases on inexpensive hardware. It’s not the fastest but suits my limited needs. I am contemplating building have built a small dedicated cluster of ODROID C2 SBCs for MongoDB replication and failover.
Don’t let the Raspberry Pi cut-out fool you 😉 These are 4 ODROID C2 SBCs. They have the same mounting holes as R-Pi. Picked up the inexpensive stack mount on Amazon. Made the drive stack mount from 2 pieces of acrylic from Tap Plastics and some left-over plastic screw-posts.
[root@odroid64 andy]# lscpu
Architecture: aarch64
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 4
CPU max MHz: 2016.0000
CPU min MHz: 100.0000
NOTE: MongoDB version for aarch64 was updated to v3.2.9-2 in August 2016
[root@odroid64 andy]$ mongod -version
db version v3.2.9
git version: 22ec9e93b40c85fc7cae7d56e7d6a02fd811088c
OpenSSL version: OpenSSL 1.0.2h 3 May 2016
allocator: system
modules: none
build environment:
distarch: arm64
target_arch: arm64
[root@odroid64 andy]$ mongo
MongoDB shell version: 3.2.9
connecting to: test
> use bldata
switched to db bldata
> db.stats()
{
"db" : "bldata",
"collections" : 3,
"objects" : 4076828,
"avgObjSize" : 1411.9657812397286,
"dataSize" : 5756341632,
"storageSize" : 7159521280,
"numExtents" : 26,
"indexes" : 1,
"indexSize" : 132279504,
"fileSize" : 10666115072,
"nsSizeMB" : 16,
"extentFreeList" : {
"num" : 0,
"totalSize" : 0
},
"dataFileVersion" : {
"major" : 4,
"minor" : 22
},
"ok" : 1
}
Thanks for the post, sir! Yesterday I tried to install MongoDB x64 on a new Raspberry Pi3, on which I installed Ubuntu Mate 15.10 64 bits, without success. After reading this post and the specifications of ODROID-C2, I decided to not invest more time trying to make that work, ordered instead an ODROID. Cannot wait to install ArchLinux and use it.
Here I am once again, two months later. The two pictures you added are great! As of myself, I did publish a website on ArchLinux, using MongoDB for database. The only problem I encountered was related (maybe) to usb autosuspend and external ssd. My external SSDs failed after some time with an error “reading directory ‘.’: Input/output error”. I hope disabling usb autosuspend, which I did yesterday, resolved the problem. In my case, a single ODROID-C2 is running Nginx, MongoDB, hosting a Python Flask application which is using uWSGI and Gevent. It works like a charm. Thanks again for this great post.
Here is the link to download https://www.archlinux.org/packages/community/x86_64/mongodb/ then click on download from the mirror on the top right hand corner. It should download a 30.9MB mongodb-3.2.9-1-x86_64.pkg.tar.xz file
decompress the mongodb-3.2.9-1-x86_64.pkg.tar.xz to mongodb3-2-9-1
From the same above link click on show file content for mongodb it should look something like thisetc/mongodb.conf
usr/bin/mongo
usr/bin/mongod
usr/bin/mongoperf
usr/bin/mongos
usr/bin/mongosniff
usr/lib/systemd/
usr/lib/systemd/system/
usr/lib/systemd/system/mongodb.service
var/lib/mongodb/
var/log/mongodb/
So copy all the file from the decompressed mongodb3-2-9-1 using the cp command ( Must have root access to write to system files)
Then run mongo –help..
:/usr/bin$ ls mongo
mongo
:/usr/bin$ ls -l mongo
-rwxr-xr-x 1 root root 12023072 Sep 10 15:50 mongo
debian@pine64:/usr/bin$ mongo –help
mongo: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
So do I need to first install all the dependencies ???
Hi! I think you are doing way more than necessary to install MongoDB under Arch Linix ARM 😉 try:
sudo pacman -Sy
sudo pacman -S mongodb
You should see the version (currently mongodb-3.2.9-1) and all the dependencies that will be loaded with the mongodb package. You can abort the install by entering “n” to the install question — or answer “y” and do the install… This will setup other config files for you as well.
– Andy
hi Andy, are you sure of installing mongodb by pacman? I tried but cannot find mongodb. I’m sure I updated all repos. Could you please check if you also added some other sources?
Will check my instructions — as it’s been a while since I did this 😉
Hello Andy
When I ran scons it took a long time to finish perhaps because of the display screen saver the process stop.. Finally when it did complete I tired the command
debian@pine64:/var/log/mongodb$ sudo service mongodb start
debian@pine64:/var/log/mongodb$ sudo pacman -Sy mongodb
sudo: pacman: command not found
debian@pine64:/var/log/mongodb$ lscpu
Architecture: aarch64
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 4
CPU max MHz: 1344.0000
CPU min MHz: 480.0000
debian@pine64:/var/log/mongodb$ mongod -version
mongod: error while loading shared libraries: libsasl2.so.3: cannot open shared object file: No such file or directory
Do I need to install anymore dependencies ?
I check my synaptic package manager and it does has libsasl2 installed http://imgur.com/a/jXjbM
I installed pacman,, thanks Andy..
Pingback: Official MongoDB 3.4 on ODROID-C2 under Ubuntu
I’m running Debian Jessie release on my Odroid-C2. Topic of mongodb came up. Search the net and found a testing branch for arm64 processor architecture on debian web site:
https://packages.debian.org/stretch/arm64/apt/download
Enable the repository and successfully installed monogdb with all prereqs.
Hello there!
thanks for all the guides they are helping a lot!
I have a very important question:
is there a MongoDB 3.2 or higher for Rasp Pi 3 ?
thanks!
Hi Patrick,
Check out my latest post on running 64-bit MongoDB 3.2 on a Raspberry Pi 3. I do not know of a version that runs under 32-bit Raspbian.
— Andy