Skip to content

Instantly share code, notes, and snippets.

@andrewelkins
Last active July 6, 2016 23:12
Show Gist options
  • Save andrewelkins/e8c552d330860f564ac1803301b3b38b to your computer and use it in GitHub Desktop.
Save andrewelkins/e8c552d330860f564ac1803301b3b38b to your computer and use it in GitHub Desktop.
Cassandra recommended limits per academy course configuring-kernel
#!/bin/bash
echo '* soft as unlimited' | sudo tee --append /etc/security/limits.conf
echo '* hard as unlimited' | sudo tee --append /etc/security/limits.conf
echo '* soft cpu unlimited' | sudo tee --append /etc/security/limits.conf
echo '* hard cpu unlimited' | sudo tee --append /etc/security/limits.conf
echo '* soft data unlimited' | sudo tee --append /etc/security/limits.conf
echo '* hard data unlimited' | sudo tee --append /etc/security/limits.conf
echo '* soft fsize unlimited' | sudo tee --append /etc/security/limits.conf
echo '* hard fsize unlimited' | sudo tee --append /etc/security/limits.conf
echo '* soft locks unlimited' | sudo tee --append /etc/security/limits.conf
echo '* hard locks unlimited' | sudo tee --append /etc/security/limits.conf
echo '* soft memlock unlimited' | sudo tee --append /etc/security/limits.conf
echo '* hard memlock unlimited' | sudo tee --append /etc/security/limits.conf
echo '* soft msgqueue unlimited' | sudo tee --append /etc/security/limits.conf
echo '* hard msgqueue unlimited' | sudo tee --append /etc/security/limits.conf
echo '* hard nofile 1048576' | sudo tee --append /etc/security/limits.conf
echo '* soft nofile 1048576' | sudo tee --append /etc/security/limits.conf
echo '* soft nproc unlimited' | sudo tee --append /etc/security/limits.conf
echo '* hard nproc unlimited' | sudo tee --append /etc/security/limits.conf
echo '* soft rss unlimited' | sudo tee --append /etc/security/limits.conf
echo '* hard rss unlimited' | sudo tee --append /etc/security/limits.conf
echo '* soft sigpending unlimited' | sudo tee --append /etc/security/limits.conf
echo '* hard sigpending unlimited' | sudo tee --append /etc/security/limits.conf
echo '* soft stack unlimited' | sudo tee --append /etc/security/limits.conf
echo '* hard stack unlimited' | sudo tee --append /etc/security/limits.conf
echo 'fs.file-max = 1048576' | sudo tee --append /etc/sysctl.conf
echo 'kernel.sysrq = 1' | sudo tee --append /etc/sysctl.conf
echo 'kernel.panic = 300' | sudo tee --append /etc/sysctl.conf
echo 'kernel.pid_max = 999999' | sudo tee --append /etc/sysctl.conf
echo 'net.ipv4.ip_forward=0' | sudo tee --append /etc/sysctl.conf
echo 'net.ipv4.tcp_rmem = 4096 65536 16777216' | sudo tee --append /etc/sysctl.conf
echo 'net.ipv4.tcp_tw_reuse = 1' | sudo tee --append /etc/sysctl.conf
echo 'net.ipv4.tcp_wmem = 4096 65536 16777216' | sudo tee --append /etc/sysctl.conf
echo 'net.ipv6.conf.all.forwarding=0' | sudo tee --append /etc/sysctl.conf
echo 'net.core.rmem_max = 16777216' | sudo tee --append /etc/sysctl.conf
echo 'net.core.wmem_max = 16777216' | sudo tee --append /etc/sysctl.conf
echo 'vm.max_map_count = 1048576' | sudo tee --append /etc/sysctl.conf
echo 'vm.overcommit_memory = 1' | sudo tee --append /etc/sysctl.conf
echo 'vm.zone_reclaim_mode = 0' | sudo tee --append /etc/sysctl.conf
sysctl -p
# /etc/security/limits.conf
* soft as unlimited
* hard as unlimited
* soft cpu unlimited
* hard cpu unlimited
* soft data unlimited
* hard data unlimited
* soft fsize unlimited
* hard fsize unlimited
* soft locks unlimited
* hard locks unlimited
* soft memlock unlimited
* hard memlock unlimited
* soft msgqueue unlimited
* hard msgqueue unlimited
* hard nofile 1048576
* soft nofile 1048576
* soft nproc unlimited
* hard nproc unlimited
* soft rss unlimited
* hard rss unlimited
* soft sigpending unlimited
* hard sigpending unlimited
* soft stack unlimited
* hard stack unlimited
# /etc/sysctl.conf
net.ipv4.ip_forward=0
net.ipv6.conf.all.forwarding=0
kernel.sysrq = 1
kernel.panic = 300
fs.file-max = 1048576
kernel.pid_max = 999999
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 65536 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
vm.max_map_count = 1048576
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment