unix环境中,百万级数据量参数配置


1、修改内核网络参数 (注意:使用dmesg命令查看日志,动态修改)
vi /etc/sysctrl.conf
fs.inotify.max_user_watches = 2000000
fs.nr_open = 2000000
fs.file-max = 2000000
net.core.rmem_default = 1048576
net.core.wmem_default = 1048576
net.core.rmem_max = 8388608
net.core.wmem_max = 8388608
net.core.netdev_max_backlog = 3000
net.core.somaxconn = 256
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_fin_timeout = 2
net.ipv4.tcp_max_tw_buckets = 1000
net.ipv4.tcp_rmem = 4096 1048576 8388608
net.ipv4.tcp_wmem = 4096 1048576 8388608
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_sack = 0
net.ipv4.tcp_no_metrics_save = 1
net.ipv4.tcp_keepalive_time = 1800
net.ipv4.tcp_keepalive_intvl = 30
net.ipv4.tcp_keepalive_probes = 3
net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.route.flush = 1
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.promote_secondaries = 1
net.ipv4.conf.all.promote_secondaries = 1
net.ipv4.conf.all.arp_ignore = 2
net.ipv4.conf.default.arp_ignore = 2
net.ipv4.ip_local_port_range = 1024 65535
net.ipv4.conf.all.arp_ignore = 2
net.ipv4.conf.default.arp_announce = 1
net.ipv4.conf.all.arp_announce = 1
kernel.sysrq = 1
  
2、文件句柄修改 .目前只支持linux内核2.6.25之后(Suse11)
               sudo bash -c 'echo 1500000 > /proc/sys/fs/nr_open'
               vim /etc/security/limits.conf
               添加:
* soft nofile 1500000
                  *  hard nofile 1500000

 

你可能感兴趣的:(unix)