Skip to content

Instantly share code, notes, and snippets.

@tomfanning
Last active December 11, 2016 20:24
Show Gist options
  • Save tomfanning/64254beb13d457666231e913b91d86cd to your computer and use it in GitHub Desktop.
Save tomfanning/64254beb13d457666231e913b91d86cd to your computer and use it in GitHub Desktop.
Fix mongodb startup warnings on RHEL
# run once
sed -i -e '/^readahead=/s/^.*$/readahead=32/' /usr/lib/tuned/throughput-performance/tuned.conf
echo "mongod soft nproc 64000" > /etc/security/limits.d/90-nproc.conf
echo '#!/bin/sh -e
echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo never > /sys/kernel/mm/transparent_hugepage/enabled' > /usr/local/sbin/mongodb-prep.sh
chmod +x /usr/local/sbin/mongodb-prep.sh
echo '[Unit]
Description=mongodb prep
Before=mongod.service
[Service]
Type=simple
ExecStart=/usr/local/sbin/mongodb-prep.sh
TimeoutStartSec=0
[Install]
WantedBy=default.target' > /etc/systemd/system/mongodb-prep.service
systemctl enable mongodb-prep.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment