Redis:
echo "1" > /proc/sys/vm/overcommit_memory echo never > /sys/kernel/mm/transparent_hugepage/enabled echo never > /sys/kernel/mm/transparent_hugepage/defrag centos_kernel=`uname -r | awk -F "." ‘{print $1$2}‘` if [ $centos_kernel == 26 ];then echo "kernel_veriosn:" $centos_kernel sysctl -w vm.swappiness=0 cat /etc/sysctl.conf | grep ‘vm.swappiness=‘ if [ $? == "0" ];then sed -i ‘s/^vm.swappiness.*//g‘ /etc/sysctl.conf echo ‘vm.swappiness=0‘ >> /etc/sysctl.conf sed -i ‘/^$/d‘ /etc/sysctl.conf else echo ‘vm.swappiness=0‘ >> /etc/sysctl.conf fi elif [ $centos_kernel == 310 ];then echo "kernel_veriosn:" $centos_kernel sysctl -w vm.swappiness=1 cat /etc/sysctl.conf | grep vm.swappiness= if [ $? == "0" ];then sed -i ‘s/^vm.swappiness.*//g‘ /etc/sysctl.conf echo ‘vm.swappiness=1‘ >> /etc/sysctl.conf sed -i ‘/^$/d‘ /etc/sysctl.conf else echo ‘vm.swappiness=1‘ >> /etc/sysctl.conf fi else echo "kernel_veriosn:" $centos_kernel exit 1 fi over_memory=`cat /proc/sys/vm/overcommit_memory` echo "overcommit_memory:" $over_memory defrag=`cat /sys/kernel/mm/transparent_hugepage/defrag` echo "defrag:" $defrag cat /etc/sysctl.conf | grep ‘vm.swappiness=‘
ES:
cat /etc/sysctl.conf | grep "vm.max_map_count" if [ $? -ne 0 ];then sudo sed -i ‘s/^vm.max_map_count.*//g‘ /etc/sysctl.conf sudo echo "vm.max_map_count=262144" >> /etc/sysctl.conf sudo sed -i ‘/^$/d‘ /etc/sysctl.conf fi cat /etc/sysctl.conf | grep "vm.swappiness" if [ $? -ne 0 ];then sudo sed -i ‘s/^vm.swappiness.*//g‘ /etc/sysctl.conf suso echo ‘vm.swappiness=0‘ >> /etc/sysctl.conf sudo sed -i ‘/^$/d‘ /etc/sysctl.conf fi sudo echo "* soft nproc 524288" >> /etc/security/limits.d/90-nproc.conf sudo swapoff -a sudo sh -c "echo ‘swapoff -a‘ >>/etc/rc.local" sudo sysctl -p
Kafka:
原文地址:https://www.cnblogs.com/lwhctv/p/11684547.html
时间: 2024-10-22 22:40:19