Inspired by this article
In this tutorial, my IP machine is 192.168.1.65
; please replace it by your own IP machine.
sudo -s
apt-get install git
apt-get install mongodb-server
nano /etc/mongodb.conf # replace 127.0.0.1 by the machine IP
mkdir /mongo
mkdir /mongo/metadata
mkdir /mongo/query
mkdir /mongo/shard01
mkdir /mongo/shard02
mkdir /mongo/shard03
mkdir /mongo/shard04
export LC_ALL=C
service mongodb stop
nohup mongod --configsvr --dbpath /mongo/metadata --port 27019 >> /mongo/metadata.log &
tail -30 /mongo/metadata.log
nohup mongos --configdb 192.168.1.65:27019 >> /mongo/query.log &
tail -30 /mongo/query.log
nohup mongod --dbpath /mongo/shard01 --port 21117 >> /mongo/shard01.log &
nohup mongod --dbpath /mongo/shard02 --port 21217 >> /mongo/shard02.log &
nohup mongod --dbpath /mongo/shard03 --port 21317 >> /mongo/shard03.log &
nohup mongod --dbpath /mongo/shard04 --port 21417 >> /mongo/shard04.log &
tail -30 /mongo/shard01.log