Production settings: For Mongo DB
1) sysctl -w vm.zone_reclaim_mode=0
##Then start mongod, mongos, configservers using numactl
##numactl --interleave=all <path> <options>
##The <path> is the path to the program you are starting and the <options> are any optional arguments to pass to the program.
2) Verify fsync is available
man fsync
3) Set vm.swappiness to 1 for kernel versions 3.5 or later. Or else 0 for lower kernel versions
sysctl -w vm.swappiness=1
cat /proc/sys/vm/swappiness
4) ulimits
vi /etc/security/limits.d/99-mongodb-nproc.conf
@mongod soft fsize unlimited
@mongod hard fsize unlimited
@mongod soft cpu unlimited
@mongod hard cpu unlimited
@mongod soft memlock unlimited
@mongod hard memlock unlimited
@mongod soft nofile 64000
@mongod hard nofile 64000
@mongod soft nproc 64000
@mongod hard nproc 64000
@mongod soft as unlimited
@mongod hard as unlimited
@mongod soft rss unlimited
@mongod hard rss unlimited
chown mongod:mongod /etc/security/limits.d/99-mongodb-nproc.conf
Reference:
5) Disable Transparent Huge Pages (THP)
Check for Red Hat/CentOS 7
Reboot required.
6) After config file is updated to desired directories
Configure SELinux
Important: use .*
Check semanage avialiblity: man semanage
If not, yum provides semanage
yum install policycoreutils-python
7) Set net.ipv4.tcp_keepalive_time=300 in sysctl.conf
then
sysctl -p
8) Read ahead setting to 0
need study...
##9) AWS EC2 performance considerations
need study...
10) cd /etc/yum.repos.d # vi /etc/yum.repos.d/mongodb-enterprise.repo
[mongodb-enterprise]
name=MongoDB Enterprise Repository
baseurl=https://repo.mongodb.com/yum/redhat/7/mongodb-enterprise/3.6/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.6.asc
Install with: # yum install -y mongodb-enterprise-3.6.2 mongodb-enterprise-server-3.6.2 mongodb-enterprise-shell-3.6.2 mongodb-enterprise-mongos-3.6.2 mongodb-enterprise-tools-3.6.2
Once installed, edit the repository from
enabled=1 to enabled=0
verify by yum repolist
***
Shard 1:
101.11.16.36 -- Primary
101.11.16.12 -- Replica 1
101.11.16.17 -- Replica 2
Shard 2:
102.11.16.75 -- Primary
102.18.16.10 -- Replica 1
102.18.17.5 -- Replica 2
11) Some more sysctl configurations:
fs.file-max=98000
kernel.pid_max=64000
kernel.threads-max=64000
vm.max_map_count=128000
***