大数据操作系统相关优化

2019-02-21  本文已影响0人  clive0x

1.分布式系统基石是paxos或者Raft协议,leader Election 过程有定时器在跑,对集群时间要求比较高,否则有可能脑裂,ntpd(centos6)/chronyd(centos7)首先得配置一台内网master,用于与外网同步时钟,集群其它机器得跟ntpd master同步。

2.虚拟内存上限,centos默认内存使用60%就使用虚拟内存

vm.swappiness= 1(注,cloudera 从kernel 3.5 rc1开始报 vm.swappiness = 0存在经常OOM bug)

3.上调文件句柄数:默认1024

fs.file-max=6544018

4.文件系统优化

centos 6默认ext4、 centos7默认xfs,mount option加 noatime,防止数据读取完向inode写atime记录。注:noatime包括noadirtime。

5.网络优化

优化net.core.somaxconn值,从128改到4096,增加tcp连接queue大小

开启巨型帧:/etc/sysconfig/network-scripts/ifcfg-eth0  MTU从1500改到9000,HDFS这么改没问题,HDFS通常block大小从64M起步,Kafka这样也OK,流计算需要考虑。

开启巨型帧风险:MTU 1500 与MTU 9000集群交互时,有可能触发MTU不匹配风险。

同时,需要保证得到交互机的支持,跟bonding 802.3聚合模式一样需要交换机支持。

##Change keepalive parameter ,default value is wait 2 hour(7200),send 9 probes per 75 seconds

net.ipv4.tcp_keepalive_time = 600

net.ipv4.tcp_keepalive_probes = 5

net.ipv4.tcp_keepalive_intvl = 15

##Increase max syn package from 1024 to 4096 ,WorkAround for :Possible SYN flooding on port 9000, Sending cookies

net.ipv4.tcp_max_syn_backlog=4096

##Change tcp Read/Write buffer(min default max),changed by niexm 2018/8/20

##Defaults Read 4096 87380 4194304 Write 4096 16384 4194304

net.ipv4.tcp_rmem = 32768 436600 4194304

net.ipv4.tcp_wmem = 32768 436600 4194304

##Decrease fin time out(default is 60)

net.ipv4.tcp_fin_timeout = 30

##Bind non-local address

net.ipv4.ip_nonlocal_bind = 1

##Tunning for time wait bucket table overflow error

net.ipv4.tcp_max_tw_buckets=50000

6.关闭 Transparent Huge Page Compaction,cloudera上报过超高CPU使用率issue。

7.如果是Centos 7,还得关闭Tuned服务,该服务自动收集操作系统metrics,进行相应优化,Cloudera官网建议关闭。

8. 设置Read Ahead. Linux IO 读取时,会启动预读功能,默认一次512个 Sections,大数据来讲太小,设置2048个Sections(1M)能提升10%左右性能,/sbin/blockdev --setra 2048

9.禁止IPv6,大数据组件走IPv4

##Disabled IPv6

net.ipv6.conf.all.disable_ipv6 = 1

net.ipv6.conf.default.disable_ipv6 = 1

net.ipv6.conf.lo.disable_ipv6 = 1

10.加大系统资源上限

默认资源上限太保守,需要加大。也就是ulimit那些。

对于centos6,修改文件/etc/security/limits.conf:或者在目录/etc/security/limits.d/*加文件,文件名还有特殊的要求,否则不生效

90-nproc.conf 设置各用户的hard/soft noproc 上限

99-nofiles.conf 设置各用户能打开的文件数 soft/hard nofile

hive - nofile  104800

kafka - nofile  104800

对于centos7 /etc/security/limits.conf (包括 /etc/security/limits.d/目录,如/etc/security/limits.d/20-nproc.conf )作用被限制了,只能影响PAM登录服务,对于systemd开户服务不起作用,

需要systemd特殊配置:

/etc/systemd/system.conf 和/etc/systemd/system.conf.d/*

/etc/systemd/user.conf和/etc/systemd/user.conf.d/*

DefaultLimitNOFILE=100000

DefaultLimitNPROC=65535

另外centos 5/6/7中 /etc/security/limits.conf: * soft noproc 65536这种配置对root不起作用,root用户需要单独写。

https://docs.cloudera.com/documentation/other/reference-architecture/topics/ra_bare_metal_deployment.html

上一篇 下一篇

猜你喜欢

热点阅读