zoukankan      html  css  js  c++  java
  • Tidb 主机系统参数优化shell

    #!/bin/bash
    #
    echo "vm.swappiness = 0">> /etc/sysctl.conf
    swapoff -a && swapon -a
    sysctl -p
    systemctl stop firewalld.service
    systemctl disable firewalld.service

    yum install -y ntp ntpdate
    /usr/sbin/ntpdate ntp.aliyun.com

    echo never > /sys/kernel/mm/transparent_hugepage/enabled
    echo never > /sys/kernel/mm/transparent_hugepage/defrag

    echo "noop" > /sys/block/sda/queue/scheduler

    cat /sys/kernel/mm/transparent_hugepage/enabled
    cat /sys/block/sda/queue/scheduler

    mkdir /etc/tuned/balanced-tidb-optimal/
    touch /etc/tuned/balanced-tidb-optimal/tuned.conf
    cat << EOF >> touch /etc/tuned/balanced-tidb-optimal/tuned.conf
    [main]
    include=balanced

    [cpu]
    governor=performance

    [vm]
    transparent_hugepages=never

    [disk]
    devices_udev_regex=(ID_SERIAL=36d0946606d79f90025f3e09a0c1fc035)|(ID_SERIAL=36d0946606d79f90025f3e09a0c1f9e81)
    elevator=noop
    EOF

    tuned-adm profile balanced-tidb-optimal

    echo "fs.file-max = 1000000">> /etc/sysctl.conf
    echo "net.core.somaxconn = 32768">> /etc/sysctl.conf
    echo "net.ipv4.tcp_tw_recycle = 0">> /etc/sysctl.conf
    echo "net.ipv4.tcp_syncookies = 0">> /etc/sysctl.conf
    echo "vm.overcommit_memory = 1">> /etc/sysctl.conf
    echo "vm.swappiness = 0">> /etc/sysctl.conf
    sysctl -p

    cat << EOF >>/etc/security/limits.conf
    tidb soft nofile 1000000
    tidb hard nofile 1000000
    tidb soft stack 32768
    tidb hard stack 32768
    EOF

    useradd tidb &&
    passwd tidb <<EOF
    123
    123
    EOF

    cat << EOF >> /etc/sudoers
    tidb ALL=(ALL) NOPASSWD: ALL
    EOF

    yum -y install numactl

    =================================================================

    ssh-keygen -t rsa
    ssh-copy-id -i ~/.ssh/id_rsa.pub 192.168.1.xxx

    ssh-copy-id -i ~/.ssh/id_rsa.pub 192.168.1.yyy

  • 相关阅读:
    C++调用WebService
    vs2005 环境的字体和颜色的设置
    自娱自乐~经典24点游戏
    再探利用C++的STL和堆栈编程思想实现数学四则运算计算结果
    如何在Linux中关闭apache服务(转)
    ios推送:本地通知UILocalNotification
    ASIHTTPRequest的使用(转)
    实战新浪微博、腾讯微博的分享功能(转)
    UIImagePickerController拍照与摄像(转)
    iOS通过http post上传图片 (转)
  • 原文地址:https://www.cnblogs.com/walkersss/p/14864194.html
Copyright © 2011-2022 走看看