linux搭建集群前的优化

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux搭建集群前的优化相关的知识,希望对你有一定的参考价值。

1、关闭selinux
sed -i "s#SELINUX=enforcing#SELINUX=disabled#gp" /etc/sysconfig/selinux
grep "SELINUX=disabled" /etc/sysconfig/selinux
setenforce 0
getenforce
2、关闭iptables
/etc/init.d/iptables stop
chkconfig iptables off
3、精简开机自启动
chkconfig --list |grep -E "crond|network|sshd|sysstat|rsyslog"|awk ‘{print "chkconfig",$1,"off"}‘|bash
chkconfig --list |grep 3:on
4、提权oldboy
useradd oldboy
cp /etc/sudoers{,.ori}
echo "oldboy ALL=(ALL) NOPASSWD: ALL" >>/etc/sudoers
tail -1 /etc/sudoers
visudo -c
5、设置中文字符集
cp /etc/sysconfig/i18n{,.ori}
echo ‘LANG="zh_CN.UTF-8"‘ >/etc/sysconfig/i18n
source /etc/sysconfig/i18n
6、时间同步
echo ‘#time sync by liuzhonghe at 2018-1-15‘ >>/var/spool/cron/root
echo ‘/5 /usr/sbin/ntpdate ntp1.aliyun.com >/dev/null 2>&1‘ >>/var/spool/cron/root
crontab -l
7、命令行安全
echo ‘export TMOUT=300‘ >>/etc/profile
echo ‘export HISTSIZE=5‘ >>/etc/profile
echo ‘export HISTFILESIZE=5‘ >>/etc/profile
tail -3 /etc/profile
source /etc/profile
8、加大文件描述(配置完成后只有重新登录才有效)
echo ‘
- nofile 65535‘ >>/etc/security/limits.conf
tail -1 /etc/security/limits.conf
9、内核优化
cat >>/etc/sysctl.conf<<EOF
net.ipv4.tcp_fin_timeout = 2
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_sysncookies = 1
net.ipv4.tcp_keepalive_time = 600
net.ipv4.ip_local_port_range = 4000 65000
net.ipv4.tcp_max_syn_backlog = 16384
net.ipv4.tcp_max_tw_buckets = 36000
net.ipv4.route.gc_timeout = 100
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_synack_retries = 1
net.core.somaxcorn = 16384
net.core.netdev_max_backlog = 16384
net.ipv4.tcp_max_orphans = 16384
#以下参数是对iptables防火墙的优化,防火墙不开会提示,可以忽略不理
net.nf_conntrack_max = 25000000
net.netfilter.nf_conntrack_max = 25000000
net.netfilter.nf_conntrack_tcp_timeout_established = 180
net.netfilter.nf_conntrack_tcp_timeout_time_wait = 120
net.netfilter.nf_conntrack_tcp_timeout_close_wait = 60
net.netfilter.nf_conntrack_tcp_timeout_fin_wait = 120
EOF

未完待续!!!

以上是关于linux搭建集群前的优化的主要内容,如果未能解决你的问题,请参考以下文章

hadoop集群搭建前的准备

05-1cdh搭建之前期优化

源代码搭建应用——动手搭建自己的计算集群系统

hadoop分布式集群搭建

Weblogic 12c 集群环境搭建

zookeeper集群搭建及优化