Last active
March 26, 2016 05:58
-
-
Save neerajnagi/dedaf8e7d1f789cc20f2 to your computer and use it in GitHub Desktop.
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
###install | |
``` | |
yum install -y libcgroup | |
chkconfig cgconfig on | |
/etc/init.d/cgconfig start | |
cgcreate -g memory:/bigcouch | |
echo $(( 2500 * 1024 * 1024 )) > /cgroup/memory/bigcouch/memory.limit_in_bytes | |
``` | |
###sample upstart using cgconfig | |
``` | |
start on runlevel [23] | |
stop on shutdown | |
# Respawn in case of a crash, with default parameters | |
respawn | |
# set working directory | |
# required for erlang | |
env HOME="/usr/lib64/erlang/bin" | |
export HOME | |
env DIRECTORY=/opt/bigcouch/bin | |
env LOG_FILE=/var/log/bigcouch.log | |
script | |
# modify PATH to hit local couchdb's working directory first | |
cd $DIRECTORY | |
touch $LOG_FILE | |
# recommended approach in case of su/sudo usage so that service does not fork | |
exec /bin/bash -c "cgexec -g memory:bigcouch ./bigcouch >> $LOG_FILE 2>&1" | |
end script | |
post-start script | |
end script | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
results
bigcouch is restricted at 2.5g as shown in upstart script, and its killed nicely as shown below