Skip to content

Instantly share code, notes, and snippets.

@thiagomgo
Last active April 15, 2022 06:51
Show Gist options
  • Save thiagomgo/cd74e23f9eb66550d700de3ee8d06003 to your computer and use it in GitHub Desktop.
Save thiagomgo/cd74e23f9eb66550d700de3ee8d06003 to your computer and use it in GitHub Desktop.
MongoDB recommendations for CentOS 7 on AWS
vim /etc/udev/rules.d/85-ebs.rules
ACTION=="add|change", KERNEL=="xvdh", ATTR{queue/scheduler}="deadline"
ACTION=="add|change", KERNEL=="xvdi", ATTR{queue/scheduler}="deadline"
ACTION=="add|change", KERNEL=="xvdj", ATTR{queue/scheduler}="deadline"
vim /usr/lib/tuned/throughput-performance/tuned.conf
Change value "readahead" to 128
yum install -y numactl
chmod u+x /etc/rc.d/rc.local
systemctl start rc-local
systemctl enable rc-local
systemctl disable chronyd
systemctl start ntpd
systemctl enable ntpd
vim /etc/rc.local
# Mongo Recommendations
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo 0 > /sys/kernel/mm/transparent_hugepage/khugepaged/defrag
vim /etc/sysctl.conf
# Mongo Recommendations
net.core.somaxconn=4096
net.ipv4.tcp_fin_timeout=30
net.ipv4.tcp_keepalive_intvl=30
net.ipv4.tcp_keepalive_time=120
net.ipv4.tcp_max_syn_backlog=4096
vm.zone_reclaim_mode=0
net.ipv4.tcp_tw_reuse=1
net.ipv4.ip_local_port_range=10000 61000
vim /etc/security/limits.d/mongod.conf
mongod soft nproc 64000
mongod hard nproc 64000
mongod soft nofile 64000
mongod hard nofile 64000
..Restart
/log/*.log {
daily
rotate 7
compress
dateext
missingok
notifempty
sharedscripts
copytruncate
create 640 mongod mongod
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment