zoukankan      html  css  js  c++  java
  • 部署elasticsearch内核优化

    1.优化脚本

    if [ `grep 'soft memlock unlimited' /etc/security/limits.conf|wc -l ` -eq 0 ];then
       echo '* soft memlock unlimited' >> /etc/security/limits.conf
    fi
    
    if [ `grep 'hard memlock unlimited' /etc/security/limits.conf|wc -l ` -eq 0 ];then
        echo '* hard memlock unlimited' >> /etc/security/limits.conf
    fi
    
    if [ `grep 'vm.max_map_count'  /etc/sysctl.conf|wc -l` -eq 0 ];then
       echo 'vm.max_map_count=262144' >>/etc/sysctl.conf
    fi
    
    if [ `grep 'soft nofile 65536' /etc/security/limits.conf|wc -l` -eq 0 ];then
       echo "* soft nofile 65536" >> /etc/security/limits.conf
    fi
    
    if [ `grep 'hard nofile 65536' /etc/security/limits.conf|wc -l` -eq 0 ];then
       echo "* hard nofile 65536" >> /etc/security/limits.conf
    fi

    2.limits文件全部内容

    [root@centos7 ~]# cat /etc/security/limits.conf
    # /etc/security/limits.conf
    #
    #This file sets the resource limits for the users logged in via PAM.
    #It does not affect resource limits of the system services.
    #
    #Also note that configuration files in /etc/security/limits.d directory,
    #which are read in alphabetical order, override the settings in this
    #file in case the domain is the same or more specific.
    #That means for example that setting a limit for wildcard domain here
    #can be overriden with a wildcard setting in a config file in the
    #subdirectory, but a user specific setting here can be overriden only
    #with a user specific setting in the subdirectory.
    #
    #Each line describes a limit for a user in the form:
    #
    #<domain>        <type>  <item>  <value>
    #
    #Where:
    #<domain> can be:
    #        - a user name
    #        - a group name, with @group syntax
    #        - the wildcard *, for default entry
    #        - the wildcard %, can be also used with %group syntax,
    #                 for maxlogin limit
    #
    #<type> can have the two values:
    #        - "soft" for enforcing the soft limits
    #        - "hard" for enforcing hard limits
    #
    #<item> can be one of the following:
    #        - core - limits the core file size (KB)
    #        - data - max data size (KB)
    #        - fsize - maximum filesize (KB)
    #        - memlock - max locked-in-memory address space (KB)
    #        - nofile - max number of open file descriptors
    #        - rss - max resident set size (KB)
    #        - stack - max stack size (KB)
    #        - cpu - max CPU time (MIN)
    #        - nproc - max number of processes
    #        - as - address space limit (KB)
    #        - maxlogins - max number of logins for this user
    #        - maxsyslogins - max number of logins on the system
    #        - priority - the priority to run user process with
    #        - locks - max number of file locks the user can hold
    #        - sigpending - max number of pending signals
    #        - msgqueue - max memory used by POSIX message queues (bytes)
    #        - nice - max nice priority allowed to raise to values: [-20, 19]
    #        - rtprio - max realtime priority
    #
    #<domain>      <type>  <item>         <value>
    #
    
    #*               soft    core            0
    #*               hard    rss             10000
    #@student        hard    nproc           20
    #@faculty        soft    nproc           20
    #@faculty        hard    nproc           50
    #ftp             hard    nproc           0
    #@student        -       maxlogins       4
    
    # End of file
    *      soft    nofile  65535
    
    *      hard    nofile  65535
    
    *      soft    nproc   65535
    
    *      hard    nproc   65535
    * soft memlock unlimited
    * hard memlock unlimited
    * soft nofile 65536
    * hard nofile 65536

    3.sysctl文件全部内容

    [root@centos7 ~]# cat /etc/sysctl.conf
    # sysctl settings are defined through files in
    # /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
    #
    # Vendors settings live in /usr/lib/sysctl.d/.
    # To override a whole file, create a new file with the same in
    # /etc/sysctl.d/ and put new settings there. To override
    # only specific settings, add a file with a lexically later
    # name in /etc/sysctl.d/ and put new settings there.
    #
    # For more information, see sysctl.conf(5) and sysctl.d(5).
    vm.max_map_count=262144
  • 相关阅读:
    215. Kth Largest Element in an Array (have better solution )
    414. Third Maximum Number
    442. Find All Duplicates in an Array
    448. Find All Numbers Disappeared in an Array
    485. Max Consecutive Ones
    532. K-diff Pairs in an Array
    8. String to Integer (atoi)
    7. Reverse Integer
    [CTSC2012]熟悉的文章(广义后缀自动机+二分答案+单调队列优化DP)
    BZOJ 2119 股市的预测(后缀数组)
  • 原文地址:https://www.cnblogs.com/faithH/p/13535308.html
Copyright © 2011-2022 走看看