diff --git a/check-before-deployment.md b/check-before-deployment.md index 378e5f529d186..3a284577fceaa 100644 --- a/check-before-deployment.md +++ b/check-before-deployment.md @@ -23,8 +23,6 @@ Take the `/dev/nvme0n1` data disk as an example: 1. View the data disk. - {{< copyable "shell-root" >}} - ```bash fdisk -l ``` @@ -35,8 +33,6 @@ Take the `/dev/nvme0n1` data disk as an example: 2. Create the partition. - {{< copyable "shell-root" >}} - ```bash parted -s -a optimal /dev/nvme0n1 mklabel gpt -- mkpart primary ext4 1 -1 ``` @@ -54,8 +50,6 @@ Take the `/dev/nvme0n1` data disk as an example: 3. Format the data disk to the ext4 filesystem. - {{< copyable "shell-root" >}} - ```bash mkfs.ext4 /dev/nvme0n1p1 ``` @@ -64,8 +58,6 @@ Take the `/dev/nvme0n1` data disk as an example: In this example, the UUID of nvme0n1p1 is `c51eb23b-195c-4061-92a9-3fad812cc12f`. - {{< copyable "shell-root" >}} - ```bash lsblk -f ``` @@ -83,8 +75,6 @@ Take the `/dev/nvme0n1` data disk as an example: 5. Edit the `/etc/fstab` file and add the `nodelalloc` mount options. - {{< copyable "shell-root" >}} - ```bash vi /etc/fstab ``` @@ -95,8 +85,6 @@ Take the `/dev/nvme0n1` data disk as an example: 6. Mount the data disk. - {{< copyable "shell-root" >}} - ```bash mkdir /data1 && \ systemctl daemon-reload && \ @@ -105,8 +93,6 @@ Take the `/dev/nvme0n1` data disk as an example: 7. Check using the following command. - {{< copyable "shell-root" >}} - ```bash mount -t ext4 ``` @@ -177,8 +163,6 @@ The rest of this section describes how to stop the firewall service of a target 1. Check the firewall status. Take CentOS Linux release 7.7.1908 (Core) as an example. - {{< copyable "shell-regular" >}} - ```shell sudo firewall-cmd --state sudo systemctl status firewalld.service @@ -186,24 +170,18 @@ The rest of this section describes how to stop the firewall service of a target 2. Stop the firewall service. - {{< copyable "shell-regular" >}} - ```bash sudo systemctl stop firewalld.service ``` 3. Disable automatic start of the firewall service. - {{< copyable "shell-regular" >}} - ```bash sudo systemctl disable firewalld.service ``` 4. Check the firewall status. - {{< copyable "shell-regular" >}} - ```bash sudo systemctl status firewalld.service ``` @@ -218,8 +196,6 @@ To check whether the NTP service is installed and whether it synchronizes with t 1. Run the following command. If it returns `running`, then the NTP service is running. - {{< copyable "shell-regular" >}} - ```bash sudo systemctl status ntpd.service ``` @@ -232,8 +208,6 @@ To check whether the NTP service is installed and whether it synchronizes with t - If it returns `Unit ntpd.service could not be found.`, then try the following command to see whether your system is configured to use `chronyd` instead of `ntpd` to perform clock synchronization with NTP: - {{< copyable "shell-regular" >}} - ```bash sudo systemctl status chronyd.service ``` @@ -254,8 +228,6 @@ To check whether the NTP service is installed and whether it synchronizes with t > > For the Ubuntu system, you need to install the `ntpstat` package. - {{< copyable "shell-regular" >}} - ```bash ntpstat ``` @@ -286,8 +258,6 @@ To check whether the NTP service is installed and whether it synchronizes with t > > This only applies to systems that use Chrony instead of NTPd. - {{< copyable "shell-regular" >}} - ```bash chronyc tracking ``` @@ -324,8 +294,6 @@ To check whether the NTP service is installed and whether it synchronizes with t To make the NTP service start synchronizing as soon as possible, run the following command. Replace `pool.ntp.org` with your NTP server. -{{< copyable "shell-regular" >}} - ```bash sudo systemctl stop ntpd.service && \ sudo ntpdate pool.ntp.org && \ @@ -334,8 +302,6 @@ sudo systemctl start ntpd.service To install the NTP service manually on the CentOS 7 system, run the following command: -{{< copyable "shell-regular" >}} - ```bash sudo yum install ntp ntpdate && \ sudo systemctl start ntpd.service && \ @@ -358,8 +324,6 @@ Take the following steps to check the current operating system configuration and 1. Execute the following command to see whether THP is enabled or disabled: - {{< copyable "shell-regular" >}} - ```bash cat /sys/kernel/mm/transparent_hugepage/enabled ``` @@ -406,8 +370,6 @@ Take the following steps to check the current operating system configuration and 3. Execute the following command to see the `ID_SERIAL` of the disk: - {{< copyable "shell-regular" >}} - ```bash udevadm info --name=/dev/sdb | grep ID_SERIAL ``` @@ -424,8 +386,6 @@ Take the following steps to check the current operating system configuration and 4. Execute the following command to see the power policy of the cpufreq module: - {{< copyable "shell-regular" >}} - ```bash cpupower frequency-info --policy ``` @@ -446,8 +406,6 @@ Take the following steps to check the current operating system configuration and 1. Execute the `tuned-adm list` command to see the tuned profile of the current operating system: - {{< copyable "shell-regular" >}} - ```bash tuned-adm list ``` @@ -471,8 +429,6 @@ Take the following steps to check the current operating system configuration and 2. Create a new tuned profile: - {{< copyable "shell-regular" >}} - ```bash mkdir /etc/tuned/balanced-tidb-optimal/ vi /etc/tuned/balanced-tidb-optimal/tuned.conf @@ -501,8 +457,6 @@ Take the following steps to check the current operating system configuration and > > If your device uses the `noop` or `none` I/O Scheduler, skip this step. No Scheduler configuration is needed in the tuned profile. - {{< copyable "shell-regular" >}} - ```bash tuned-adm profile balanced-tidb-optimal ``` @@ -515,8 +469,6 @@ Take the following steps to check the current operating system configuration and > > Install the `grubby` package first before you execute `grubby`. - {{< copyable "shell-regular" >}} - ```bash grubby --default-kernel ``` @@ -527,20 +479,16 @@ Take the following steps to check the current operating system configuration and 2. Execute `grubby --update-kernel` to modify the kernel configuration: - {{< copyable "shell-regular" >}} - ```bash grubby --args="transparent_hugepage=never" --update-kernel `grubby --default-kernel` ``` > **Note:** > - > You can also specify the actual version number after `--update-kernel`, for example, `--update-kernel /boot/vmlinuz-3.10.0-957.el7.x86_64`. + > You can also specify the actual version number after `--update-kernel`, for example, `--update-kernel /boot/vmlinuz-3.10.0-957.el7.x86_64` or `ALL`. 3. Execute `grubby --info` to see the modified default kernel configuration: - {{< copyable "shell-regular" >}} - ```bash grubby --info /boot/vmlinuz-3.10.0-957.el7.x86_64 ``` @@ -560,8 +508,6 @@ Take the following steps to check the current operating system configuration and 4. Modify the current kernel configuration to immediately disable THP: - {{< copyable "shell-regular" >}} - ```bash echo never > /sys/kernel/mm/transparent_hugepage/enabled echo never > /sys/kernel/mm/transparent_hugepage/defrag @@ -569,8 +515,6 @@ Take the following steps to check the current operating system configuration and 5. Configure the I/O Scheduler in the udev script: - {{< copyable "shell-regular" >}} - ```bash vi /etc/udev/rules.d/60-tidb-schedulers.rules ``` @@ -587,8 +531,6 @@ Take the following steps to check the current operating system configuration and > > If your device uses the `noop` or `none` I/O Scheduler, skip this step. No udev rules configuration is needed. - {{< copyable "shell-regular" >}} - ```bash udevadm control --reload-rules udevadm trigger --type=devices --action=change @@ -596,8 +538,6 @@ Take the following steps to check the current operating system configuration and 7. Create a service to configure the CPU power policy: - {{< copyable "shell-regular" >}} - ```bash cat >> /etc/systemd/system/cpupower.service << EOF [Unit] @@ -612,8 +552,6 @@ Take the following steps to check the current operating system configuration and 8. Apply the CPU power policy configuration service: - {{< copyable "shell-regular" >}} - ```bash systemctl daemon-reload systemctl enable cpupower.service @@ -622,8 +560,6 @@ Take the following steps to check the current operating system configuration and 6. Execute the following command to verify the THP status: - {{< copyable "shell-regular" >}} - ```bash cat /sys/kernel/mm/transparent_hugepage/enabled ``` @@ -634,8 +570,6 @@ Take the following steps to check the current operating system configuration and 7. Execute the following command to verify the I/O Scheduler of the disk where the data directory is located: - {{< copyable "shell-regular" >}} - ```bash cat /sys/block/sd[bc]/queue/scheduler ``` @@ -647,8 +581,6 @@ Take the following steps to check the current operating system configuration and 8. Execute the following command to see the power policy of the cpufreq module: - {{< copyable "shell-regular" >}} - ```bash cpupower frequency-info --policy ``` @@ -661,8 +593,6 @@ Take the following steps to check the current operating system configuration and 9. Execute the following commands to modify the `sysctl` parameters: - {{< copyable "shell-regular" >}} - ```bash echo "fs.file-max = 1000000">> /etc/sysctl.conf echo "net.core.somaxconn = 32768">> /etc/sysctl.conf @@ -683,8 +613,6 @@ Take the following steps to check the current operating system configuration and 10. Execute the following command to configure the user's `limits.conf` file: - {{< copyable "shell-regular" >}} - ```bash cat << EOF >>/etc/security/limits.conf tidb soft nofile 1000000 @@ -700,8 +628,6 @@ This section describes how to manually configure the SSH mutual trust and sudo w 1. Log in to the target machine respectively using the `root` user account, create the `tidb` user and set the login password. - {{< copyable "shell-root" >}} - ```bash useradd tidb && \ passwd tidb @@ -709,8 +635,6 @@ This section describes how to manually configure the SSH mutual trust and sudo w 2. To configure sudo without password, run the following command, and add `tidb ALL=(ALL) NOPASSWD: ALL` to the end of the file: - {{< copyable "shell-root" >}} - ```bash visudo ``` @@ -721,8 +645,6 @@ This section describes how to manually configure the SSH mutual trust and sudo w 3. Use the `tidb` user to log in to the control machine, and run the following command. Replace `10.0.1.1` with the IP of your target machine, and enter the `tidb` user password of the target machine as prompted. After the command is executed, SSH mutual trust is already created. This applies to other machines as well. Newly created `tidb` users do not have the `.ssh` directory. To create such a directory, execute the command that generates the RSA key. To deploy TiDB components on the control machine, configure mutual trust for the control machine and the control machine itself. - {{< copyable "shell-regular" >}} - ```bash ssh-keygen -t rsa ssh-copy-id -i ~/.ssh/id_rsa.pub 10.0.1.1 @@ -730,8 +652,6 @@ This section describes how to manually configure the SSH mutual trust and sudo w 4. Log in to the control machine using the `tidb` user account, and log in to the IP of the target machine using `ssh`. If you do not need to enter the password and can successfully log in, then the SSH mutual trust is successfully configured. - {{< copyable "shell-regular" >}} - ```bash ssh 10.0.1.1 ``` @@ -742,8 +662,6 @@ This section describes how to manually configure the SSH mutual trust and sudo w 5. After you log in to the target machine using the `tidb` user, run the following command. If you do not need to enter the password and can switch to the `root` user, then sudo without password of the `tidb` user is successfully configured. - {{< copyable "shell-regular" >}} - ```bash sudo -su root ``` diff --git a/tiup/tiup-component-cluster-check.md b/tiup/tiup-component-cluster-check.md index 02f557ce0d1c1..1147901f9e0ce 100644 --- a/tiup/tiup-component-cluster-check.md +++ b/tiup/tiup-component-cluster-check.md @@ -52,6 +52,16 @@ Check the values of the following kernel parameters: Check whether THP is enabled on the target machine. It is recommended to disable THP. +To check if THP is enabled you can run this: + +``` +cat /sys/kernel/mm/transparent_hugepage/enabled +``` + +If it is not set to `never`, you can change it with `grubby --update-kernel=ALL --args="transparent_hugepage=never"`. + +To change the running configuration, either reboot or run `echo never > /sys/kernel/mm/transparent_hugepage/enabled`. + ### System limits Check the limit values in the `/etc/security/limits.conf` file: diff --git a/tune-operating-system.md b/tune-operating-system.md index 5ebe079bdf903..9d48fca75e5c7 100644 --- a/tune-operating-system.md +++ b/tune-operating-system.md @@ -69,6 +69,7 @@ It is **NOT** recommended to use THP for database applications, because database ```shell echo never > /sys/kernel/mm/transparent_hugepage/enabled echo never > /sys/kernel/mm/transparent_hugepage/defrag +grubby --update-kernel="$KERNEL" --args='transparent_hugepage=never' ``` ### Memory—virtual memory parameters