Last active
August 29, 2015 14:02
-
-
Save SwathiMystery/284a4bb404b0e4be1e30 to your computer and use it in GitHub Desktop.
Mongodb EC2 I2 instance (pv, lv, vg)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# init_mongo.sh script | |
...................... | |
sudo yum update | |
df -h | |
cat /proc/partitions | |
sudo fdisk -l | |
sudo su | |
yum install lvm2 | |
fdisk -l | |
umount /mnt | |
pvcreate /dev/xvdb /dev/xvdc | |
vgcreate vg /dev/xvdb /dev/xvdc | |
lvcreate -L1300G -n lv_data vg | |
lvdisplay | |
vgdisplay | |
mkfs -t ext4 /dev/vg/lv_data | |
mkdir -p /data | |
mount /dev/vg/lv_data /data/ | |
df -h | |
lvcreate -L60G -n lv_journal vg | |
lvcreate -L40G -n lv_log vg | |
mkfs -t ext4 /dev/vg/lv_journal | |
mkfs -t ext4 /dev/vg/lv_log | |
mkdir -p /journal | |
mkdir -p /log | |
mount /dev/vg/lv_journal /journal/ | |
mount /dev/vg/lv_log /log/ | |
df -h | |
echo "[MongoDB] | |
name=MongoDB Repository | |
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64 | |
gpgcheck=0 | |
enabled=1" | sudo tee -a /etc/yum.repos.d/mongodb.repo | |
exit | |
sudo yum install -y mongo-10gen mongo-10gen-server | |
df -h | |
sudo chown mongod:mongod /data /journal /log | |
echo '/dev/mapper/vg-lv_data /data ext4 defaults,auto,noatime,noexec 0 0 | |
/dev/mapper/vg-lv_journal /journal ext4 defaults,auto,noatime,noexec 0 0 | |
/dev/mapper/vg-lv_log /log ext4 defaults,auto,noatime,noexec 0 0' | sudo tee -a /etc/fstab | |
....................................................... | |
/etc/mongod.conf | |
dbpath = /data | |
logpath = /log/mongod.log | |
# Disable the HTTP interface (Defaults to localhost:27018). | |
nohttpinterface=false | |
# Turns off server-side scripting. This will result in greatly limited | |
# functionality | |
noscripting=false | |
rest=false | |
port=27017 | |
#bind_ip=127.0.0.1 | |
$ sudo nano /etc/security/limits.conf | |
* soft nofile 64000 | |
* hard nofile 64000 | |
* soft nproc 32000 | |
* hard nproc 32000 | |
$ sudo nano /etc/security/limits.d/90-nproc.conf | |
* soft nproc 32000 | |
* hard nproc 32000 | |
sudo blockdev --setra 32 /dev/mapper/vg-lv_data | |
$ echo 'ACTION=="add", KERNEL=="mapper/vg-lv_data", ATTR{bdi/read_ahead_kb}="16"' | sudo tee -a /etc/udev/rules.d/85-ebs.rules | |
ACTION=="add", KERNEL=="mapper/vg-lv_data", ATTR{bdi/read_ahead_kb}="16" | |
sudo chown -R mongod:mongod /data | |
sudo chown -R mongod:mongod /journal | |
sudo chown -R mongod:mongod /log | |
sudo yum install -y sysstat | |
sudo service mongod start | |
sudo ln -s /journal /data/journal |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment