Wednesday, August 30, 2017

How to build MongoRocks for MongoDB 3.4

With advice from Igor I compiled MongoRocks from source for MongoDB 3.4. I previously shared how to do this for MongoDB 3.2. I did this to use a new version of RocksDB, 5.7.3 in this case, as the team continues to make RocksDB better. The instructions below are for Ubuntu 16.04. There are slightly different instructions here.

# Install many of the dependencies for MongoRocks
sudo yum install snappy-devel zlib-devel bzip2-devel lz4-devel
sudo yum install scons gcc-g++ git

# Unpack MongoDB 3.4.7 source in $MONGOSRC

# Directory in which git repos are created
mkdir ~/git

# Get MongoRocks engine for MongoDB 3.4.7
cd ~/git
git clone
cd mongo-rocks
git checkout tags/r3.4.7 -b r347

# get and build RocksDB libraries for version 5.7.3
cd ~/git
git clone
cd rocksdb
git checkout tags/v5.7.3 -b v573
DISABLE_JEMALLOC=1 USE_RTTI=1 CFLAGS=-fPIC make static_lib -j 4

# prepare source build with support for RocksDB
mkdir -p src/mongo/db/modules/
ln -sf ~/git/mongo-rocks src/mongo/db/modules/rocks

# build mongod & mongo binaries
# if you need to debug and see command lines then add --debug=presub
scons CPPPATH=/home/mdcallag/git/rocksdb/include \
      LIBPATH=/home/mdcallag/git/rocksdb \
      LIBS="lz4 zstd" mongod mongo

# install mongod
mkdir -p ~/b/m347
cd ~/b/m347
mkdir data
mkdir bin
cp $MONGOSRC/build/opt/mongo/mongod bin
cp $MONGOSRC/build/opt/mongo/mongo bin

# create mongo.conf file with the text that follows. You must
# change $HOME and consider changing the value for cacheSizeGB
  fork: true
  destination: file
  path: $HOME/b/m347/log
  logAppend: true
  syncPeriodSecs: 600
  dbPath: $HOME/b/m347/data
    enabled: true
operationProfiling.slowOpThresholdMs: 2000
replication.oplogSizeMB: 4000
storage.rocksdb.cacheSizeGB: 4

# start mongod, consider using numactl --interleave=all
bin/mongod --config mongo.conf --master --storageEngine rocksdb

# confirm RocksDB is there
$ head -1 data/db/LOG

No comments:

Post a Comment