Skip to content

Instantly share code, notes, and snippets.

@alexandrerocco
Created August 13, 2013 14:27
Show Gist options
  • Save alexandrerocco/6221632 to your computer and use it in GitHub Desktop.
Save alexandrerocco/6221632 to your computer and use it in GitHub Desktop.
Install a standalone MongoDb server with an attached volume
#!/bin/bash
sudo -s
yum -y update
yum -y install mdadm sysstat
cat <<EOF > /etc/yum.repos.d/10gen.repo2
[10gen]
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
gpgcheck=0
EOF
yum -y install mongo-10gen-server
mke2fs -t ext4 /dev/sdf
mkdir /ebsdata
echo "/dev/sdf /ebsdata ext4 noatime 0 0" >> /etc/fstab
mount /ebsdata
mkdir /ebsdata/data
mkdir /ebsdata/log
mkdir /ebsdata/journal
ln -s /journal /ebsdata/journal
chown -R mongod:mongod /ebsdata/data
chown -R mongod:mongod /ebsdata/log
chown -R mongod:mongod /ebsdata/journal
cat <<EOF > /etc/mongod.conf
logpath=/ebsdata/log/mongod.log
logappend=true
fork=true
dbpath=/ebsdata/data
rest=true
EOF
/etc/init.d/mongod start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment