用户
groupadd -g 1001 wls
useradd -u 1001 -g wls wls81
useradd -u 1001 -r -g wls -s /bin/false mongod
userdel wls81
Kernel limit
echo 'wls81 soft nofile 65535' >> /etc/security/limits.conf
echo 'wls81 hard nofile 65535' >> /etc/security/limits.conf
su wls81 -p -c 'ulimit -a'
echo 'wls81 soft nproc 40960' >> /etc/security/limits.conf
echo 'wls81 hard nproc 40960' >> /etc/security/limits.conf
sed -i '/vm\.max_map_count/d' /etc/sysctl.conf
echo 'vm.max_map_count=262144' >> /etc/sysctl.conf
sysctl -p
sysctl -a | grep vm.max_map_count
sed -i '/net\.ipv4\.tcp_retries2/d' /etc/sysctl.conf
echo 'net.ipv4.tcp_retries2=5' >> /etc/sysctl.conf
sysctl -p
cat /proc/sys/net/ipv4/tcp_retries2
禁用swap
sudo swapoff -a
vim /etc/fstab
防火墙
firewall-cmd --zone=public --add-port=5601/tcp --permanent
firewall-cmd --reload
firewall-cmd --zone=public --list-ports
firewall-cmd --zone=public --remove-port=80/tcp --permanent
systemctl start firewalld.service
systemctl stop firewalld.service
systemctl disable firewalld
systemctl restart firewalld.service
debian
dpkg -l | grep -q "^ii curl" || (echo "curl not installed, installing curl..." && apt-get update && apt-get install -y curl)