代码拉取完成,页面将自动刷新
#! /bin/bash
# 需要设置的主机名,以空格间隔
hosts="e131 e132"
for host in $hosts;
do
echo $host;
# 关闭防火墙
ssh $host "systemctl stop firewalld & systemctl disable firewalld";
# 禁用swap
ssh $host "swapoff -a & sed -i 's/.*swap.*/#&/' /etc/fstab";
# 关闭selinux
ssh $host "setenforce 0 & sed -i \"s/^SELINUX=enforcing/SELINUX=disabled/g\" /etc/sysconfig/selinux & sed -i \"s/^SELINUX=enforcing/SELINUX=disabled/g\" /etc/selinux/config & sed -i \"s/^SELINUX=permissive/SELINUX=disabled/g\" /etc/sysconfig/selinux & sed -i \"s/^SELINUX=permissive/SELINUX=disabled/g\" /etc/selinux/config";
# 设置ip 转发
ssh $host "echo \"1\" > /proc/sys/net/ipv4/ip_forward & modprobe br_netfilter & cat <<EOF > /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF";
ssh $host "sysctl -p /etc/sysctl.d/k8s.conf & ls /proc/sys/net/bridge";
# 设置内核参数,文件打开数
ssh -T $host <<EOF
echo "* soft nofile 65536" >> /etc/security/limits.conf
echo "* hard nofile 65536" >> /etc/security/limits.conf
echo "* soft nproc 65536" >> /etc/security/limits.conf
echo "* hard nproc 65536" >> /etc/security/limits.conf
echo "* soft memlock unlimited" >> /etc/security/limits.conf
echo "* hard memlock unlimited" >> /etc/security/limits.conf
EOF
done
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。