修改操作系统参数

修改“/etc/sysctl.conf”文件,使用Greenplum官网推荐的操作系统参数,以获得更好的性能。请在所有节点执行本章节的操作。

  1. 打开“/etc/sysctl.conf”文件。

    vim /etc/sysctl.conf

  2. 按“i”进入编辑模式,新增如下内容。以下参数包含Greenplum官网推荐的操作系统参数和自定义,用户也可以根据实际情况进行调整。

    Greenplum官方推荐的操作系统参数,用户也可以根据实际情况调整。其中,自定义参数是为了解决Greenplum运行SQL时提示interconnect encountered a network error的问题,也建议用户参考本步骤来设置。

    #Greenplum官网推荐的操作系统参数
    kernel.shmall = 4000000000 # echo $(expr $(getconf _PHYS_PAGES) / 2)
    kernel.shmmax = 500000000 # echo $(expr $(getconf _PHYS_PAGES) / 2 \* $(getconf PAGE_SIZE))
    kernel.shmmni = 4096
    kernel.sem = 1000 10240000 400 10240
    kernel.sysrq = 1
    kernel.core_uses_pid = 1
    kernel.msgmnb = 65536
    kernel.msgmax = 65536
    kernel.msgmni = 2048
    net.ipv4.tcp_syncookies = 1
    net.ipv4.conf.default.accept_source_route = 0
    net.ipv4.tcp_tw_recycle = 1
    net.ipv4.tcp_max_syn_backlog = 4096
    net.ipv4.conf.all.arp_filter = 1
    net.ipv4.ip_local_port_range = 10000 65535
    net.core.netdev_max_backlog = 10000
    net.core.rmem_max = 2097152
    net.core.wmem_max = 2097152
    vm.overcommit_memory = 2
    vm.overcommit_ratio = 95 #vm.overcommit_ratio = (RAM - 0.026 * gp_vmem_rq) / RAM #gp_vmem_rq = ((SWAP + RAM) – (7.5GB + 0.05 * RAM)) / 1.7
    vm.swappiness = 10
    #自定义参数
    net.ipv4.ipfrag_max_dist = 64000
    net.ipv4.ipfrag_time = 6000
    net.ipv4.ipfrag_high_thresh = 6710886400
    net.ipv4.ipfrag_low_thresh = 671088640

  3. “Esc”键,输入:wq!,按“Enter”保存并退出编辑。
  4. 使修改生效。

    sysctl -p